[U-Boot] [PATCH] MX51: fix mx51evk board, add environment to MMC

The patch fixes the compilation of the mx51evk board with the actual u-boot release and stores the environment into the MMC card.
Signed-off-by: Stefano Babic sbabic@denx.de --- board/freescale/mx51evk/mx51evk.c | 20 ++++++++++++++++---- include/configs/mx51evk.h | 37 ++++++++++++++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 7 deletions(-)
diff --git a/board/freescale/mx51evk/mx51evk.c b/board/freescale/mx51evk/mx51evk.c index c8d7d39..d6bb71c 100644 --- a/board/freescale/mx51evk/mx51evk.c +++ b/board/freescale/mx51evk/mx51evk.c @@ -52,9 +52,14 @@ u32 get_board_rev(void)
int dram_init(void) { +#ifdef CONFIG_SYS_ARM_WITHOUT_RELOC gd->bd->bi_dram[0].start = PHYS_SDRAM_1; gd->bd->bi_dram[0].size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE); +#else + gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, + PHYS_SDRAM_1_SIZE); +#endif return 0; }
@@ -399,16 +404,25 @@ int board_mmc_init(bd_t *bis) } #endif
+int board_early_init_f(void) +{ + setup_iomux_uart(); + setup_iomux_fec(); + + return 0; +} + int board_init(void) { system_rev = get_cpu_rev();
+#ifdef CONFIG_SYS_ARM_WITHOUT_RELOC + board_early_init_f(); +#endif gd->bd->bi_arch_number = MACH_TYPE_MX51_BABBAGE; /* address of boot parameters */ gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
- setup_iomux_uart(); - setup_iomux_fec();
return 0; } @@ -416,10 +430,8 @@ int board_init(void) #ifdef BOARD_LATE_INIT int board_late_init(void) { -#ifdef CONFIG_MXC_SPI setup_iomux_spi(); power_init(); -#endif return 0; } #endif diff --git a/include/configs/mx51evk.h b/include/configs/mx51evk.h index 6165473..13808a4 100644 --- a/include/configs/mx51evk.h +++ b/include/configs/mx51evk.h @@ -28,7 +28,6 @@ /* High Level Configuration Options */
#define CONFIG_MX51 /* in a mx51 */ -#define CONFIG_SKIP_RELOCATE_UBOOT
#define CONFIG_SYS_MX5_HCLK 24000000 #define CONFIG_SYS_MX5_CLK32 32768 @@ -55,6 +54,7 @@ #define CONFIG_SYS_GBL_DATA_SIZE 128
#define BOARD_LATE_INIT +#define CONFIG_BOARD_EARLY_INIT_F
/* * Hardware drivers @@ -75,6 +75,14 @@ #define CONFIG_FSL_PMIC_CLK 2500000 #define CONFIG_FSL_PMIC_MODE (SPI_MODE_0 | SPI_CS_HIGH)
+#define CONFIG_CMD_SF +#define CONFIG_SPI_FLASH +#define CONFIG_SPI_FLASH_ATMEL +#define CONFIG_SPI_FLASH_CS 1 +#define CONFIG_ENV_SPI_CS 1 +#define CONFIG_ENV_SPI_MAX_HZ 2500000 +#define CONFIG_ENV_SPI_MODE SPI_MODE_0 + /* * MMC Configs * */ @@ -178,13 +186,36 @@ #define CONFIG_SYS_DDR_CLKSEL 0 #define CONFIG_SYS_CLKTL_CBCDR 0x59E35100
+#define CONFIG_SYS_SDRAM_BASE 0x90000000 +#define CONFIG_SYS_INIT_RAM_ADDR 0x1FFE8000 + +#ifndef CONFIG_SYS_ARM_WITHOUT_RELOC +#define CONFIG_SYS_INIT_RAM_END (64 * 1024) +#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_END - \ + CONFIG_SYS_GBL_DATA_SIZE) +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_ADDR + \ + CONFIG_SYS_GBL_DATA_OFFSET) +#undef CONFIG_SKIP_RELOCATE_UBOOT +#else +#define CONFIG_SKIP_RELOCATE_UBOOT +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_ADDR + 0x2000) +#endif + + /*----------------------------------------------------------------------- * FLASH and environment organization */ #define CONFIG_SYS_NO_FLASH
-#define CONFIG_ENV_SECT_SIZE (128 * 1024) -#define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE +#define CONFIG_ENV_OFFSET (6 * 64 * 1024) +#define CONFIG_ENV_SECT_SIZE (1 * 64 * 1024) +#define CONFIG_ENV_SIZE (4 * 1024) + +#if 0 #define CONFIG_ENV_IS_NOWHERE +#else +#define CONFIG_ENV_IS_IN_MMC +#define CONFIG_SYS_MMC_ENV_DEV 0 +#endif
#endif

