[U-Boot] saveenv not working (u-boot-2017.05-rc3)

Teoh Choon Zone choon-zone.teoh at vie.com.my
Wed May 3 01:25:41 UTC 2017


I'm using Cypress S25FL512S QSPI, but "saveenv" is not working in
u-boot-2017.05-rc3, the changes did not get stored even though the
following message is printed:

Saving Environment to SPI Flash...
SF: Detected s25fl512s_256k with page size 512 Bytes, erase size 256 KiB,
total 64 MiB
Erasing SPI flash...Writing to SPI flash...done





Below is my DTS content:

&qspi {
status = "okay";
u-boot,dm-pre-reloc;

flash0: s25fl512s at 0 {
u-boot,dm-pre-reloc;
#address-cells = <1>;
#size-cells = <1>;
compatible = "spansion,s25fl512s", "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <66000000>;
spi-tx-bus-width = <4>;
spi-rx-bus-width = <4>;
spi-cpol;
spi-cpha;
m25p,fast-read;

cdns,page-size = <512>;
cdns,block-size = <262144>;
cdns,tshsl-ns = <50>;
cdns,tsd2d-ns = <50>;
cdns,tchsh-ns = <3>;
cdns,tslch-ns = <3>;

partition at qspi-boot {
/* 1536kB for u-boot */
label = "Flash 0 u-boot";
reg = <0x0 0x180000>;
};
partition at qspi-env {
/* 256kB for u-boot env */
label = "Flash 0 u-boot env";
reg = <0x180000 0x40000>;
};
partition at qspi-kernel {
/* 8MB for kernel */
label = "Flash 0 kernel";
reg = <0x1C0000 0x800000>;
};
partition at qspi-dtb {
/* 256kB for dtb */
label = "Flash 0 dtb";
reg = <0x9C0000 0x40000>;
};
partition at qspi-rootfs {
/* 54MB for UBIFS */
label = "Flash 0 UBIFS Filesystem";
reg = <0xA00000 0x3600000>;
};
};
};







Below is the snippet of my board include header:

#define CONFIG_ENV_IS_IN_SPI_FLASH

/*
 * U-Boot environment
 */
#define CONFIG_ENV_SIZE (2 * 1024)

/* Environment for SDMMC boot */
#if defined(CONFIG_ENV_IS_IN_MMC) && !defined(CONFIG_ENV_OFFSET)
#define CONFIG_SYS_MMC_ENV_DEV 0 /* device 0 */
#define CONFIG_ENV_OFFSET 512 /* just after the MBR */
#endif

/* Environment for QSPI boot */
#define CONFIG_ENV_OFFSET 0x00180000
#define CONFIG_ENV_SECT_SIZE (256 * 1024)

/*
 * mtd partitioning for serial NOR flash
 *
 * device nor0 <ff705000.spi.0>, # parts = 5
 * #: name                size            offset          mask_flags
 * 0: u-boot              0x00180000      0x00000000      0
 * 1: env                 0x00040000      0x00180000      0
 * 2: kernel              0x00800000      0x001c0000      0
 * 3: dtb                 0x00040000      0x009c0000      0
 * 4: rootfs              0x03600000      0x00a00000      0
 *
 */
#if defined(CONFIG_CMD_SF) && !defined(MTDPARTS_DEFAULT)
#define MTDPARTS_DEFAULT "mtdparts=ff705000.spi.0:"\
"1536k(u-boot)," \
"256k(env)," \
"8m(kernel)," \
"256k(dtb)," \
"- at 54m(rootfs)\0"
#endif


More information about the U-Boot mailing list