mtd: fsmc_nand.c: Partition info from pdata overrides driver defaults
Subsystems (2)
PATCH 1/1 mtd: fsmc_nand.c: Partition info from pdata overrides driver defaults
This patch enables the partition info from the platform data (if provided) to override the default partition info included in the fsmc NAND driver.
Signed-off-by Stefan Roese <[email protected]>
Cc Dmitry Eremin-Solenikov <[email protected]>
--- drivers/mtd/nand/fsmc_nand.c | 22 +++++++++++++++------- 1 files changed, 15 insertions(+), 7 deletions(-)
drivers/mtd/nand/fsmc_nand.c +15 -7
@@ -533,6 +533,8 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)struct nand_chip *nand;struct fsmc_regs *regs;struct resource *res; +struct mtd_partition *parts; +int count;int ret =0 ;u32 pid;int i;
@@ -713,13 +715,19 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)* Check for partition info passed */ host->mtd.name ="nand" ; - ret =mtd_device_parse_register (&host->mtd,NULL ,0 , - 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)); +if (pdata->partitions) { + parts = pdata->partitions; + count = pdata->nr_partitions; + }else { +if (host->mtd.size <=0x04000000 ) { + parts = partition_info_16KB_blk; + count =ARRAY_SIZE (partition_info_16KB_blk); + }else { + parts = partition_info_128KB_blk; + count =ARRAY_SIZE (partition_info_128KB_blk); + } + } + ret =mtd_device_parse_register (&host->mtd,NULL ,0 , parts, count);if (ret) goto err_probe;
Signature · 1 line
1.7.8.3