The patch fixes the compilation of the mx51evk board with the actual u-boot release and stores the environment into the MMC card.
Signed-off-by: Stefano Babic sbabic@denx.de ---
Changes since V1: - Dead code not removed
board/freescale/mx51evk/mx51evk.c | 20 ++++++++++++++++---- include/configs/mx51evk.h | 27 +++++++++++++++++++++++---- 2 files changed, 39 insertions(+), 8 deletions(-)
diff --git a/board/freescale/mx51evk/mx51evk.c b/board/freescale/mx51evk/mx51evk.c index c8d7d39..d6bb71c 100644 --- a/board/freescale/mx51evk/mx51evk.c +++ b/board/freescale/mx51evk/mx51evk.c @@ -52,9 +52,14 @@ u32 get_board_rev(void)
int dram_init(void) { +#ifdef CONFIG_SYS_ARM_WITHOUT_RELOC gd->bd->bi_dram[0].start = PHYS_SDRAM_1; gd->bd->bi_dram[0].size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE); +#else + gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, + PHYS_SDRAM_1_SIZE); +#endif return 0; }
@@ -399,16 +404,25 @@ int board_mmc_init(bd_t *bis) } #endif
+int board_early_init_f(void) +{ + setup_iomux_uart(); + setup_iomux_fec(); + + return 0; +} + int board_init(void) { system_rev = get_cpu_rev();
+#ifdef CONFIG_SYS_ARM_WITHOUT_RELOC + board_early_init_f(); +#endif gd->bd->bi_arch_number = MACH_TYPE_MX51_BABBAGE; /* address of boot parameters */ gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
- setup_iomux_uart(); - setup_iomux_fec();
return 0; } @@ -416,10 +430,8 @@ int board_init(void) #ifdef BOARD_LATE_INIT int board_late_init(void) { -#ifdef CONFIG_MXC_SPI setup_iomux_spi(); power_init(); -#endif return 0; } #endif diff --git a/include/configs/mx51evk.h b/include/configs/mx51evk.h index 6165473..291404c 100644 --- a/include/configs/mx51evk.h +++ b/include/configs/mx51evk.h @@ -28,7 +28,6 @@ /* High Level Configuration Options */
#define CONFIG_MX51 /* in a mx51 */ -#define CONFIG_SKIP_RELOCATE_UBOOT
#define CONFIG_SYS_MX5_HCLK 24000000 #define CONFIG_SYS_MX5_CLK32 32768 @@ -55,6 +54,7 @@ #define CONFIG_SYS_GBL_DATA_SIZE 128
#define BOARD_LATE_INIT +#define CONFIG_BOARD_EARLY_INIT_F
/* * Hardware drivers @@ -178,13 +178,32 @@ #define CONFIG_SYS_DDR_CLKSEL 0 #define CONFIG_SYS_CLKTL_CBCDR 0x59E35100
+#define CONFIG_SYS_SDRAM_BASE 0x90000000 +#define CONFIG_SYS_INIT_RAM_ADDR 0x1FFE8000 + +#ifndef CONFIG_SYS_ARM_WITHOUT_RELOC +#define CONFIG_SYS_INIT_RAM_END (64 * 1024) +#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_END - \ + CONFIG_SYS_GBL_DATA_SIZE) +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_ADDR + \ + CONFIG_SYS_GBL_DATA_OFFSET) +#undef CONFIG_SKIP_RELOCATE_UBOOT +#else +#define CONFIG_SKIP_RELOCATE_UBOOT +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_ADDR + 0x2000) +#endif + + /*----------------------------------------------------------------------- * FLASH and environment organization */ #define CONFIG_SYS_NO_FLASH
-#define CONFIG_ENV_SECT_SIZE (128 * 1024) -#define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE -#define CONFIG_ENV_IS_NOWHERE +#define CONFIG_ENV_OFFSET (6 * 64 * 1024) +#define CONFIG_ENV_SECT_SIZE (1 * 64 * 1024) +#define CONFIG_ENV_SIZE (4 * 1024) + +#define CONFIG_ENV_IS_IN_MMC +#define CONFIG_SYS_MMC_ENV_DEV 0
#endif

