* [PATCH 2/3] ts72xx: use MTDPART_OFS_RETAIN for mtd partitioning [not found] <1307369056-29319-1-git-send-email-dbaryshkov@gmail.com> @ 2011-06-06 14:04 ` Dmitry Eremin-Solenikov 2011-07-08 15:35 ` Petr Štetiar 0 siblings, 1 reply; 4+ messages in thread From: Dmitry Eremin-Solenikov @ 2011-06-06 14:04 UTC (permalink / raw) To: linux-arm-kernel 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 at lists.infradead.org --- arch/arm/mach-ep93xx/ts72xx.c | 23 +++++------------------ 1 files changed, 5 insertions(+), 18 deletions(-) diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c index c2d2cf4..dea42e2 100644 --- a/arch/arm/mach-ep93xx/ts72xx.c +++ b/arch/arm/mach-ep93xx/ts72xx.c @@ -116,8 +116,9 @@ static struct mtd_partition ts72xx_nand_parts[] = { .mask_flags = MTD_WRITEABLE, /* force read-only */ }, { .name = "Linux", - .offset = MTDPART_OFS_APPEND, - .size = 0, /* filled in later */ + .offset = MTDPART_OFS_RETAIN, + .size = TS72XX_REDBOOT_PART_SIZE, + /* leave so much for last partition */ }, { .name = "RedBoot", .offset = MTDPART_OFS_APPEND, @@ -126,28 +127,14 @@ static struct mtd_partition ts72xx_nand_parts[] = { }, }; -static void ts72xx_nand_set_parts(uint64_t size, - struct platform_nand_chip *chip) -{ - /* Factory TS-72xx boards only come with 32MiB or 128MiB NAND options */ - if (size == SZ_32M || size == SZ_128M) { - /* Set the "Linux" partition size */ - ts72xx_nand_parts[1].size = size - TS72XX_REDBOOT_PART_SIZE; - - chip->partitions = ts72xx_nand_parts; - chip->nr_partitions = ARRAY_SIZE(ts72xx_nand_parts); - } else { - pr_warning("Unknown nand disk size:%lluMiB\n", size >> 20); - } -} - static struct platform_nand_data ts72xx_nand_data = { .chip = { .nr_chips = 1, .chip_offset = 0, .chip_delay = 15, .part_probe_types = ts72xx_nand_part_probes, - .set_parts = ts72xx_nand_set_parts, + .partitions = ts72xx_nand_parts, + .nr_partitions = ARRAY_SIZE(ts72xx_nand_parts), }, .ctrl = { .cmd_ctrl = ts72xx_nand_hwcontrol, -- 1.7.4.4 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] ts72xx: use MTDPART_OFS_RETAIN for mtd partitioning 2011-06-06 14:04 ` [PATCH 2/3] ts72xx: use MTDPART_OFS_RETAIN for mtd partitioning Dmitry Eremin-Solenikov @ 2011-07-08 15:35 ` Petr Štetiar 2011-06-11 10:38 ` Petr Štetiar 2011-06-11 21:02 ` Dmitry Eremin-Solenikov 0 siblings, 2 replies; 4+ messages in thread From: Petr Štetiar @ 2011-07-08 15:35 UTC (permalink / raw) To: linux-arm-kernel Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> [2011-06-06 18:04:15]: Hi, > Instead of specifying a callback for dynamic partitioning, use > MTDPART_OFS_RETAIN for reserving a place near the end of flash for > RedBoot. [...] > - .offset = MTDPART_OFS_APPEND, > - .size = 0, /* filled in later */ > + .offset = MTDPART_OFS_RETAIN, > + .size = TS72XX_REDBOOT_PART_SIZE, > + /* leave so much for last partition */ thank you for the mtd cleanup work. While testing this patch, I've noticed, that the TS72XX_REDBOOT_PART_SIZE is by 16K bigger, then it should be: Redboot: RedBoot> fis list Name FLASH addr Mem addr Length Entry point (reserved) 0x60000000 0x60000000 0x01D04000 0x00000000 RedBoot 0x61D04000 0x61D04000 0x00040000 0x00000000 vmlinux 0x61D44000 0x00218000 0x000C0000 0x00218000 FIS directory 0x61FFC000 0x61FFC000 0x00003000 0x00000000 RedBoot config 0x61FFF000 0x61FFF000 0x00001000 0x00000000 Linux: 0x000000000000-0x000000004000 : "TS-BOOTROM" 0x000000004000-0x000001d00000 : "Linux" 0x000001d00000-0x000002000000 : "RedBoot" So if I simply read now first 4 bytes from /dev/mtdblock2, there's no 'CRUS' or 'SURC' boot HeaderID/signature and it means, that there's no valid Redboot for ep93xx. The correct value is: #define TS72XX_REDBOOT_PART_SIZE (SZ_2M + SZ_1M - SZ_16K) And in the current state one could easily overwrite fis/fconfig while upgrading the Redboot from the Linux userspace and brick the board, because there's fis/fconfig stuff included in that Redboot partition. I think, that it would be better to either make that Redboot partition read-only by default, make it smaller so it wouldn't contain fconfig/fis parts in it or add fis/fconfig partitions also. I don't know what's preffered way of handling this, but since we're touching that part of the code, we should fix it right. Adding Mika to the Cc loop, since he has ts-7260. -- ynezz ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/3] ts72xx: use MTDPART_OFS_RETAIN for mtd partitioning 2011-07-08 15:35 ` Petr Štetiar @ 2011-06-11 10:38 ` Petr Štetiar 2011-06-11 21:02 ` Dmitry Eremin-Solenikov 1 sibling, 0 replies; 4+ messages in thread From: Petr Štetiar @ 2011-06-11 10:38 UTC (permalink / raw) To: linux-arm-kernel Petr ?tetiar <ynezz@true.cz> [2011-06-11 11:22:24]: > I think, that it would be better to either make that Redboot partition > read-only by default Sorry for the noise, it's read-only already, I've just missed that mask. -- ynezz ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/3] ts72xx: use MTDPART_OFS_RETAIN for mtd partitioning 2011-07-08 15:35 ` Petr Štetiar 2011-06-11 10:38 ` Petr Štetiar @ 2011-06-11 21:02 ` Dmitry Eremin-Solenikov 1 sibling, 0 replies; 4+ messages in thread From: Dmitry Eremin-Solenikov @ 2011-06-11 21:02 UTC (permalink / raw) To: linux-arm-kernel Hello, colleagues, On 6/11/11, Petr ?tetiar <ynezz@true.cz> wrote: > Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> [2011-06-06 18:04:15]: >> Instead of specifying a callback for dynamic partitioning, use >> MTDPART_OFS_RETAIN for reserving a place near the end of flash for >> RedBoot. > > [...] > >> - .offset = MTDPART_OFS_APPEND, >> - .size = 0, /* filled in later */ >> + .offset = MTDPART_OFS_RETAIN, >> + .size = TS72XX_REDBOOT_PART_SIZE, >> + /* leave so much for last partition */ > > thank you for the mtd cleanup work. While testing this patch, I've noticed, > that the TS72XX_REDBOOT_PART_SIZE is by 16K bigger, then it should be: > > Redboot: > > RedBoot> fis list > Name FLASH addr Mem addr Length Entry point > (reserved) 0x60000000 0x60000000 0x01D04000 0x00000000 > RedBoot 0x61D04000 0x61D04000 0x00040000 0x00000000 > vmlinux 0x61D44000 0x00218000 0x000C0000 0x00218000 > FIS directory 0x61FFC000 0x61FFC000 0x00003000 0x00000000 > RedBoot config 0x61FFF000 0x61FFF000 0x00001000 0x00000000 > > Linux: > > 0x000000000000-0x000000004000 : "TS-BOOTROM" > 0x000000004000-0x000001d00000 : "Linux" > 0x000001d00000-0x000002000000 : "RedBoot" > > So if I simply read now first 4 bytes from /dev/mtdblock2, there's no 'CRUS' > or 'SURC' boot HeaderID/signature and it means, that there's no valid > Redboot > for ep93xx. The correct value is: > > #define TS72XX_REDBOOT_PART_SIZE (SZ_2M + SZ_1M - SZ_16K) Could you please verify/ack the attached patch? -- With best wishes Dmitry -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-ts72xx-correct-partition-sizes.patch Type: text/x-patch Size: 1132 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110612/15ef0706/attachment.bin> ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-07-08 15:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1307369056-29319-1-git-send-email-dbaryshkov@gmail.com>
2011-06-06 14:04 ` [PATCH 2/3] ts72xx: use MTDPART_OFS_RETAIN for mtd partitioning Dmitry Eremin-Solenikov
2011-07-08 15:35 ` Petr Štetiar
2011-06-11 10:38 ` Petr Štetiar
2011-06-11 21:02 ` Dmitry Eremin-Solenikov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).