mtd: nand/fsmc: Pass partition information through platform data

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Mar 26 20:59:17 EDT 2012


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=7147032485293fc24751e4dede98ff29050fd3bd
Commit:     7147032485293fc24751e4dede98ff29050fd3bd
Parent:     b2a2a84d35e0f42ad26e326ec4258f6a8b8eecbe
Author:     Vipin Kumar <vipin.kumar at st.com>
AuthorDate: Wed Mar 14 11:47:07 2012 +0530
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Tue Mar 27 00:57:32 2012 +0100

    mtd: nand/fsmc: Pass partition information through platform data
    
    This patch reimplements the passing of partition information through platform
    data. This was unintentionally deleted in commit
    0d04eda1430e9a796214bee644b7e05d99cfe613
    "mtd: fsmc_nand.c: use mtd_device_parse_register"
    
    Artem: fix gcc warning about passin 0 instead of NULL.
    
    Signed-off-by: Vipin Kumar <vipin.kumar at st.com>
    Acked-by: Stefan Roese <sr at denx.de>
    Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
    Cc: stable at kernel.org [3.2+]
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/nand/fsmc_nand.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c
index 588e373..7338d33 100644
--- a/drivers/mtd/nand/fsmc_nand.c
+++ b/drivers/mtd/nand/fsmc_nand.c
@@ -333,6 +333,8 @@ static struct mtd_partition partition_info_128KB_blk[] = {
  * @pid:		Part ID on the AMBA PrimeCell format
  * @mtd:		MTD info for a NAND flash.
  * @nand:		Chip related info for a NAND flash.
+ * @partitions:		Partition info for a NAND Flash.
+ * @nr_partitions:	Total number of partition of a NAND flash.
  *
  * @ecc_place:		ECC placing locations in oobfree type format.
  * @bank:		Bank number for probed device.
@@ -347,6 +349,8 @@ struct fsmc_nand_data {
 	u32			pid;
 	struct mtd_info		mtd;
 	struct nand_chip	nand;
+	struct mtd_partition	*partitions;
+	unsigned int		nr_partitions;
 
 	struct fsmc_eccplace	*ecc_place;
 	unsigned int		bank;
@@ -833,6 +837,8 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
 
 	host->bank = pdata->bank;
 	host->select_chip = pdata->select_bank;
+	host->partitions = pdata->partitions;
+	host->nr_partitions = pdata->nr_partitions;
 	regs = host->regs_va;
 
 	/* Link all private pointers */
@@ -943,12 +949,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
 	 */
 	host->mtd.name = "nand";
 	ret = mtd_device_parse_register(&host->mtd, NULL, NULL,
-					host->mtd.size <= 0x04000000 ?
-					partition_info_16KB_blk :
-					partition_info_128KB_blk,
-					host->mtd.size <= 0x04000000 ?
-					ARRAY_SIZE(partition_info_16KB_blk) :
-					ARRAY_SIZE(partition_info_128KB_blk));
+					host->partitions, host->nr_partitions);
 	if (ret)
 		goto err_probe;
 



More information about the linux-mtd-cvs mailing list