Skip to contentSkip to conversation

MX51: fix mx51evk board, add environment to MMC

PATCH Superseded Stefano Babic 2 participants 4 messages Oct 19, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 board/freescale/mx51evk/mx51evk.c |   20 ++++++++++++++++----
 include/configs/mx51evk.h         |   37 ++++++++++++++++++++++++++++++++++---
 2 files changed, 50 insertions(+), 7 deletions(-)
board/freescale/mx51evk/mx51evk.c +16 -4
index c8d7d39..d6bb71c 100644
@@ -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
include/configs/mx51evk.h +34 -3
index 6165473..13808a4 100644
@@ -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
Signature · 1 line
1.7.1
#1 lore raw

PATCH v2 1/1 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.

---

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(-)
board/freescale/mx51evk/mx51evk.c +16 -4
index c8d7d39..d6bb71c 100644
@@ -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
include/configs/mx51evk.h +23 -4
index 6165473..291404c 100644
@@ -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
Signature · 1 line
1.7.1
#2 lore raw

PATCH v2 1/1 MX51: fix mx51evk board, add environment to MMC

Dear Stefano Babic,

Quoted 21 lines · In message <[email protected]> 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.

---

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(-)
board/freescale/mx51evk/mx51evk.c +0 -0
index c8d7d39..d6bb71c 100644
@@ -52,9 +52,14 @@ u32 get_board_rev(void)
 
 int dram_init(void)

board/freescale/mx51evk/mx51evk.c u32 get_board_rev(void) · line 63

Quoted 10 lines
board/freescale/mx51evk/mx51evk.c +5 -0
 {
+#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

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
In Nature there are neither rewards nor punishments, there are conse-
quences.                                            -- R.G. Ingersoll
#3 lore raw

PATCH 1/1 MX51: fix mx51evk board, add environment to MMC

In reply to Stefano Babic

Dear Stefano Babic,

Quoted 18 lines · In message <[email protected]> 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.

---
 board/freescale/mx51evk/mx51evk.c |   20 ++++++++++++++++----
 include/configs/mx51evk.h         |   37 ++++++++++++++++++++++++++++++++++---
 2 files changed, 50 insertions(+), 7 deletions(-)
board/freescale/mx51evk/mx51evk.c +0 -0
index c8d7d39..d6bb71c 100644
@@ -52,9 +52,14 @@ u32 get_board_rev(void)
 
 int dram_init(void)
 {

board/freescale/mx51evk/mx51evk.c u32 get_board_rev(void) · line 64

Quoted 10 lines
board/freescale/mx51evk/mx51evk.c +5 -0
+#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

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It is better to marry than to burn.
                                - Bible ``I Corinthians'' ch. 7, v. 9