ARM: pxa/spitz: Remove hardcoded partitioning, use sharpslpart parser
authorAndrea Adami <andrea.adami@gmail.com>
Tue, 21 Nov 2017 21:43:50 +0000 (22:43 +0100)
committerRobert Jarzmik <robert.jarzmik@free.fr>
Tue, 28 Nov 2017 21:52:57 +0000 (22:52 +0100)
With the introduction of sharpslpart partition parser we can now read the
offsets from NAND: we specify the list of the parsers as platform data, with
cmdlinepart and ofpart parsers first allowing to override the part. table
written in NAND. This is done here in the board file.

Emulators like qemu will need to pass the mtdparts in the cmdline.

Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
arch/arm/mach-pxa/spitz.c

index effe260abb2eda84e38246e3a7084b00f5ce2742..5d50025492b7f2a435f1fc3cc60e88a4e015f49f 100644 (file)
@@ -739,21 +739,6 @@ static inline void spitz_lcd_init(void) {}
  * NAND Flash
  ******************************************************************************/
 #if defined(CONFIG_MTD_NAND_SHARPSL) || defined(CONFIG_MTD_NAND_SHARPSL_MODULE)
-static struct mtd_partition spitz_nand_partitions[] = {
-       {
-               .name = "System Area",
-               .offset = 0,
-               .size = 7 * 1024 * 1024,
-       }, {
-               .name = "Root Filesystem",
-               .offset = 7 * 1024 * 1024,
-       }, {
-               .name = "Home Filesystem",
-               .offset = MTDPART_OFS_APPEND,
-               .size = MTDPART_SIZ_FULL,
-       },
-};
-
 static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
 
 static struct nand_bbt_descr spitz_nand_bbt = {
@@ -808,10 +793,16 @@ static const struct mtd_ooblayout_ops akita_ooblayout_ops = {
        .free = akita_ooblayout_free,
 };
 
+static const char * const probes[] = {
+       "cmdlinepart",
+       "ofpart",
+       "sharpslpart",
+       NULL,
+};
+
 static struct sharpsl_nand_platform_data spitz_nand_pdata = {
        .badblock_pattern       = &spitz_nand_bbt,
-       .partitions             = spitz_nand_partitions,
-       .nr_partitions          = ARRAY_SIZE(spitz_nand_partitions),
+       .part_parsers           = probes,
 };
 
 static struct resource spitz_nand_resources[] = {
@@ -834,14 +825,7 @@ static struct platform_device spitz_nand_device = {
 
 static void __init spitz_nand_init(void)
 {
-       if (machine_is_spitz()) {
-               spitz_nand_partitions[1].size = 5 * 1024 * 1024;
-       } else if (machine_is_akita()) {
-               spitz_nand_partitions[1].size = 58 * 1024 * 1024;
-               spitz_nand_bbt.len = 1;
-               spitz_nand_pdata.ecc_layout = &akita_ooblayout_ops;
-       } else if (machine_is_borzoi()) {
-               spitz_nand_partitions[1].size = 32 * 1024 * 1024;
+       if (machine_is_akita() || machine_is_borzoi()) {
                spitz_nand_bbt.len = 1;
                spitz_nand_pdata.ecc_layout = &akita_ooblayout_ops;
        }