Commit 78dd9e3500873edd6005a41f8ba178eacbff64c5

Authored by Dmitry Eremin-Solenikov
Committed by Artem Bityutskiy
1 parent 1a31368bf9

ts72xx: use MTDPART_OFS_RETAIN for mtd partitioning

Instead of specifying a callback for dynamic partitioning, use
MTDPART_OFS_RETAIN for reserving a place near the end of flash for
RedBoot.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ryan Mallon <ryan@bluewatersys.com>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

Showing 1 changed file with 5 additions and 18 deletions Side-by-side Diff

arch/arm/mach-ep93xx/ts72xx.c
... ... @@ -116,8 +116,9 @@
116 116 .mask_flags = MTD_WRITEABLE, /* force read-only */
117 117 }, {
118 118 .name = "Linux",
119   - .offset = MTDPART_OFS_APPEND,
120   - .size = 0, /* filled in later */
  119 + .offset = MTDPART_OFS_RETAIN,
  120 + .size = TS72XX_REDBOOT_PART_SIZE,
  121 + /* leave so much for last partition */
121 122 }, {
122 123 .name = "RedBoot",
123 124 .offset = MTDPART_OFS_APPEND,
124 125  
... ... @@ -126,28 +127,14 @@
126 127 },
127 128 };
128 129  
129   -static void ts72xx_nand_set_parts(uint64_t size,
130   - struct platform_nand_chip *chip)
131   -{
132   - /* Factory TS-72xx boards only come with 32MiB or 128MiB NAND options */
133   - if (size == SZ_32M || size == SZ_128M) {
134   - /* Set the "Linux" partition size */
135   - ts72xx_nand_parts[1].size = size - TS72XX_REDBOOT_PART_SIZE;
136   -
137   - chip->partitions = ts72xx_nand_parts;
138   - chip->nr_partitions = ARRAY_SIZE(ts72xx_nand_parts);
139   - } else {
140   - pr_warning("Unknown nand disk size:%lluMiB\n", size >> 20);
141   - }
142   -}
143   -
144 130 static struct platform_nand_data ts72xx_nand_data = {
145 131 .chip = {
146 132 .nr_chips = 1,
147 133 .chip_offset = 0,
148 134 .chip_delay = 15,
149 135 .part_probe_types = ts72xx_nand_part_probes,
150   - .set_parts = ts72xx_nand_set_parts,
  136 + .partitions = ts72xx_nand_parts,
  137 + .nr_partitions = ARRAY_SIZE(ts72xx_nand_parts),
151 138 },
152 139 .ctrl = {
153 140 .cmd_ctrl = ts72xx_nand_hwcontrol,