Commit beffc170f204277451d4b9df791c1e2b8c49e8a9

Authored by Sam Protsenko
Committed by Tom Rini
1 parent 75670c81e4

am335x_evm: Consolidate eMMC partitions with DFU info

>From DFU_ALT_INFO_EMMC (include/environment/ti/dfu.h) we can see that
rootfs will be flashed to second partition on eMMC. But at the moment we
have only one partition in $partitions environment variable. Let's add
"bootloader" partition prior to "rootfs", so that DFU works correctly.
This also fixes eMMC boot, which looks for rootfs on second partition.

"bootloader" partition start corresponds to "u-boot.img.raw" in DFU
eMMC info, which is 0x300 sector (384 KiB offset from eMMC start).

rootfs start address can be also found from DFU eMMC info.
bootloader-related area is finished at 0x1500 sector (2688 KiB offset
from eMMC start). This should be the start address for rootfs in
$partitions environment variable.

While at it, fix U-Boot environment address to be the same as for
AM57x EVM, so that it doesn't clash with other partitions.

So now eMMC layout looks like this:

    ===============================================================

    0       +------------------------+
            | MBR/GPT header         |   128           -
    128     +------------------------+
            | MLO                    |   256           -
    384     +------------------------+
            | u-boot.img             |   1792          bootloader
    2176    +------------------------+
            | //////// hole //////// |   256           -
    2432    +------------------------+
            | U-Boot environment     |   128           -
    2560    +------------------------+
            | U-Boot environment     |   128           -
            | (redundant)            |
    2688    +------------------------+
            | rootfs                 |   remaining     rootfs
    end     +------------------------+

    ===============================================================

"hole" area can be used further for storing U-Boot environment (like
it's done in AM57x EVM config file) or for increasing u-boot.img area
(in case u-boot.img size increased, e.g. if new dtbs were added).

This commit conforms with Linux partition table from f6d245b8c56c
("arm: am57xx: Fix Linux boot from eMMC") commit, making things in
uniform way.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

Showing 1 changed file with 8 additions and 5 deletions Side-by-side Diff

include/configs/am335x_evm.h
... ... @@ -17,12 +17,13 @@
17 17 #define __CONFIG_AM335X_EVM_H
18 18  
19 19 #include <configs/ti_am335x_common.h>
  20 +#include <linux/sizes.h>
20 21  
21 22 #ifndef CONFIG_SPL_BUILD
22 23 # define CONFIG_TIMESTAMP
23 24 #endif
24 25  
25   -#define CONFIG_SYS_BOOTM_LEN (16 << 20)
  26 +#define CONFIG_SYS_BOOTM_LEN SZ_16M
26 27  
27 28 #define CONFIG_MACH_TYPE MACH_TYPE_AM335XEVM
28 29  
... ... @@ -34,7 +35,7 @@
34 35 #define CONFIG_SYS_LDSCRIPT "board/ti/am335x/u-boot.lds"
35 36  
36 37 /* Always 128 KiB env size */
37   -#define CONFIG_ENV_SIZE (128 << 10)
  38 +#define CONFIG_ENV_SIZE SZ_128K
38 39  
39 40 #ifdef CONFIG_NAND
40 41 #define NANDARGS \
... ... @@ -99,7 +100,9 @@
99 100 "console=ttyO0,115200n8\0" \
100 101 "partitions=" \
101 102 "uuid_disk=${uuid_gpt_disk};" \
102   - "name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}\0" \
  103 + "name=bootloader,start=384K,size=1792K," \
  104 + "uuid=${uuid_gpt_bootloader};" \
  105 + "name=rootfs,start=2688K,size=-,uuid=${uuid_gpt_rootfs}\0" \
103 106 "optargs=\0" \
104 107 "ramroot=/dev/ram0 rw\0" \
105 108 "ramrootfstype=ext2\0" \
... ... @@ -277,8 +280,8 @@
277 280 #define CONFIG_ENV_OFFSET_REDUND (896 << 10) /* 896 KiB in */
278 281 #elif defined(CONFIG_EMMC_BOOT)
279 282 #define CONFIG_SYS_MMC_ENV_DEV 1
280   -#define CONFIG_SYS_MMC_ENV_PART 2
281   -#define CONFIG_ENV_OFFSET 0x0
  283 +#define CONFIG_SYS_MMC_ENV_PART 0
  284 +#define CONFIG_ENV_OFFSET 0x260000
282 285 #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
283 286 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
284 287 #define CONFIG_SYS_MMC_MAX_DEVICE 2