From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [linux-sunxi] [RFC 11/11] mtd/nand: Sunxi NAND boot partition definitions
Date: Sun, 14 Jun 2015 14:18:16 +0200 [thread overview]
Message-ID: <20150614141816.2764178e@bbrezillon> (raw)
In-Reply-To: <CAOMqctQOFmE1TB2TJaQxVe-V+=zBchOUC8iMNdweUKMc-sA1UQ@mail.gmail.com>
On Sun, 14 Jun 2015 13:56:56 +0200
Michal Suchanek <hramrach@gmail.com> wrote:
> On 14 June 2015 at 13:25, Boris Brezillon
> <boris.brezillon@free-electrons.com> wrote:
> > Hi Michal,
> >
> > On Sun, 7 Jun 2015 18:48:26 +0200
> > Michal Suchanek <hramrach@gmail.com> wrote:
> >
> >> Hello,
> >>
> >> On 5 June 2015 at 13:52, Roy Spliet <r.spliet@ultimaker.com> wrote:
> >> > Based on the default layout of the android image used at least on Olimex Lime
> >> >
> >> > Signed-off-by: Roy Spliet <r.spliet@ultimaker.com>
> >> > ---
> >> > include/configs/sunxi-common.h | 9 +++++++++
> >> > 1 file changed, 9 insertions(+)
> >> >
> >> > diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
> >> > index ec28c40..b38f2f5 100644
> >> > --- a/include/configs/sunxi-common.h
> >> > +++ b/include/configs/sunxi-common.h
> >> > @@ -404,8 +404,15 @@ extern int soft_i2c_gpio_scl;
> >> > #define BOOT_TARGET_DEVICES_USB(func)
> >> > #endif
> >> >
> >> > +#ifdef CONFIG_NAND
> >> > +#define BOOT_TARGET_DEVICES_NAND(func) func(NAND, nand , 0)
> >> > +#else
> >> > +#define BOOT_TARGET_DEVICES_NAND(func)
> >> > +#endif
> >> > +
> >> > #define BOOT_TARGET_DEVICES(func) \
> >> > BOOT_TARGET_DEVICES_MMC(func) \
> >> > + BOOT_TARGET_DEVICES_NAND(func) \
> >> > BOOT_TARGET_DEVICES_SCSI(func) \
> >> > BOOT_TARGET_DEVICES_USB(func) \
> >> > func(PXE, pxe, na) \
> >> > @@ -441,6 +448,8 @@ extern int soft_i2c_gpio_scl;
> >> > MEM_LAYOUT_ENV_SETTINGS \
> >> > "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
> >> > "console=ttyS0,115200\0" \
> >> > + "mtdids=nand0=mtd2\0" \
> >> > + "mtdparts=mtdparts=mtd2:0xffc00000 at 0x400000(nand0_main)\0" \
> >> > BOOTENV
> >>
> >> From what I heard the nand boot partition size should be specified in
> >> nand pages rather than bytes because the boot rom loads a fixed number
> >> of pages and just uses the start of each page regardless of page size.
> >
> > AFAIK, the mtdparts format only allows you to express partition offsets
> > and sizes in bytes, and even if we had to change for something else, we
> > should choose NAND blocks rather than NAND pages.
> > The reason partitions should be block aligned in because the you can't
> > erase specific pages in a block, which means that if you define 2
> > partitions sharing the same block, you won't be able to update one
> > partition without potentially corrupting the other one.
>
> However, if the number of pages the boot0 partition takes up is not
> block aligned it means we cannot use the medium for booting and can
> just use 1 big partition anyway.
>
Hm, I don't get your point.
You can have a boot0 partition taking one NAND block, and several other
partitions used for other purpose (though having a single UBI partition
is a better approach).
> >
> >>
> >> I did not find any document regarding the nand boot partition layout
> >> so I would like to see some input from somebody familiar with the
> >> driver.
> >
> > AFAIR, the mtd partition code checks for block alignment anyway, so you
> > shouldn't be allowed to create two partitions sharing the same block.
> >
> >>
> >> While it is fine for testing to hand-edit the environment the final
> >> nand support should have
> >>
> >> 1) way to express the boot partition size in nand pages
> >
> > Why should we add that ? The conversion from a number of blocks to a
> > number bytes is pretty straightforward (number_of_blocks *
> > block_size_in_bytes).
>
> Because the block size is not the same on all flash chips, obviously.
And that's why partitions are defined in the board dts, and not the SoC
dtsi...
>
> If there is only one block size that can ever be reasonably supported
> due to other constraints then it's fine to just hardcode it.
I think we already had this discussion on the #linux-sunxi channel, and
you're trying to use a generic config from things that are really board
specific.
What's the problem with having different partition layout depending on
the board ?
Note that once you have defined your boot0 + u-boot + u-boot-env + UBI
partitions, if you want to have a generic layout in the UBI device, you
can define standard names for you UBI volumes.
>
> >
> >> 2) way to make the main partition start at the end of boot partition
> >> and extend to the end of the flash
> >
> > Again, that's not a good idea, the main partition should be aligned on
> > a block (see the above explanation).
>
> Since these are block aligned anyway there should be no problem.
>
> And if you can express the size in blocks you can just make the main
> partition start the next block after boot0. What is missing is the
> ability to extend to the end of medium to be feature compatible with
> Chinese software that uses this to flash same firmware to tablets with
> different nand size. I think this is generally desirable anyway.
If they decide to use one single dtb for all their board revisions
(even when they decide to change the NAND chip type), then yes, they
should define a boot0 partition taking at least the size of the maximum
block size.
But that's only my opinion, so if MTD maintainers (both u-boot and
linux ones) accept to support MTD partition offsets and sizes defined in
number blocks, then go for it.
Best Regards,
Boris
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
next prev parent reply other threads:[~2015-06-14 12:18 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-05 11:52 [U-Boot] [RFC] Sunxi NAND support for U-Boot Roy Spliet
2015-06-05 11:52 ` [U-Boot] [RFC 01/11] mtd/nand: define struct nand_timings Roy Spliet
2015-06-05 11:52 ` [U-Boot] [RFC 02/11] mtd/nand: add ONFI timing mode to nand_timings converter Roy Spliet
2015-06-05 22:02 ` Scott Wood
2015-06-08 8:11 ` Roy Spliet
2015-06-08 8:34 ` [U-Boot] [linux-sunxi] " Michal Suchanek
2015-06-08 8:41 ` Roy Spliet
2015-06-14 11:59 ` Boris Brezillon
2015-06-08 20:24 ` [U-Boot] " Scott Wood
2015-06-10 8:33 ` Hans de Goede
2015-06-10 19:06 ` Scott Wood
2015-06-05 11:52 ` [U-Boot] [RFC 03/11] mtd/nand: support ONFI timing mode retrieval for non-ONFI Roy Spliet
2015-06-14 11:53 ` Boris Brezillon
2015-06-05 11:52 ` [U-Boot] [RFC 04/11] mtd/nand: add page status table (pst) Roy Spliet
2015-06-14 11:52 ` Boris Brezillon
2015-06-05 11:52 ` [U-Boot] [RFC 05/11] mtd/nand: take nand_ecc_ctrl initialization out of nand_scan_tail Roy Spliet
2015-06-14 11:50 ` Boris Brezillon
2015-06-05 11:52 ` [U-Boot] [RFC 06/11] mtd/nand: Add randomisation layer Roy Spliet
2015-06-14 11:47 ` Boris Brezillon
2015-06-05 11:52 ` [U-Boot] [RFC 07/11] mtd/nand Add Sunxi NAND driver Roy Spliet
2015-06-14 11:42 ` Boris Brezillon
2015-06-14 11:45 ` Boris Brezillon
2015-06-05 11:52 ` [U-Boot] [RFC 08/11] mtd/nand: Add DT definitions for Olimex Lime Roy Spliet
2015-06-14 11:39 ` Boris Brezillon
2015-06-05 11:52 ` [U-Boot] [RFC 09/11] sunxi/nand: Enable UBI and NAND commands Roy Spliet
2015-06-06 15:13 ` Hans de Goede
2015-06-06 15:36 ` Ian Campbell
2015-06-08 7:38 ` Roy Spliet
2015-06-08 9:12 ` Ian Campbell
2015-06-05 11:52 ` [U-Boot] [RFC 10/11] mtd/nand: Define bootcmd for nand Roy Spliet
2015-06-05 11:52 ` [U-Boot] [RFC 11/11] mtd/nand: Sunxi NAND boot partition definitions Roy Spliet
2015-06-07 16:48 ` [U-Boot] [linux-sunxi] " Michal Suchanek
2015-06-08 8:38 ` Roy Spliet
2015-06-08 8:54 ` Michal Suchanek
2015-06-08 9:11 ` Roy Spliet
2015-06-08 10:48 ` Yassin
2015-06-08 11:35 ` Roy Spliet
2015-06-14 11:31 ` Boris Brezillon
2015-06-15 8:00 ` Hans de Goede
2015-06-08 13:16 ` Hans de Goede
2015-06-08 13:56 ` Roy Spliet
2015-06-14 11:25 ` Boris Brezillon
2015-06-14 11:56 ` Michal Suchanek
2015-06-14 12:18 ` Boris Brezillon [this message]
2015-06-14 17:42 ` Michal Suchanek
2015-06-14 19:07 ` Boris Brezillon
2015-06-06 15:09 ` [U-Boot] [RFC] Sunxi NAND support for U-Boot Hans de Goede
2015-06-06 15:11 ` Hans de Goede
2015-06-14 11:13 ` Boris Brezillon
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=20150614141816.2764178e@bbrezillon \
--to=boris.brezillon@free-electrons.com \
--cc=u-boot@lists.denx.de \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox