From: Florian Vaussard <florian.vaussard@epfl.ch> To: Grant Likely <grant.likely@secretlab.ca> Cc: Benoit Cousson <b-cousson@ti.com>, devicetree-discuss@lists.ozlabs.org, linux-omap@vger.kernel.org, Javier Martinez Canillas <javier.martinez@collabora.co.uk>, linux-arm-kernel@lists.infradead.org, Stephen Warren <swarren@wwwdotorg.org> Subject: Re: [PATCH 1/3] ARM: dts: Add headers with constants for MTD partitions Date: Wed, 19 Jun 2013 11:19:45 +0200 [thread overview] Message-ID: <51C177B1.7010609@epfl.ch> (raw) In-Reply-To: <20130612130511.CE3D93E0A56@localhost> Hello, Thank you for the review. On 06/12/2013 03:05 PM, Grant Likely wrote: > On Tue, 11 Jun 2013 16:48:56 +0200, Florian Vaussard <florian.vaussard@epfl.ch> wrote: >> These constants can be used to easily declare MTD partitions inside >> DTS. >> >> The constants MTDPART_OFS_* are purposely not included. Indeed, >> parse_ofpart_partitions() is expecting u64, but a DT cell is u32. >> Negative constants, as defined by MTDPART_OFS_*, would be wrongly > > The DT binding uses the number of cells defined by #address-cells. It is > not fixed to a u32 or a u64 > The message was ill-formatted, sorry. As an address cell is u32, and as parse_ofpart_partitions() is storing the value inside u64 without checking for sign extension (as one assumes to have only positive offsets), passing a negative value would require 2 address cells, making it more difficult for the DT user. But as Stephen Warren noticed, it is probably desirable to specify sizes >= 4GB, thus I will think about a way to easily handle such case. Anyway, MTDPART_OFS_* would probably face the same objection raised by you for MTDPART_SIZ_FULL. >> interpreted by parse_ofpart_partitions(). Two cells should be >> used to correctly encode the negative constants, but this breaks >> current usage. > > The binding doesn't even allow for shortcuts like MTDPART_SIZ_FULL. If a > partition fills the whole device, then the reg property should include > the actual size. If the code is allowing '0' to be used to mean > MTDPART_SIZ_FULL, then that is a bug that needs to be fixed. > The root problem is that many System on Module, like the Gumstix Overo, are shipped with various NAND sizes depending on the version or even the manufacturing period. Supporting such a diversity would painfully duplicates lots of DT code and clutter the arch/arm/boot/dts/ directory with dozens of slightly- different versions. I believe that determining the NAND size is better done at probe time, and this is what is currently done in legacy board files: static struct mtd_partition overo_nand_partitions[] = { { .name = "xloader", .offset = 0, /* Offset = 0x00000 */ .size = 4 * NAND_BLOCK_SIZE, .mask_flags = MTD_WRITEABLE }, <snip...> { .name = "rootfs", .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */ .size = MTDPART_SIZ_FULL, }, }; Moreover, I do not see such strict restriction in the OF norm. If I refer to IEEE 1275-1994 page 174, for the definition of the "reg" property, it is written: "The interpretation of the size entries is dependent on the parent bus." Nevertheless, if such an approach is not acceptable, could we think about an alternative solution? Like a boolean property "mtd,append-and-fill" that would replace the "reg" property and tell the MTD core to compute the partition size at probe time, like what is currently done with board files? Best regards, Florian
WARNING: multiple messages have this Message-ID (diff)
From: florian.vaussard@epfl.ch (Florian Vaussard) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/3] ARM: dts: Add headers with constants for MTD partitions Date: Wed, 19 Jun 2013 11:19:45 +0200 [thread overview] Message-ID: <51C177B1.7010609@epfl.ch> (raw) In-Reply-To: <20130612130511.CE3D93E0A56@localhost> Hello, Thank you for the review. On 06/12/2013 03:05 PM, Grant Likely wrote: > On Tue, 11 Jun 2013 16:48:56 +0200, Florian Vaussard <florian.vaussard@epfl.ch> wrote: >> These constants can be used to easily declare MTD partitions inside >> DTS. >> >> The constants MTDPART_OFS_* are purposely not included. Indeed, >> parse_ofpart_partitions() is expecting u64, but a DT cell is u32. >> Negative constants, as defined by MTDPART_OFS_*, would be wrongly > > The DT binding uses the number of cells defined by #address-cells. It is > not fixed to a u32 or a u64 > The message was ill-formatted, sorry. As an address cell is u32, and as parse_ofpart_partitions() is storing the value inside u64 without checking for sign extension (as one assumes to have only positive offsets), passing a negative value would require 2 address cells, making it more difficult for the DT user. But as Stephen Warren noticed, it is probably desirable to specify sizes >= 4GB, thus I will think about a way to easily handle such case. Anyway, MTDPART_OFS_* would probably face the same objection raised by you for MTDPART_SIZ_FULL. >> interpreted by parse_ofpart_partitions(). Two cells should be >> used to correctly encode the negative constants, but this breaks >> current usage. > > The binding doesn't even allow for shortcuts like MTDPART_SIZ_FULL. If a > partition fills the whole device, then the reg property should include > the actual size. If the code is allowing '0' to be used to mean > MTDPART_SIZ_FULL, then that is a bug that needs to be fixed. > The root problem is that many System on Module, like the Gumstix Overo, are shipped with various NAND sizes depending on the version or even the manufacturing period. Supporting such a diversity would painfully duplicates lots of DT code and clutter the arch/arm/boot/dts/ directory with dozens of slightly- different versions. I believe that determining the NAND size is better done at probe time, and this is what is currently done in legacy board files: static struct mtd_partition overo_nand_partitions[] = { { .name = "xloader", .offset = 0, /* Offset = 0x00000 */ .size = 4 * NAND_BLOCK_SIZE, .mask_flags = MTD_WRITEABLE }, <snip...> { .name = "rootfs", .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */ .size = MTDPART_SIZ_FULL, }, }; Moreover, I do not see such strict restriction in the OF norm. If I refer to IEEE 1275-1994 page 174, for the definition of the "reg" property, it is written: "The interpretation of the size entries is dependent on the parent bus." Nevertheless, if such an approach is not acceptable, could we think about an alternative solution? Like a boolean property "mtd,append-and-fill" that would replace the "reg" property and tell the MTD core to compute the partition size at probe time, like what is currently done with board files? Best regards, Florian
next prev parent reply other threads:[~2013-06-19 9:19 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-06-11 14:48 [PATCH 0/3] ARM: dts: OMAP3: Use constants with MTD devices Florian Vaussard 2013-06-11 14:48 ` Florian Vaussard 2013-06-11 14:48 ` [PATCH 1/3] ARM: dts: Add headers with constants for MTD partitions Florian Vaussard 2013-06-11 14:48 ` Florian Vaussard 2013-06-11 16:24 ` Stephen Warren 2013-06-11 16:24 ` Stephen Warren 2013-06-11 17:28 ` Florian Vaussard 2013-06-11 17:28 ` Florian Vaussard 2013-06-12 13:05 ` Grant Likely 2013-06-12 13:05 ` Grant Likely 2013-06-19 9:19 ` Florian Vaussard [this message] 2013-06-19 9:19 ` Florian Vaussard 2013-06-11 14:48 ` [PATCH 2/3] ARM: dts: Add omap3-overo NAND flash memory binding Florian Vaussard 2013-06-11 14:48 ` Florian Vaussard 2013-06-11 14:48 ` [PATCH 3/3] ARM: dts: OMAP3: Use MTD constants for OMAP3 boards Florian Vaussard 2013-06-11 14:48 ` Florian Vaussard 2013-06-11 15:29 ` Javier Martinez Canillas 2013-06-11 15:29 ` Javier Martinez Canillas 2013-06-11 17:30 ` Florian Vaussard 2013-06-11 17:30 ` Florian Vaussard 2013-06-12 13:11 ` Grant Likely 2013-06-12 13:11 ` Grant Likely 2013-06-11 16:27 ` Stephen Warren 2013-06-11 16:27 ` Stephen Warren 2013-06-11 17:31 ` Florian Vaussard 2013-06-11 17:31 ` Florian Vaussard
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=51C177B1.7010609@epfl.ch \ --to=florian.vaussard@epfl.ch \ --cc=b-cousson@ti.com \ --cc=devicetree-discuss@lists.ozlabs.org \ --cc=grant.likely@secretlab.ca \ --cc=javier.martinez@collabora.co.uk \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-omap@vger.kernel.org \ --cc=swarren@wwwdotorg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.