Skip to content

Commit f36e20c

Browse files
bigguinessDavid Woodhouse
authored and
David Woodhouse
committed
mtd: plat_nand: allow platform to set partitions
Add optional callback to allow platform to initialize partitions. Static partitions on a nand device could vary depending on the size of the device. This patch allows an optional platform callback to be used to setup this partition information at runtime. Scan order is: 1) chip.part_probe_types 2) chip.set_parts 3) chip.partitions 4) full mtd device (fallback for no partitions) Some of the existing nand drivers could possibly be replaced by the plat_nand driver by using this patch. These include autcpu12.c and ts7250.c drivers. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
1 parent bf95efd commit f36e20c

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

drivers/mtd/nand/plat_nand.c

+2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ static int __devinit plat_nand_probe(struct platform_device *pdev)
9595
return 0;
9696
}
9797
}
98+
if (pdata->chip.set_parts)
99+
pdata->chip.set_parts(data->mtd.size, &pdata->chip);
98100
if (pdata->chip.partitions) {
99101
data->parts = pdata->chip.partitions;
100102
res = add_mtd_partitions(&data->mtd, data->parts,

include/linux/mtd/nand.h

+3
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,7 @@ extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len,
563563
* @options: Option flags, e.g. 16bit buswidth
564564
* @ecclayout: ecc layout info structure
565565
* @part_probe_types: NULL-terminated array of probe types
566+
* @set_parts: platform specific function to set partitions
566567
* @priv: hardware controller specific settings
567568
*/
568569
struct platform_nand_chip {
@@ -574,6 +575,8 @@ struct platform_nand_chip {
574575
int chip_delay;
575576
unsigned int options;
576577
const char **part_probe_types;
578+
void (*set_parts)(uint64_t size,
579+
struct platform_nand_chip *chip);
577580
void *priv;
578581
};
579582

0 commit comments

Comments
 (0)