[U-Boot] [PATCHv1 02/22] arm: socfpga: enable saveenv to mmc partition

Marek Vasut
2015-01-15T22:08:35Z

On Thursday, January 15, 2015 at 11:00:00 PM, Pavel Machek wrote:
> Hi!

Hi!

> > From: Dinh Nguyen <dinguyen@opensource.altera.com>
> >
> > Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
> > Cc: Marek Vasut <marex@denx.de>
> > Cc: Tom Rini <trini@ti.com>
> > Cc: Pavel Machek <pavel@denx.de>
> > ---
> >
> > include/configs/socfpga_common.h | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/configs/socfpga_common.h
> > b/include/configs/socfpga_common.h index 6b1f967..673377b 100644
> > --- a/include/configs/socfpga_common.h
> > +++ b/include/configs/socfpga_common.h
> > @@ -281,9 +281,12 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
> >
> > #define CONFIG_SYS_CONSOLE_IS_IN_ENV
> > #define CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
> > #define CONFIG_SYS_CONSOLE_ENV_OVERWRITE
> >
> > -#define CONFIG_ENV_IS_NOWHERE
> >
> > #define CONFIG_ENV_SIZE 4096
> >
> > +#define CONFIG_ENV_IS_IN_MMC
> > +#define CONFIG_SYS_MMC_ENV_DEV 0/* device 0 */
> > +#define CONFIG_ENV_OFFSET 512/* just after the MBR */
> > +
>
> Would it make sense to make environment bigger (64K?) at this point,
> and enabling the redundant environment option, so that one bad block
> does not bring the whole device down?

Do you think you'll ever have more than a 4KiB of text data in the env ?
I can see a reason for some 16 KiB environment, but that's the ceiling.

Usually, the env only has to be a few KiB and it's size has to be multiple
of the underlying device's erase block. But in case of SD card, there are no
explicit erase blocks exported to the user, all is hidden by the controller
in the SD card and gives an illusion of a device which has 512b blocks and
the user doesn't care for bad block management. Since the controller in the
card does the bad block management and wear leveling/relocation of blocks,
it also means that in case the controller did fail to provide the block which
contains env, the whole card would already be in a very bad state.

Best regards,
Marek Vasut