Dear Stefano Babic,
In message 1287491115-6312-1-git-send-email-sbabic@denx.de you wrote:
The patch fixes the compilation of the mx51evk board with the actual u-boot release and stores the environment into the MMC card.
Signed-off-by: Stefano Babic sbabic@denx.de
Changes since V1:
- Dead code not removed
board/freescale/mx51evk/mx51evk.c | 20 ++++++++++++++++---- include/configs/mx51evk.h | 27 +++++++++++++++++++++++---- 2 files changed, 39 insertions(+), 8 deletions(-)
diff --git a/board/freescale/mx51evk/mx51evk.c b/board/freescale/mx51evk/mx51evk.c index c8d7d39..d6bb71c 100644 --- a/board/freescale/mx51evk/mx51evk.c +++ b/board/freescale/mx51evk/mx51evk.c @@ -52,9 +52,14 @@ u32 get_board_rev(void)
int dram_init(void) { +#ifdef CONFIG_SYS_ARM_WITHOUT_RELOC gd->bd->bi_dram[0].start = PHYS_SDRAM_1; gd->bd->bi_dram[0].size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE); +#else
- gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1,
PHYS_SDRAM_1_SIZE);
+#endif return 0;
Please get rid of the references to CONFIG_SYS_ARM_WITHOUT_RELOC
Best regards,
Wolfgang Denk

Dear Stefano Babic,
In message 1287490415-24200-1-git-send-email-sbabic@denx.de you wrote:
The patch fixes the compilation of the mx51evk board with the actual u-boot release and stores the environment into the MMC card.
Signed-off-by: Stefano Babic sbabic@denx.de
board/freescale/mx51evk/mx51evk.c | 20 ++++++++++++++++---- include/configs/mx51evk.h | 37 ++++++++++++++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 7 deletions(-)
diff --git a/board/freescale/mx51evk/mx51evk.c b/board/freescale/mx51evk/mx51evk.c index c8d7d39..d6bb71c 100644 --- a/board/freescale/mx51evk/mx51evk.c +++ b/board/freescale/mx51evk/mx51evk.c @@ -52,9 +52,14 @@ u32 get_board_rev(void)
int dram_init(void) { +#ifdef CONFIG_SYS_ARM_WITHOUT_RELOC gd->bd->bi_dram[0].start = PHYS_SDRAM_1; gd->bd->bi_dram[0].size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE); +#else
- gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1,
PHYS_SDRAM_1_SIZE);
+#endif return 0; }
We should not support the CONFIG_SYS_ARM_WITHOUT_RELOC compatibility mode any longer than absolutely necessary. If the other code works, then please remove the "#ifdef CONFIG_SYS_ARM_WITHOUT_RELOC" parts.
Best regards,
Wolfgang Denk
participants (2)
-
Stefano Babic
-
Wolfgang Denk