Skip to contentSkip to conversation

Add SMDK5250 board support

PATCH Superseded Chander Kashyap 2 participants 7 messages Jan 25, 2012 – Feb 2, 2012

Subsystems (3)

v6 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v6 cover Add SMDK5250 board support

This patchset add support for Samsung's SMDK5250 board based on EXYNOS5250 based SoC. It also adds support for MMC SPL booting.

The porting is done by Samsung engineers at HQ in System LSI Team. I am contributing in upstreaming the code for the board.

Based upon discussions following patches are dropped in this version:
Exynos: Add CONFIG_EXYNOS4 Macro to EXYNOS4 based boards
Exynos: Clock.c: Replace exynos4 prefix with exynos

SMDK5250: enable device tree support is squashed with
EXYNOS: Add SMDK5250 board support

Chander Kashyap (4):
Exynos: Clock.c: Use CONFIG_SYS_CLK_FREQ macro
ARM: EXYNOS: Add support for Exynos5 based SoCs
EXYNOS: Add SMDK5250 board support
EXYNOS: SMDK5250: Add MMC SPL support

 MAINTAINERS                                   |    1 +
 arch/arm/cpu/armv7/exynos/clock.c             |  214 ++++++++++-
 arch/arm/include/asm/arch-exynos/clock.h      |  326 ++++++++++++++++
 arch/arm/include/asm/arch-exynos/cpu.h        |   35 ++-
 arch/arm/include/asm/arch-exynos/dmc.h        |  146 +++++++
 arch/arm/include/asm/arch-exynos/gpio.h       |   99 +++++-
 arch/arm/include/asm/arch-exynos/tzpc.h       |   52 +++
 board/samsung/smdk5250/Makefile               |   67 ++++
 board/samsung/smdk5250/clock_init.c           |  202 ++++++++++
 board/samsung/smdk5250/dmc_init.c             |  508 +++++++++++++++++++++++++
 board/samsung/smdk5250/lowlevel_init.S        |   96 +++++
 board/samsung/smdk5250/mmc_boot.c             |   58 +++
 board/samsung/smdk5250/setup.h                |  353 +++++++++++++++++
 board/samsung/smdk5250/smdk5250.c             |  152 ++++++++
 board/samsung/smdk5250/tools/mkexynos_image.c |  117 ++++++
 board/samsung/smdk5250/tzpc_init.c            |   48 +++
 boards.cfg                                    |    1 +
 include/configs/s5pc210_universal.h           |    1 +
 include/configs/smdk5250.h                    |  202 ++++++++++
 include/configs/trats.h                       |    1 +
 20 files changed, 2662 insertions(+), 17 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-exynos/dmc.h
 create mode 100644 arch/arm/include/asm/arch-exynos/tzpc.h
 create mode 100644 board/samsung/smdk5250/Makefile
 create mode 100644 board/samsung/smdk5250/clock_init.c
 create mode 100644 board/samsung/smdk5250/dmc_init.c
 create mode 100644 board/samsung/smdk5250/lowlevel_init.S
 create mode 100644 board/samsung/smdk5250/mmc_boot.c
 create mode 100644 board/samsung/smdk5250/setup.h
 create mode 100644 board/samsung/smdk5250/smdk5250.c
 create mode 100644 board/samsung/smdk5250/tools/mkexynos_image.c
 create mode 100644 board/samsung/smdk5250/tzpc_init.c
 create mode 100644 include/configs/smdk5250.h
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH v6 1/4 Exynos: Clock.c: Use CONFIG_SYS_CLK_FREQ macro

CONFIG_SYS_CLK_FREQ_C210 macro giving notion of S5PC2XX (Exynos4) architecture. Replace CONFIG_SYS_CLK_FREQ_C210 with CONFIG_SYS_CLK_FREQ to make it generic for exynos architecture.

---
Changes for v2:
- None
Changes for v3:
- None
Changes for V4:
- Added CONFIG_SYS_CLK_FREQ to trats.h
Changes for v5:
- None
Changes for v6:
- None

 arch/arm/cpu/armv7/exynos/clock.c   |    6 +-----
 include/configs/s5pc210_universal.h |    1 +
 include/configs/trats.h             |    1 +
 3 files changed, 3 insertions(+), 5 deletions(-)
arch/arm/cpu/armv7/exynos/clock.c +1 -5
index 0c199cd..4d92c53 100644
@@ -26,10 +26,6 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/clk.h>
 
-#ifndef CONFIG_SYS_CLK_FREQ_C210
-#define CONFIG_SYS_CLK_FREQ_C210	24000000
-#endif
-
 /* exynos4: return pll clock frequency */
 static unsigned long exynos4_get_pll_clk(int pllreg)
 {
@@ -76,7 +72,7 @@ static unsigned long exynos4_get_pll_clk(int pllreg)
 	/* SDIV [2:0] */
 	s = r & 0x7;
 
-	freq = CONFIG_SYS_CLK_FREQ_C210;
+	freq = CONFIG_SYS_CLK_FREQ;
 
 	if (pllreg == EPLL) {
 		k = k & 0xffff;
include/configs/s5pc210_universal.h +1 -0
index be000cb..8286680 100644
@@ -49,6 +49,7 @@
 
 /* input clock of PLL: Universal has 24MHz input clock at EXYNOS4210 */
 #define CONFIG_SYS_CLK_FREQ_C210	24000000
+#define CONFIG_SYS_CLK_FREQ		CONFIG_SYS_CLK_FREQ_C210
 
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_CMDLINE_TAG
include/configs/trats.h +1 -0
index acb3241..10f11d9 100644
@@ -49,6 +49,7 @@
 
 /* input clock of PLL: TRATS has 24MHz input clock at EXYNOS4210 */
 #define CONFIG_SYS_CLK_FREQ_C210	24000000
+#define CONFIG_SYS_CLK_FREQ		CONFIG_SYS_CLK_FREQ_C210
 
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_CMDLINE_TAG
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH v6 2/4 ARM: EXYNOS: Add support for Exynos5 based SoCs

In reply to Chander Kashyap

Samsung's ARM Cortex-A15 based SoCs are known as Exynos5 series of SoCs. This patch adds the support for Exynos5.

---
Changes for v2:
- This patch was part of "EXYNOS: Add SMDK5250 board support"
- Now it is seprated as SoC support.
Changes for v3:
- Populated complete exynos5 gpio structures
Changes for v4:
- Added dmc.h and tzpc.h header files
- Renamed EXYNOS5_PHY*_CTRL_BASE to EXYNOS5_DMC_PHY*_BASE
Changes for v5:
- None
Changes for v5:
- None

 arch/arm/cpu/armv7/exynos/clock.c        |  208 +++++++++++++++++++-
 arch/arm/include/asm/arch-exynos/clock.h |  326 ++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-exynos/cpu.h   |   35 +++-
 arch/arm/include/asm/arch-exynos/dmc.h   |  146 +++++++++++++
 arch/arm/include/asm/arch-exynos/gpio.h  |   99 +++++++++-
 arch/arm/include/asm/arch-exynos/tzpc.h  |   52 +++++
 6 files changed, 854 insertions(+), 12 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-exynos/dmc.h
 create mode 100644 arch/arm/include/asm/arch-exynos/tzpc.h
arch/arm/cpu/armv7/exynos/clock.c +203 -5
index 4d92c53..2f7048b 100644
@@ -92,6 +92,72 @@ static unsigned long exynos4_get_pll_clk(int pllreg)
 	return fout;
 }
 
+/* exynos5: return pll clock frequency */
+static unsigned long exynos5_get_pll_clk(int pllreg)
+{
+	struct exynos5_clock *clk =
+		(struct exynos5_clock *)samsung_get_base_clock();
+	unsigned long r, m, p, s, k = 0, mask, fout;
+	unsigned int freq;
+
+	switch (pllreg) {
+	case APLL:
+		r = readl(&clk->apll_con0);
+		break;
+	case MPLL:
+		r = readl(&clk->mpll_con0);
+		break;
+	case EPLL:
+		r = readl(&clk->epll_con0);
+		k = readl(&clk->epll_con1);
+		break;
+	case VPLL:
+		r = readl(&clk->vpll_con0);
+		k = readl(&clk->vpll_con1);
+		break;
+	default:
+		printf("Unsupported PLL (%d)\n", pllreg);
+		return 0;
+	}
+
+	/*
+	 * APLL_CON: MIDV [25:16]
+	 * MPLL_CON: MIDV [25:16]
+	 * EPLL_CON: MIDV [24:16]
+	 * VPLL_CON: MIDV [24:16]
+	 */
+	if (pllreg == APLL || pllreg == MPLL)
+		mask = 0x3ff;
+	else
+		mask = 0x1ff;
+
+	m = (r >> 16) & mask;
+
+	/* PDIV [13:8] */
+	p = (r >> 8) & 0x3f;
+	/* SDIV [2:0] */
+	s = r & 0x7;
+
+	freq = CONFIG_SYS_CLK_FREQ;
+
+	if (pllreg == EPLL) {
+		k = k & 0xffff;
+		/* FOUT = (MDIV + K / 65536) * FIN / (PDIV * 2^SDIV) */
+		fout = (m + k / 65536) * (freq / (p * (1 << s)));
+	} else if (pllreg == VPLL) {
+		k = k & 0xfff;
+		/* FOUT = (MDIV + K / 1024) * FIN / (PDIV * 2^SDIV) */
+		fout = (m + k / 1024) * (freq / (p * (1 << s)));
+	} else {
+		if (s < 1)
+			s = 1;
+		/* FOUT = MDIV * FIN / (PDIV * 2^(SDIV - 1)) */
+		fout = m * (freq / (p * (1 << (s - 1))));
+	}
+
+	return fout;
+}
+
 /* exynos4: return ARM clock frequency */
 static unsigned long exynos4_get_arm_clk(void)
 {
@@ -114,6 +180,28 @@ static unsigned long exynos4_get_arm_clk(void)
 	return armclk;
 }
 
+/* exynos5: return ARM clock frequency */
+static unsigned long exynos5_get_arm_clk(void)
+{
+	struct exynos5_clock *clk =
+		(struct exynos5_clock *)samsung_get_base_clock();
+	unsigned long div;
+	unsigned long armclk;
+	unsigned int arm_ratio;
+	unsigned int arm2_ratio;
+
+	div = readl(&clk->div_cpu0);
+
+	/* ARM_RATIO: [2:0], ARM2_RATIO: [30:28] */
+	arm_ratio = (div >> 0) & 0x7;
+	arm2_ratio = (div >> 28) & 0x7;
+
+	armclk = get_pll_clk(APLL) / (arm_ratio + 1);
+	armclk /= (arm2_ratio + 1);
+
+	return armclk;
+}
+
 /* exynos4: return pwm clock frequency */
 static unsigned long exynos4_get_pwm_clk(void)
 {
@@ -157,6 +245,27 @@ static unsigned long exynos4_get_pwm_clk(void)
 	return pclk;
 }
 
+/* exynos5: return pwm clock frequency */
+static unsigned long exynos5_get_pwm_clk(void)
+{
+	struct exynos5_clock *clk =
+		(struct exynos5_clock *)samsung_get_base_clock();
+	unsigned long pclk, sclk;
+	unsigned int ratio;
+
+	/*
+	 * CLK_DIV_PERIC3
+	 * PWM_RATIO [3:0]
+	 */
+	ratio = readl(&clk->div_peric3);
+	ratio = ratio & 0xf;
+	sclk = get_pll_clk(MPLL);
+
+	pclk = sclk / (ratio + 1);
+
+	return pclk;
+}
+
 /* exynos4: return uart clock frequency */
 static unsigned long exynos4_get_uart_clk(int dev_index)
 {
@@ -204,6 +313,53 @@ static unsigned long exynos4_get_uart_clk(int dev_index)
 	return uclk;
 }
 
+/* exynos5: return uart clock frequency */
+static unsigned long exynos5_get_uart_clk(int dev_index)
+{
+	struct exynos5_clock *clk =
+		(struct exynos5_clock *)samsung_get_base_clock();
+	unsigned long uclk, sclk;
+	unsigned int sel;
+	unsigned int ratio;
+
+	/*
+	 * CLK_SRC_PERIC0
+	 * UART0_SEL [3:0]
+	 * UART1_SEL [7:4]
+	 * UART2_SEL [8:11]
+	 * UART3_SEL [12:15]
+	 * UART4_SEL [16:19]
+	 * UART5_SEL [23:20]
+	 */
+	sel = readl(&clk->src_peric0);
+	sel = (sel >> (dev_index << 2)) & 0xf;
+
+	if (sel == 0x6)
+		sclk = get_pll_clk(MPLL);
+	else if (sel == 0x7)
+		sclk = get_pll_clk(EPLL);
+	else if (sel == 0x8)
+		sclk = get_pll_clk(VPLL);
+	else
+		return 0;
+
+	/*
+	 * CLK_DIV_PERIC0
+	 * UART0_RATIO [3:0]
+	 * UART1_RATIO [7:4]
+	 * UART2_RATIO [8:11]
+	 * UART3_RATIO [12:15]
+	 * UART4_RATIO [16:19]
+	 * UART5_RATIO [23:20]
+	 */
+	ratio = readl(&clk->div_peric0);
+	ratio = (ratio >> (dev_index << 2)) & 0xf;
+
+	uclk = sclk / (ratio + 1);
+
+	return uclk;
+}
+
 /* exynos4: set the mmc clock */
 static void exynos4_set_mmc_clk(int dev_index, unsigned int div)
 {
@@ -231,27 +387,69 @@ static void exynos4_set_mmc_clk(int dev_index, unsigned int div)
 	writel(val, addr);
 }
 
+/* exynos5: set the mmc clock */
+static void exynos5_set_mmc_clk(int dev_index, unsigned int div)
+{
+	struct exynos5_clock *clk =
+		(struct exynos5_clock *)samsung_get_base_clock();
+	unsigned int addr;
+	unsigned int val;
+
+	/*
+	 * CLK_DIV_FSYS1
+	 * MMC0_PRE_RATIO [15:8], MMC1_PRE_RATIO [31:24]
+	 * CLK_DIV_FSYS2
+	 * MMC2_PRE_RATIO [15:8], MMC3_PRE_RATIO [31:24]
+	 */
+	if (dev_index < 2) {
+		addr = (unsigned int)&clk->div_fsys1;
+	} else {
+		addr = (unsigned int)&clk->div_fsys2;
+		dev_index -= 2;
+	}
+
+	val = readl(addr);
+	val &= ~(0xff << ((dev_index << 4) + 8));
+	val |= (div & 0xff) << ((dev_index << 4) + 8);
+	writel(val, addr);
+}
+
 unsigned long get_pll_clk(int pllreg)
 {
-	return exynos4_get_pll_clk(pllreg);
+	if (cpu_is_exynos5())
+		return exynos5_get_pll_clk(pllreg);
+	else
+		return exynos4_get_pll_clk(pllreg);
 }
 
 unsigned long get_arm_clk(void)
 {
-	return exynos4_get_arm_clk();
+	if (cpu_is_exynos5())
+		return exynos5_get_arm_clk();
+	else
+		return exynos4_get_arm_clk();
 }
 
 unsigned long get_pwm_clk(void)
 {
-	return exynos4_get_pwm_clk();
+	if (cpu_is_exynos5())
+		return exynos5_get_pwm_clk();
+	else
+		return exynos4_get_pwm_clk();
 }
 
 unsigned long get_uart_clk(int dev_index)
 {
-	return exynos4_get_uart_clk(dev_index);
+	if (cpu_is_exynos5())
+		return exynos5_get_uart_clk(dev_index);
+	else
+		return exynos4_get_uart_clk(dev_index);
 }
 
 void set_mmc_clk(int dev_index, unsigned int div)
 {
-	exynos4_set_mmc_clk(dev_index, div);
+	if (cpu_is_exynos5())
+		exynos5_set_mmc_clk(dev_index, div);
+	else
+		exynos4_set_mmc_clk(dev_index, div);
 }
arch/arm/include/asm/arch-exynos/clock.h +326 -0

332 lines not on this page · raw message

arch/arm/include/asm/arch-exynos/cpu.h +34 -1
index 3496616..89f2c2e 100644
@@ -22,6 +22,8 @@
 #ifndef _EXYNOS4_CPU_H
 #define _EXYNOS4_CPU_H
 
+#define DEVICE_NOT_AVAILABLE		0
+
 #define EXYNOS4_ADDR_BASE		0x10000000
 
 /* EXYNOS4 */
@@ -46,7 +48,34 @@
 #define EXYNOS4_ADC_BASE		0x13910000
 #define EXYNOS4_PWMTIMER_BASE		0x139D0000
 #define EXYNOS4_MODEM_BASE		0x13A00000
-#define EXYNOS4_USBPHY_CONTROL          0x10020704
+#define EXYNOS4_USBPHY_CONTROL		0x10020704
+
+#define EXYNOS4_GPIO_PART4_BASE		DEVICE_NOT_AVAILABLE
+
+/* EXYNOS5 */
+#define EXYNOS5_GPIO_PART4_BASE		0x03860000
+#define EXYNOS5_PRO_ID			0x10000000
+#define EXYNOS5_CLOCK_BASE		0x10010000
+#define EXYNOS5_POWER_BASE		0x10040000
+#define EXYNOS5_SWRESET			0x10040400
+#define EXYNOS5_SYSREG_BASE		0x10050000
+#define EXYNOS5_WATCHDOG_BASE		0x101D0000
+#define EXYNOS5_DMC_PHY0_BASE		0x10C00000
+#define EXYNOS5_DMC_PHY1_BASE		0x10C10000
+#define EXYNOS5_GPIO_PART3_BASE		0x10D10000
+#define EXYNOS5_DMC_CTRL_BASE		0x10DD0000
+#define EXYNOS5_GPIO_PART1_BASE		0x11400000
+#define EXYNOS5_MMC_BASE		0x12200000
+#define EXYNOS5_SROMC_BASE		0x12250000
+#define EXYNOS5_USBOTG_BASE		0x12480000
+#define EXYNOS5_USBPHY_BASE		0x12480000
+#define EXYNOS5_UART_BASE		0x12C00000
+#define EXYNOS5_PWMTIMER_BASE		0x12DD0000
+#define EXYNOS5_GPIO_PART2_BASE		0x13400000
+#define EXYNOS5_FIMD_BASE		0x14400000
+
+#define EXYNOS5_ADC_BASE		DEVICE_NOT_AVAILABLE
+#define EXYNOS5_MODEM_BASE		DEVICE_NOT_AVAILABLE
 
 #ifndef __ASSEMBLY__
 #include <asm/io.h>
@@ -83,12 +112,15 @@ static inline int cpu_is_##type(void)			\
 }
 
 IS_SAMSUNG_TYPE(exynos4, 0xc210)
+IS_SAMSUNG_TYPE(exynos5, 0xc520)
 
 #define SAMSUNG_BASE(device, base)				\
 static inline unsigned int samsung_get_base_##device(void)	\
 {								\
 	if (cpu_is_exynos4())					\
 		return EXYNOS4_##base;				\
+	else if (cpu_is_exynos5())				\
+		return EXYNOS5_##base;				\
 	else							\
 		return 0;					\
 }
@@ -99,6 +131,7 @@ SAMSUNG_BASE(fimd, FIMD_BASE)
 SAMSUNG_BASE(gpio_part1, GPIO_PART1_BASE)
 SAMSUNG_BASE(gpio_part2, GPIO_PART2_BASE)
 SAMSUNG_BASE(gpio_part3, GPIO_PART3_BASE)
+SAMSUNG_BASE(gpio_part4, GPIO_PART4_BASE)
 SAMSUNG_BASE(pro_id, PRO_ID)
 SAMSUNG_BASE(mmc, MMC_BASE)
 SAMSUNG_BASE(modem, MODEM_BASE)
arch/arm/include/asm/arch-exynos/dmc.h new file +146 -0

146 lines not on this page · raw message

arch/arm/include/asm/arch-exynos/gpio.h +93 -6

120 lines not on this page · raw message

arch/arm/include/asm/arch-exynos/tzpc.h new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#3 lore raw

PATCH v6 3/4 EXYNOS: Add SMDK5250 board support

In reply to Chander Kashyap

SMDK5250 board is based on Samsungs EXYNOS5250 SoC.

---
Changes for v2:
- This patch is bifurcated into borad support and SoC support
- Fixed typo: s/EEYNOS/EXYNOS
- Squashed patch "SMDK5250: enable device tree support" in this.
Changes for v3:
- None
Changes for v4:
- Converted assembly routines for clock, memory, uart and tzpc
- init to c functions
- Moved uart init to smdk5250.c
Changes for v5:
- Remove initof gpio1
- Fixed gpio configuration for uart
Changes for v6:
- Add gpio1 init in board_uart_init, which was removed in v5

 MAINTAINERS                            |    1 +
 board/samsung/smdk5250/Makefile        |   51 ++++
 board/samsung/smdk5250/clock_init.c    |  202 +++++++++++++
 board/samsung/smdk5250/dmc_init.c      |  508 ++++++++++++++++++++++++++++++++
 board/samsung/smdk5250/lowlevel_init.S |   96 ++++++
 board/samsung/smdk5250/setup.h         |  353 ++++++++++++++++++++++
 board/samsung/smdk5250/smdk5250.c      |  152 ++++++++++
 board/samsung/smdk5250/tzpc_init.c     |   48 +++
 boards.cfg                             |    1 +
 include/configs/smdk5250.h             |  198 +++++++++++++
 10 files changed, 1610 insertions(+), 0 deletions(-)
 create mode 100644 board/samsung/smdk5250/Makefile
 create mode 100644 board/samsung/smdk5250/clock_init.c
 create mode 100644 board/samsung/smdk5250/dmc_init.c
 create mode 100644 board/samsung/smdk5250/lowlevel_init.S
 create mode 100644 board/samsung/smdk5250/setup.h
 create mode 100644 board/samsung/smdk5250/smdk5250.c
 create mode 100644 board/samsung/smdk5250/tzpc_init.c
 create mode 100644 include/configs/smdk5250.h
MAINTAINERS +1 -0
index acbd7f1..c03ebb4 100644
@@ -713,6 +713,7 @@ Chander Kashyap <[email protected]>
 
 	origen			ARM ARMV7 (EXYNOS4210 SoC)
 	SMDKV310		ARM ARMV7 (EXYNOS4210 SoC)
+	SMDK5250		ARM ARMV7 (EXYNOS5250 SoC)
 
 Heungjun Kim <[email protected]>
 
board/samsung/smdk5250/Makefile new file +51 -0

51 lines not on this page · raw message

board/samsung/smdk5250/clock_init.c new file +202 -0

202 lines not on this page · raw message

board/samsung/smdk5250/dmc_init.c new file +508 -0

508 lines not on this page · raw message

board/samsung/smdk5250/lowlevel_init.S new file +96 -0

96 lines not on this page · raw message

board/samsung/smdk5250/setup.h new file +353 -0

353 lines not on this page · raw message

board/samsung/smdk5250/smdk5250.c new file +152 -0

152 lines not on this page · raw message

board/samsung/smdk5250/tzpc_init.c new file +48 -0

48 lines not on this page · raw message

boards.cfg +1 -0
index 4aaa891..c0bac3c 100644
@@ -221,6 +221,7 @@ s5p_goni                     arm         armv7       goni                samsung
 smdkc100                     arm         armv7       smdkc100            samsung        s5pc1xx
 origen			     arm	 armv7	     origen		 samsung	exynos
 s5pc210_universal            arm         armv7       universal_c210      samsung        exynos
+smdk5250		     arm	 armv7	     smdk5250		 samsung	exynos
 smdkv310		     arm	 armv7	     smdkv310		 samsung	exynos
 trats                        arm         armv7       trats               samsung        exynos
 harmony                      arm         armv7       harmony             nvidia         tegra2
include/configs/smdk5250.h new file +198 -0

198 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#4 lore raw

PATCH v6 3/4 EXYNOS: Add SMDK5250 board support

Hi Chander,

Quoted 4 lines · Chander Kashyap

SMDK5250 board is based on Samsungs EXYNOS5250 SoC.

---

[...]

Quoted 503 lines
board/samsung/smdk5250/dmc_init.c new file +497 -0
new file mode 100644
index 0000000..6f92d8a
@@ -0,0 +1,508 @@
+/*
+ * Memory setup for SMDK5250 board based on EXYNOS5
+ *
+ * Copyright (C) 2011 Samsung Electronics
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <config.h>
+#include <asm/io.h>
+#include <asm/arch/dmc.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/cpu.h>
+#include "setup.h"
+
+/* APLL : 1GHz */
+/* MCLK_CDREX: MCLK_CDREX_533*/
+/* LPDDR support: LPDDR2 */
+
+void mem_ctrl_asm_init()
+{
+	struct exynos5_clock *clk = (struct exynos5_clock *)EXYNOS5_CLOCK_BASE;
+	struct exynos5_phy_control *phy0_ctrl, *phy1_ctrl;
+	struct exynos5_dmc *dmc;
+	unsigned int val;
+
+	phy0_ctrl = (struct exynos5_phy_control *)EXYNOS5_DMC_PHY0_BASE;
+	phy1_ctrl = (struct exynos5_phy_control *)EXYNOS5_DMC_PHY1_BASE;
+	dmc = (struct exynos5_dmc *)EXYNOS5_DMC_CTRL_BASE;
+
+	/* Reset PHY Controllor: PHY_RESET[0] */
+	writel(0x0, &clk->lpddr3phy_ctrl);
+
+	sdelay(0x10000);
+
+	/*set Read Latance and Burst Length for PHY0 and PHY1 */
+	val = 0x408;
+	writel(val, &phy0_ctrl->phy_con42);
+	writel(val, &phy1_ctrl->phy_con42);
+
+	/*
+	 * ZQ Calibration:
+	 * Select Driver Strength,
+	 * long calibration for manual calibration
+	 */
+	val = 0x0DA40304;
+	writel(val, &phy0_ctrl->phy_con16);
+	writel(val, &phy1_ctrl->phy_con16);
+
+	/* Enable termination */
+	val = 0x0DAC0304;
+	writel(val, &phy0_ctrl->phy_con16);
+	writel(val, &phy1_ctrl->phy_con16);
+
+	/* Start Manual Calibration */
+	val = 0x0DAC0306;
+	writel(val, &phy0_ctrl->phy_con16);
+	writel(val, &phy1_ctrl->phy_con16);
+
+	sdelay(0x10000);
+
+	/* Enable termination */
+	val = 0x0DAC0304;
+	writel(val, &phy0_ctrl->phy_con16);
+	writel(val, &phy1_ctrl->phy_con16);
+
+	/* DDR Mode: LPDDR2 */
+	val = 0x17021240;
+	writel(val, &phy0_ctrl->phy_con0);
+	writel(val, &phy1_ctrl->phy_con0);
+
+	/* DQS, DQ: Signal, for LPDDR2: Always Set */
+	val = 0x00000F0F;
+	writel(val, &phy0_ctrl->phy_con14);
+	writel(val, &phy1_ctrl->phy_con14);
+
+	/* RD_FETCH: 1 */
+	val = 0x1FFF1000;
+	writel(val, &dmc->concontrol);
+	sdelay(0x10000);
+
+	val = 0x0FFF1000;
+	writel(val, &dmc->concontrol);
+	sdelay(0x10000);
+
+	/*
+	 * Update DLL Information:
+	 * Force DLL Resyncronization
+	 */
+	val = 0x00000008;
+	writel(val, &dmc->phycontrol0);
+
+	/* Reset Force DLL Resyncronization */
+	val = 0x00000000;
+	writel(val, &dmc->phycontrol0);
+
+	/*
+	 * Dynamic Clock: Always Running
+	 * Memory Burst length: 4
+	 * Number of chips: 2
+	 * Memory Bus width: 32 bit
+	 * Memory Type: LPDDR2-S4
+	 * Additional Latancy for PLL: 1 Cycle
+	 */
+	val = 0x00212500;
+	writel(val, &dmc->memcontrol);
+
+	/*
+	 * Memory Configuration Chip 0
+	 * Address Mapping: Interleaved
+	 * Number of Column address Bits: 10 bits
+	 * Number of Rows Address Bits: 14
+	 * Number of Banks: 8
+	 */
+	val = 0x00001323;
+	writel(val, &dmc->memconfig0);
+
+	/*
+	 * Memory Configuration Chip 1
+	 * Address Mapping: Interleaved
+	 * Number of Column address Bits: 10 bits
+	 * Number of Rows Address Bits: 14
+	 * Number of Banks: 8
+	 */
+	val = 0x00001323;
+	writel(val, &dmc->memconfig1);
+
+	/*
+	 * Chip0: AXI
+	 * AXI Base Address: 0x40000000
+	 * AXI Base Address Mask: 0x780
+	 */
+	val = 0x00400780;
+	writel(val, &dmc->membaseconfig0);
+
+	/*
+	 * Chip1: AXI
+	 * AXI Base Address: 0x80000000
+	 * AXI Base Address Mask: 0x780
+	 */
+	val = 0x00800780;
+	writel(val, &dmc->membaseconfig1);
+
+	/* Precharge Configuration */
+	val = 0xFF000000;
+	writel(val, &dmc->prechconfig);
+
+	/* Power Down mode Configuration */
+	val = 0xFFFF00FF;
+	writel(val, &dmc->pwrdnconfig);
+
+	/* Periodic Refrese Interval */
+	val = 0x0000005D;
+	writel(val, &dmc->timingref);
+
+	/* MCLK_CDREX_533 */
+	/*
+	 * TimingRow, TimingData, TimingPower Setting:
+	 * Values as per Memory AC Parameters
+	 */
+	val = 0x2336544C;
+	writel(val, &dmc->timingrow);
+
+	val = 0x24202408;
+	writel(val, &dmc->timingdata);
+
+	val = 0x38260235;
+	writel(val, &dmc->timingpower);
+
+	/* Memory Channel Inteleaving Size: 128 Bytes */
+	val = CONFIG_IV_SIZE;
+	writel(val, &dmc->ivcontrol);
+
+	/* Set Offsets to read DQS */
+	val = 0x7F7F7F7F;
+	writel(val, &phy0_ctrl->phy_con4);
+	writel(val, &phy1_ctrl->phy_con4);
+
+	/* Set Offsets to read DQ */
+	val = 0x7F7F7F7F;
+	writel(val, &phy0_ctrl->phy_con6);
+	writel(val, &phy1_ctrl->phy_con6);
+
+	/* Debug Offset */
+	val = 0x0000007F;
+	writel(val, &phy0_ctrl->phy_con10);
+	writel(val, &phy1_ctrl->phy_con10);
+
+	/* Start DLL Locking */
+	val = 0x10107F50;
+	writel(val, &phy0_ctrl->phy_con12);
+	writel(val, &phy1_ctrl->phy_con12);
+
+	sdelay(0x10000);
+
+	/*
+	 * Update DLL Information:
+	 * Force DLL Resyncronization
+	 */
+	val = 0x00000008;
+	writel(val, &dmc->phycontrol0);
+
+	/* Reset DLL Resyncronization */
+	val = 0x00000000;
+	writel(val, &dmc->phycontrol0);
+
+	/*
+	 * NOP CMD: Channel 0, Chip 0
+	 * Exit from active/precharge power down or deep power down
+	 */
+	val = 0x07000000;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	/* EMRS2, EMRS3, EMRS, MRS Commands Using Direct Command */
+	val = 0x00071C00;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	val = 0x00010BFC;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	/* MCLK_CDREX_533 */
+	val = 0x00000708;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	val = 0x00000818;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	/*
+	 * NOP CMD: Channel 0, Chip 1
+	 * Exit from active/precharge power down or deep power down
+	 */
+	val = 0x07100000;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	/* EMRS2, EMRS3, EMRS, MRS Commands Using Direct Command */
+	val = 0x00171C00;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	val = 0x00110BFC;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	/* MCLK_CDREX_533 */
+	val = 0x00100708;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	val = 0x00100818;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	/*
+	 * NOP CMD: Channel 1, Chip 0
+	 * Exit from active/precharge power down or deep power down
+	 */
+	val = 0x17000000;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	/* EMRS2, EMRS3, EMRS, MRS Commands Using Direct Command */
+	val = 0x10071C00;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	val = 0x10010BFC;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	/* MCLK_CDREX_533 */
+	val = 0x10000708;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	val = 0x10000818;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	/*
+	 * NOP CMD: Channel 1, Chip 1
+	 * Exit from active/precharge power down or deep power down
+	 */
+	val = 0x17100000;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	/* EMRS2, EMRS3, EMRS, MRS Commands Using Direct Command */
+	val = 0x10171C00;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	val = 0x10110BFC;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	/* MCLK_CDREX_533 */
+	val = 0x10100708;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	val = 0x10100818;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	/* Reset DQS Offsets */
+	val = 0x08080808;
+	writel(val, &phy0_ctrl->phy_con4);
+	writel(val, &phy1_ctrl->phy_con4);
+
+	/* Reset DQ Offsets */
+	val = 0x08080808;
+	writel(val, &phy0_ctrl->phy_con6);
+	writel(val, &phy1_ctrl->phy_con6);
+
+	/* Reset debug Offsets */
+	val = 0x00000008;
+	writel(val, &phy0_ctrl->phy_con10);
+	writel(val, &phy1_ctrl->phy_con10);
+
+	/* Set DLL Locking */
+	val = 0x10107F30;
+	writel(val, &phy0_ctrl->phy_con12);
+	writel(val, &phy1_ctrl->phy_con12);
+
+	sdelay(0x10000);
+
+	/* Start DLL Locking */
+	val = 0x10107F70;
+	writel(val, &phy0_ctrl->phy_con12);
+	writel(val, &phy1_ctrl->phy_con12);
+
+	sdelay(0x10000);
+
+	/*
+	 * Update DLL Information:
+	 * Force DLL Resyncronization
+	 */
+	val = 0x00000008;
+	writel(val, &dmc->phycontrol0);
+
+	/* Reset DLL Resyncronization */
+	val = 0x00000000;
+	writel(val, &dmc->phycontrol0);
+
+	sdelay(0x10000);
+
+	/*
+	 * Update DLL Information:
+	 * Force DLL Resyncronization
+	 */
+	val = 0x00000008;
+	writel(val, &dmc->phycontrol0);
+
+	/* Reset DLL Resyncronization */
+	val = 0x00000000;
+	writel(val, &dmc->phycontrol0);
+
+	sdelay(0x10000);
+#if defined(CONFIG_RD_LVL)
+	/* DLL On */
+	val = 0x10102D50;
+	writel(val, &phy0_ctrl->phy_con12);
+	writel(val, &phy1_ctrl->phy_con12);
+
+	/*
+	 * Set ctrl_gateadj, ctrl_readadj
+	 * ctrl_gateduradj, rdlvl_pass_adj
+	 * rdlvl_rddataPadj
+	 */
+	val = 0x09210001;
+	writel(val, &phy0_ctrl->phy_con1);
+	writel(val, &phy1_ctrl->phy_con1);
+
+	/* LPDDR2 Address */
+	val = 0x00000208;
+	writel(val, &phy0_ctrl->phy_con22);
+	writel(val, &phy1_ctrl->phy_con22);
+
+	/* Enable Byte Read Leleling */
+	val = 0x17023240;
+	writel(val, &phy0_ctrl->phy_con0);
+	writel(val, &phy1_ctrl->phy_con0);
+
+	/* rdlvl_en: Use levelling offset instead ctrl_shiftc */
+	val = 0x02010004;
+	writel(val, &phy0_ctrl->phy_con2);
+	writel(val, &phy1_ctrl->phy_con2);
+
+	sdelay(0x10000);
+
+	/* Enable Data Eye Trainig */
+	val = 0x00000002;
+	writel(val, &dmc->rdlvl_config);
+
+	sdelay(0x10000);
+
+	/* Disable Data Eye Trainig */
+	val = 0x00000000;
+	writel(val, &dmc->rdlvl_config);
+
+	/* RdDeSkew_clear: Clear */
+	val = 0x02012004;
+	writel(val, &phy0_ctrl->phy_con2);
+	writel(val, &phy1_ctrl->phy_con2);
+
+	/* Start DLL Locking */
+	val = 0x10107F70;
+	writel(val, &phy0_ctrl->phy_con12);
+	writel(val, &phy1_ctrl->phy_con12);
+
+	/* Force DLL Resyncronization */
+	val = 0x00000008;
+	writel(val, &dmc->phycontrol0);
+
+	/* Reset DLL Resyncronization */
+	val = 0x00000000;
+	writel(val, &dmc->phycontrol0);
+
+	sdelay(0x10000);
+
+	/* ctrl_atgate: ctrl_gate_p*, ctrl_read_p* generated by PHY*/
+	val = 0x17023200;
+	writel(val, &phy0_ctrl->phy_con0);
+	writel(val, &phy1_ctrl->phy_con0);
+
+	/* Channel:0, Chip:0, PALL (all banks precharge) CMD */
+	val = 0x01000000;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	/* Channel:0, Chip:1, PALL (all banks precharge) CMD */
+	val = 0x01100000;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	/* Channel:1, Chip:0, PALL (all banks precharge) CMD */
+	val = 0x11000000;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+
+	/* Channel:1, Chip:1, PALL (all banks precharge) CMD */
+	val = 0x11100000;
+	writel(val, &dmc->directcmd);
+
+	sdelay(0x10000);
+#endif
+	/*
+	 * Dynamic Clock: Stops During Idle Period
+	 * Dynamic Power Down: Enable
+	 * Dynamic Self refresh: Enable
+	 * Memory Burst length: 4
+	 * Number of chips: 2

board/samsung/smdk5250/dmc_init.c line 507

Quoted 10 lines
board/samsung/smdk5250/dmc_init.c new file +10 -0
+	 * Memory Bus width: 32 bit
+	 * Memory Type: LPDDR2-S4
+	 * Additional Latancy for PLL: 1 Cycle
+	 */
+	val = 0x00212523;
+	writel(val, &dmc->memcontrol);
+
+	/* Start Auto refresh */
+	val = 0x0FFF10E0;
+	writel(val, &dmc->concontrol);

All those magic numbers above...
Can't those be defined appropriately?
Splitting the function to several functions would make it much more readable and nice (because currently it looks very ugly...). Are all these writes board specific?

[...]

Quoted 76 lines
board/samsung/smdk5250/smdk5250.c new file +70 -0
new file mode 100644
index 0000000..66d56ab
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <netdev.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/mmc.h>
+#include <asm/arch/sromc.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+struct exynos5_gpio_part1 *gpio1;
+
+int board_init(void)
+{
+	gpio1 = (struct exynos5_gpio_part1 *) samsung_get_base_gpio_part1();
+
+	gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
+	return 0;
+}
+
+int dram_init(void)
+{
+	gd->ram_size	= get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE)
+			+ get_ram_size((long *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE)
+			+ get_ram_size((long *)PHYS_SDRAM_3, PHYS_SDRAM_3_SIZE)
+			+ get_ram_size((long *)PHYS_SDRAM_4, PHYS_SDRAM_4_SIZE)
+			+ get_ram_size((long *)PHYS_SDRAM_5, PHYS_SDRAM_7_SIZE)
+			+ get_ram_size((long *)PHYS_SDRAM_6, PHYS_SDRAM_7_SIZE)
+			+ get_ram_size((long *)PHYS_SDRAM_7, PHYS_SDRAM_7_SIZE)
+			+ get_ram_size((long *)PHYS_SDRAM_8, PHYS_SDRAM_8_SIZE);
+	return 0;
+}
+
+void dram_init_banksize(void)
+{
+	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);
+	gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
+	gd->bd->bi_dram[1].size = get_ram_size((long *)PHYS_SDRAM_2, \
+							PHYS_SDRAM_2_SIZE);
+	gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
+	gd->bd->bi_dram[2].size = get_ram_size((long *)PHYS_SDRAM_3, \
+							PHYS_SDRAM_3_SIZE);
+	gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
+	gd->bd->bi_dram[3].size = get_ram_size((long *)PHYS_SDRAM_4, \
+							PHYS_SDRAM_4_SIZE);
+	gd->bd->bi_dram[4].start = PHYS_SDRAM_5;
+	gd->bd->bi_dram[4].size = get_ram_size((long *)PHYS_SDRAM_5, \

board/samsung/smdk5250/smdk5250.c line 80

Quoted 10 lines
board/samsung/smdk5250/smdk5250.c new file +10 -0
+							PHYS_SDRAM_5_SIZE);
+	gd->bd->bi_dram[5].start = PHYS_SDRAM_6;
+	gd->bd->bi_dram[5].size = get_ram_size((long *)PHYS_SDRAM_6, \
+							PHYS_SDRAM_6_SIZE);
+	gd->bd->bi_dram[6].start = PHYS_SDRAM_7;
+	gd->bd->bi_dram[6].size = get_ram_size((long *)PHYS_SDRAM_7, \
+							PHYS_SDRAM_7_SIZE);
+	gd->bd->bi_dram[7].start = PHYS_SDRAM_8;
+	gd->bd->bi_dram[7].size = get_ram_size((long *)PHYS_SDRAM_8, \
+							PHYS_SDRAM_8_SIZE);

No need for the back slashes...

[...]

Quoted 29 lines
include/configs/smdk5250.h new file +23 -0
new file mode 100644
index 0000000..194130d
@@ -0,0 +1,198 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics
+ *
+ * Configuration settings for the SAMSUNG SMDK5250 (EXYNOS5250) board.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */

include/configs/smdk5250.h line 33

Quoted 10 lines
include/configs/smdk5250.h new file +10 -0
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/* High Level Configuration Options */
+#define CONFIG_SAMSUNG		1	/* in a SAMSUNG core */
+#define CONFIG_S5P		1	/* S5P Family */
+#define CONFIG_EXYNOS5		1	/* which is in a Exynos5 Family */
+#define CONFIG_CPU_EXYNOS5250	1	/* which is in a Exynos5250 */
+#define CONFIG_SMDK5250		1	/* which is in a SMDK5250 */

Boolean defines should not have a value. Please, fix globally...

Quoted 165 lines
include/configs/smdk5250.h new file +165 -0
+
+#include <asm/arch/cpu.h>		/* get chip and board defs */
+
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+/* Keep L2 Cache Disabled */
+#define CONFIG_L2_OFF			1
+#define CONFIG_SYS_DCACHE_OFF		1
+
+#define CONFIG_SYS_SDRAM_BASE		0x40000000
+#define CONFIG_SYS_TEXT_BASE		0x43E00000
+
+/* input clock of PLL: SMDK5250 has 24MHz input clock */
+#define CONFIG_SYS_CLK_FREQ		24000000
+
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_INITRD_TAG
+#define CONFIG_CMDLINE_EDITING
+
+/* MACH_TYPE_SMDK5250 macro will be removed once added to mach-types */
+#define MACH_TYPE_SMDK5250		3774
+#define CONFIG_MACH_TYPE		MACH_TYPE_SMDK5250
+
+/* Power Down Modes */
+#define S5P_CHECK_SLEEP			0x00000BAD
+#define S5P_CHECK_DIDLE			0xBAD00000
+#define S5P_CHECK_LPA			0xABAD0000
+
+/* Offset for inform registers */
+#define INFORM0_OFFSET			0x800
+#define INFORM1_OFFSET			0x804
+
+/* Size of malloc() pool */
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
+
+/* select serial console configuration */
+#define CONFIG_SERIAL_MULTI		1
+#define CONFIG_SERIAL1			1	/* use SERIAL 1 */
+#define CONFIG_BAUDRATE			115200
+#define EXYNOS5_DEFAULT_UART_OFFSET	0x010000
+
+#define TZPC_BASE_OFFSET		0x10000
+
+/* SD/MMC configuration */
+#define CONFIG_GENERIC_MMC		1
+#define CONFIG_MMC			1
+#define CONFIG_S5P_MMC			1
+
+#define CONFIG_BOARD_EARLY_INIT_F
+
+/* PWM */
+#define CONFIG_PWM			1
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+
+/* Command definition*/
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_ELF
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_NFS
+
+#define CONFIG_BOOTDELAY		3
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+
+#define CONFIG_BOOTCOMMAND	"fatload mmc 0 40007000 uImage; bootm 40007000"
+
+/* Miscellaneous configurable options */
+#define CONFIG_SYS_LONGHELP		/* undef to save memory */
+#define CONFIG_SYS_HUSH_PARSER		/* use "hush" command parser	*/
+#define CONFIG_SYS_PROMPT_HUSH_PS2	"> "
+#define CONFIG_SYS_PROMPT		"SMDK5250 # "
+#define CONFIG_SYS_CBSIZE		256	/* Console I/O Buffer Size */
+#define CONFIG_SYS_PBSIZE		384	/* Print Buffer Size */
+#define CONFIG_SYS_MAXARGS		16	/* max number of command args */
+#define CONFIG_DEFAULT_CONSOLE		"console=ttySAC1,115200n8\0"
+/* Boot Argument Buffer Size */
+#define CONFIG_SYS_BARGSIZE		CONFIG_SYS_CBSIZE
+/* memtest works on */
+#define CONFIG_SYS_MEMTEST_START	CONFIG_SYS_SDRAM_BASE
+#define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_SDRAM_BASE + 0x5E00000)
+#define CONFIG_SYS_LOAD_ADDR		(CONFIG_SYS_SDRAM_BASE + 0x3E00000)
+
+#define CONFIG_SYS_HZ			1000
+
+/* valid baudrates */
+#define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200 }
+
+/* Stack sizes */
+#define CONFIG_STACKSIZE		(256 << 10)	/* 256KB */
+
+#define CONFIG_NR_DRAM_BANKS	8
+#define SDRAM_BANK_SIZE		(256UL << 20UL)	/* 256 MB */
+#define PHYS_SDRAM_1		CONFIG_SYS_SDRAM_BASE
+#define PHYS_SDRAM_1_SIZE	SDRAM_BANK_SIZE
+#define PHYS_SDRAM_2		(CONFIG_SYS_SDRAM_BASE + SDRAM_BANK_SIZE)
+#define PHYS_SDRAM_2_SIZE	SDRAM_BANK_SIZE
+#define PHYS_SDRAM_3		(CONFIG_SYS_SDRAM_BASE + (2 * SDRAM_BANK_SIZE))
+#define PHYS_SDRAM_3_SIZE	SDRAM_BANK_SIZE
+#define PHYS_SDRAM_4		(CONFIG_SYS_SDRAM_BASE + (3 * SDRAM_BANK_SIZE))
+#define PHYS_SDRAM_4_SIZE	SDRAM_BANK_SIZE
+#define PHYS_SDRAM_5		(CONFIG_SYS_SDRAM_BASE + (4 * SDRAM_BANK_SIZE))
+#define PHYS_SDRAM_5_SIZE	SDRAM_BANK_SIZE
+#define PHYS_SDRAM_6		(CONFIG_SYS_SDRAM_BASE + (5 * SDRAM_BANK_SIZE))
+#define PHYS_SDRAM_6_SIZE	SDRAM_BANK_SIZE
+#define PHYS_SDRAM_7		(CONFIG_SYS_SDRAM_BASE + (6 * SDRAM_BANK_SIZE))
+#define PHYS_SDRAM_7_SIZE	SDRAM_BANK_SIZE
+#define PHYS_SDRAM_8		(CONFIG_SYS_SDRAM_BASE + (7 * SDRAM_BANK_SIZE))
+#define PHYS_SDRAM_8_SIZE	SDRAM_BANK_SIZE
+
+#define CONFIG_SYS_MONITOR_BASE	0x00000000
+
+/* (Memory Interleaving Size = 1 << IV_SIZE) */
+#define CONFIG_IV_SIZE		0x07
+#define CONFIG_RD_LVL		1
+
+/* FLASH and environment organization */
+#define CONFIG_SYS_NO_FLASH		1
+#undef CONFIG_CMD_IMLS
+#define CONFIG_IDENT_STRING		" for SMDK5250"
+
+#define CONFIG_ENV_IS_IN_MMC		1
+#define CONFIG_SYS_MMC_ENV_DEV		0
+
+#define CONFIG_SECURE_BL1_ONLY
+
+/* Secure FW size configuration */
+#ifdef	CONFIG_SECURE_BL1_ONLY
+#define	CONFIG_SEC_FW_SIZE		(8 << 10)	/* 8KB */
+#else
+#define	CONFIG_SEC_FW_SIZE		0
+#endif
+
+/* Configuration of BL1, BL2, ENV Blocks on mmc */
+#define CONFIG_RES_BLOCK_SIZE	(512)
+#define CONFIG_BL1_SIZE		(16 << 10) /*16 K reserved for BL1*/
+#define	CONFIG_BL2_SIZE		(512UL << 10UL)	/* 512 KB */
+#define CONFIG_ENV_SIZE		(16 << 10)	/* 16 KB */
+
+#define CONFIG_BL1_OFFSET	(CONFIG_RES_BLOCK_SIZE + CONFIG_SEC_FW_SIZE)
+#define CONFIG_BL2_OFFSET	(CONFIG_BL1_OFFSET + CONFIG_BL1_SIZE)
+#define CONFIG_ENV_OFFSET	(CONFIG_BL2_OFFSET + CONFIG_BL2_SIZE)
+
+/* U-boot copy size from boot Media to DRAM.*/
+#define BL2_START_OFFSET	(CONFIG_BL2_OFFSET/512)
+#define BL2_SIZE_BLOC_COUNT	(CONFIG_BL2_SIZE/512)
+#define CONFIG_DOS_PARTITION		1
+
+#define CONFIG_IRAM_STACK	0x02050000
+
+#define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SYS_LOAD_ADDR - 0x1000000)
+#define MMC_MAX_CHANNEL		5
+
+/* Enable devicetree support */
+#define CONFIG_OF_LIBFDT
+
+#endif	/* __CONFIG_H */
Signature · 2 lines
Regards,
Igor.
#5 lore raw

PATCH v6 3/4 EXYNOS: Add SMDK5250 board support

Hi Igor,

Quoted 521 lines · Igor Grinberg

Hi Chander,

Quoted 4 lines · Chander Kashyap

SMDK5250 board is based on Samsungs EXYNOS5250 SoC.

---

[...]

Quoted 511 lines
board/samsung/smdk5250/dmc_init.c new file +505 -0
new file mode 100644
index 0000000..6f92d8a
@@ -0,0 +1,508 @@
+/*
+ * Memory setup for SMDK5250 board based on EXYNOS5
+ *
+ * Copyright (C) 2011 Samsung Electronics
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ?See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <config.h>
+#include <asm/io.h>
+#include <asm/arch/dmc.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/cpu.h>
+#include "setup.h"
+
+/* APLL : 1GHz */
+/* MCLK_CDREX: MCLK_CDREX_533*/
+/* LPDDR support: LPDDR2 */
+
+void mem_ctrl_asm_init()
+{
+ ? ? struct exynos5_clock *clk = (struct exynos5_clock *)EXYNOS5_CLOCK_BASE;
+ ? ? struct exynos5_phy_control *phy0_ctrl, *phy1_ctrl;
+ ? ? struct exynos5_dmc *dmc;
+ ? ? unsigned int val;
+
+ ? ? phy0_ctrl = (struct exynos5_phy_control *)EXYNOS5_DMC_PHY0_BASE;
+ ? ? phy1_ctrl = (struct exynos5_phy_control *)EXYNOS5_DMC_PHY1_BASE;
+ ? ? dmc = (struct exynos5_dmc *)EXYNOS5_DMC_CTRL_BASE;
+
+ ? ? /* Reset PHY Controllor: PHY_RESET[0] */
+ ? ? writel(0x0, &clk->lpddr3phy_ctrl);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /*set Read Latance and Burst Length for PHY0 and PHY1 */
+ ? ? val = 0x408;
+ ? ? writel(val, &phy0_ctrl->phy_con42);
+ ? ? writel(val, &phy1_ctrl->phy_con42);
+
+ ? ? /*
+ ? ? ?* ZQ Calibration:
+ ? ? ?* Select Driver Strength,
+ ? ? ?* long calibration for manual calibration
+ ? ? ?*/
+ ? ? val = 0x0DA40304;
+ ? ? writel(val, &phy0_ctrl->phy_con16);
+ ? ? writel(val, &phy1_ctrl->phy_con16);
+
+ ? ? /* Enable termination */
+ ? ? val = 0x0DAC0304;
+ ? ? writel(val, &phy0_ctrl->phy_con16);
+ ? ? writel(val, &phy1_ctrl->phy_con16);
+
+ ? ? /* Start Manual Calibration */
+ ? ? val = 0x0DAC0306;
+ ? ? writel(val, &phy0_ctrl->phy_con16);
+ ? ? writel(val, &phy1_ctrl->phy_con16);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /* Enable termination */
+ ? ? val = 0x0DAC0304;
+ ? ? writel(val, &phy0_ctrl->phy_con16);
+ ? ? writel(val, &phy1_ctrl->phy_con16);
+
+ ? ? /* DDR Mode: LPDDR2 */
+ ? ? val = 0x17021240;
+ ? ? writel(val, &phy0_ctrl->phy_con0);
+ ? ? writel(val, &phy1_ctrl->phy_con0);
+
+ ? ? /* DQS, DQ: Signal, for LPDDR2: Always Set */
+ ? ? val = 0x00000F0F;
+ ? ? writel(val, &phy0_ctrl->phy_con14);
+ ? ? writel(val, &phy1_ctrl->phy_con14);
+
+ ? ? /* RD_FETCH: 1 */
+ ? ? val = 0x1FFF1000;
+ ? ? writel(val, &dmc->concontrol);
+ ? ? sdelay(0x10000);
+
+ ? ? val = 0x0FFF1000;
+ ? ? writel(val, &dmc->concontrol);
+ ? ? sdelay(0x10000);
+
+ ? ? /*
+ ? ? ?* Update DLL Information:
+ ? ? ?* Force DLL Resyncronization
+ ? ? ?*/
+ ? ? val = 0x00000008;
+ ? ? writel(val, &dmc->phycontrol0);
+
+ ? ? /* Reset Force DLL Resyncronization */
+ ? ? val = 0x00000000;
+ ? ? writel(val, &dmc->phycontrol0);
+
+ ? ? /*
+ ? ? ?* Dynamic Clock: Always Running
+ ? ? ?* Memory Burst length: 4
+ ? ? ?* Number of chips: 2
+ ? ? ?* Memory Bus width: 32 bit
+ ? ? ?* Memory Type: LPDDR2-S4
+ ? ? ?* Additional Latancy for PLL: 1 Cycle
+ ? ? ?*/
+ ? ? val = 0x00212500;
+ ? ? writel(val, &dmc->memcontrol);
+
+ ? ? /*
+ ? ? ?* Memory Configuration Chip 0
+ ? ? ?* Address Mapping: Interleaved
+ ? ? ?* Number of Column address Bits: 10 bits
+ ? ? ?* Number of Rows Address Bits: 14
+ ? ? ?* Number of Banks: 8
+ ? ? ?*/
+ ? ? val = 0x00001323;
+ ? ? writel(val, &dmc->memconfig0);
+
+ ? ? /*
+ ? ? ?* Memory Configuration Chip 1
+ ? ? ?* Address Mapping: Interleaved
+ ? ? ?* Number of Column address Bits: 10 bits
+ ? ? ?* Number of Rows Address Bits: 14
+ ? ? ?* Number of Banks: 8
+ ? ? ?*/
+ ? ? val = 0x00001323;
+ ? ? writel(val, &dmc->memconfig1);
+
+ ? ? /*
+ ? ? ?* Chip0: AXI
+ ? ? ?* AXI Base Address: 0x40000000
+ ? ? ?* AXI Base Address Mask: 0x780
+ ? ? ?*/
+ ? ? val = 0x00400780;
+ ? ? writel(val, &dmc->membaseconfig0);
+
+ ? ? /*
+ ? ? ?* Chip1: AXI
+ ? ? ?* AXI Base Address: 0x80000000
+ ? ? ?* AXI Base Address Mask: 0x780
+ ? ? ?*/
+ ? ? val = 0x00800780;
+ ? ? writel(val, &dmc->membaseconfig1);
+
+ ? ? /* Precharge Configuration */
+ ? ? val = 0xFF000000;
+ ? ? writel(val, &dmc->prechconfig);
+
+ ? ? /* Power Down mode Configuration */
+ ? ? val = 0xFFFF00FF;
+ ? ? writel(val, &dmc->pwrdnconfig);
+
+ ? ? /* Periodic Refrese Interval */
+ ? ? val = 0x0000005D;
+ ? ? writel(val, &dmc->timingref);
+
+ ? ? /* MCLK_CDREX_533 */
+ ? ? /*
+ ? ? ?* TimingRow, TimingData, TimingPower Setting:
+ ? ? ?* Values as per Memory AC Parameters
+ ? ? ?*/
+ ? ? val = 0x2336544C;
+ ? ? writel(val, &dmc->timingrow);
+
+ ? ? val = 0x24202408;
+ ? ? writel(val, &dmc->timingdata);
+
+ ? ? val = 0x38260235;
+ ? ? writel(val, &dmc->timingpower);
+
+ ? ? /* Memory Channel Inteleaving Size: 128 Bytes */
+ ? ? val = CONFIG_IV_SIZE;
+ ? ? writel(val, &dmc->ivcontrol);
+
+ ? ? /* Set Offsets to read DQS */
+ ? ? val = 0x7F7F7F7F;
+ ? ? writel(val, &phy0_ctrl->phy_con4);
+ ? ? writel(val, &phy1_ctrl->phy_con4);
+
+ ? ? /* Set Offsets to read DQ */
+ ? ? val = 0x7F7F7F7F;
+ ? ? writel(val, &phy0_ctrl->phy_con6);
+ ? ? writel(val, &phy1_ctrl->phy_con6);
+
+ ? ? /* Debug Offset */
+ ? ? val = 0x0000007F;
+ ? ? writel(val, &phy0_ctrl->phy_con10);
+ ? ? writel(val, &phy1_ctrl->phy_con10);
+
+ ? ? /* Start DLL Locking */
+ ? ? val = 0x10107F50;
+ ? ? writel(val, &phy0_ctrl->phy_con12);
+ ? ? writel(val, &phy1_ctrl->phy_con12);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /*
+ ? ? ?* Update DLL Information:
+ ? ? ?* Force DLL Resyncronization
+ ? ? ?*/
+ ? ? val = 0x00000008;
+ ? ? writel(val, &dmc->phycontrol0);
+
+ ? ? /* Reset DLL Resyncronization */
+ ? ? val = 0x00000000;
+ ? ? writel(val, &dmc->phycontrol0);
+
+ ? ? /*
+ ? ? ?* NOP CMD: Channel 0, Chip 0
+ ? ? ?* Exit from active/precharge power down or deep power down
+ ? ? ?*/
+ ? ? val = 0x07000000;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /* EMRS2, EMRS3, EMRS, MRS Commands Using Direct Command */
+ ? ? val = 0x00071C00;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? val = 0x00010BFC;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /* MCLK_CDREX_533 */
+ ? ? val = 0x00000708;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? val = 0x00000818;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /*
+ ? ? ?* NOP CMD: Channel 0, Chip 1
+ ? ? ?* Exit from active/precharge power down or deep power down
+ ? ? ?*/
+ ? ? val = 0x07100000;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /* EMRS2, EMRS3, EMRS, MRS Commands Using Direct Command */
+ ? ? val = 0x00171C00;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? val = 0x00110BFC;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /* MCLK_CDREX_533 */
+ ? ? val = 0x00100708;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? val = 0x00100818;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /*
+ ? ? ?* NOP CMD: Channel 1, Chip 0
+ ? ? ?* Exit from active/precharge power down or deep power down
+ ? ? ?*/
+ ? ? val = 0x17000000;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /* EMRS2, EMRS3, EMRS, MRS Commands Using Direct Command */
+ ? ? val = 0x10071C00;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? val = 0x10010BFC;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /* MCLK_CDREX_533 */
+ ? ? val = 0x10000708;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? val = 0x10000818;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /*
+ ? ? ?* NOP CMD: Channel 1, Chip 1
+ ? ? ?* Exit from active/precharge power down or deep power down
+ ? ? ?*/
+ ? ? val = 0x17100000;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /* EMRS2, EMRS3, EMRS, MRS Commands Using Direct Command */
+ ? ? val = 0x10171C00;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? val = 0x10110BFC;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /* MCLK_CDREX_533 */
+ ? ? val = 0x10100708;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? val = 0x10100818;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /* Reset DQS Offsets */
+ ? ? val = 0x08080808;
+ ? ? writel(val, &phy0_ctrl->phy_con4);
+ ? ? writel(val, &phy1_ctrl->phy_con4);
+
+ ? ? /* Reset DQ Offsets */
+ ? ? val = 0x08080808;
+ ? ? writel(val, &phy0_ctrl->phy_con6);
+ ? ? writel(val, &phy1_ctrl->phy_con6);
+
+ ? ? /* Reset debug Offsets */
+ ? ? val = 0x00000008;
+ ? ? writel(val, &phy0_ctrl->phy_con10);
+ ? ? writel(val, &phy1_ctrl->phy_con10);
+
+ ? ? /* Set DLL Locking */
+ ? ? val = 0x10107F30;
+ ? ? writel(val, &phy0_ctrl->phy_con12);
+ ? ? writel(val, &phy1_ctrl->phy_con12);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /* Start DLL Locking */
+ ? ? val = 0x10107F70;
+ ? ? writel(val, &phy0_ctrl->phy_con12);
+ ? ? writel(val, &phy1_ctrl->phy_con12);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /*
+ ? ? ?* Update DLL Information:
+ ? ? ?* Force DLL Resyncronization
+ ? ? ?*/
+ ? ? val = 0x00000008;
+ ? ? writel(val, &dmc->phycontrol0);
+
+ ? ? /* Reset DLL Resyncronization */
+ ? ? val = 0x00000000;
+ ? ? writel(val, &dmc->phycontrol0);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /*
+ ? ? ?* Update DLL Information:
+ ? ? ?* Force DLL Resyncronization
+ ? ? ?*/
+ ? ? val = 0x00000008;
+ ? ? writel(val, &dmc->phycontrol0);
+
+ ? ? /* Reset DLL Resyncronization */
+ ? ? val = 0x00000000;
+ ? ? writel(val, &dmc->phycontrol0);
+
+ ? ? sdelay(0x10000);
+#if defined(CONFIG_RD_LVL)
+ ? ? /* DLL On */
+ ? ? val = 0x10102D50;
+ ? ? writel(val, &phy0_ctrl->phy_con12);
+ ? ? writel(val, &phy1_ctrl->phy_con12);
+
+ ? ? /*
+ ? ? ?* Set ctrl_gateadj, ctrl_readadj
+ ? ? ?* ctrl_gateduradj, rdlvl_pass_adj
+ ? ? ?* rdlvl_rddataPadj
+ ? ? ?*/
+ ? ? val = 0x09210001;
+ ? ? writel(val, &phy0_ctrl->phy_con1);
+ ? ? writel(val, &phy1_ctrl->phy_con1);
+
+ ? ? /* LPDDR2 Address */
+ ? ? val = 0x00000208;
+ ? ? writel(val, &phy0_ctrl->phy_con22);
+ ? ? writel(val, &phy1_ctrl->phy_con22);
+
+ ? ? /* Enable Byte Read Leleling */
+ ? ? val = 0x17023240;
+ ? ? writel(val, &phy0_ctrl->phy_con0);
+ ? ? writel(val, &phy1_ctrl->phy_con0);
+
+ ? ? /* rdlvl_en: Use levelling offset instead ctrl_shiftc */
+ ? ? val = 0x02010004;
+ ? ? writel(val, &phy0_ctrl->phy_con2);
+ ? ? writel(val, &phy1_ctrl->phy_con2);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /* Enable Data Eye Trainig */
+ ? ? val = 0x00000002;
+ ? ? writel(val, &dmc->rdlvl_config);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /* Disable Data Eye Trainig */
+ ? ? val = 0x00000000;
+ ? ? writel(val, &dmc->rdlvl_config);
+
+ ? ? /* RdDeSkew_clear: Clear */
+ ? ? val = 0x02012004;
+ ? ? writel(val, &phy0_ctrl->phy_con2);
+ ? ? writel(val, &phy1_ctrl->phy_con2);
+
+ ? ? /* Start DLL Locking */
+ ? ? val = 0x10107F70;
+ ? ? writel(val, &phy0_ctrl->phy_con12);
+ ? ? writel(val, &phy1_ctrl->phy_con12);
+
+ ? ? /* Force DLL Resyncronization */
+ ? ? val = 0x00000008;
+ ? ? writel(val, &dmc->phycontrol0);
+
+ ? ? /* Reset DLL Resyncronization */
+ ? ? val = 0x00000000;
+ ? ? writel(val, &dmc->phycontrol0);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /* ctrl_atgate: ctrl_gate_p*, ctrl_read_p* generated by PHY*/
+ ? ? val = 0x17023200;
+ ? ? writel(val, &phy0_ctrl->phy_con0);
+ ? ? writel(val, &phy1_ctrl->phy_con0);
+
+ ? ? /* Channel:0, Chip:0, PALL (all banks precharge) CMD */
+ ? ? val = 0x01000000;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /* Channel:0, Chip:1, PALL (all banks precharge) CMD */
+ ? ? val = 0x01100000;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /* Channel:1, Chip:0, PALL (all banks precharge) CMD */
+ ? ? val = 0x11000000;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+
+ ? ? /* Channel:1, Chip:1, PALL (all banks precharge) CMD */
+ ? ? val = 0x11100000;
+ ? ? writel(val, &dmc->directcmd);
+
+ ? ? sdelay(0x10000);
+#endif
+ ? ? /*
+ ? ? ?* Dynamic Clock: Stops During Idle Period
+ ? ? ?* Dynamic Power Down: Enable
+ ? ? ?* Dynamic Self refresh: Enable
+ ? ? ?* Memory Burst length: 4
+ ? ? ?* Number of chips: 2
+ ? ? ?* Memory Bus width: 32 bit
+ ? ? ?* Memory Type: LPDDR2-S4
+ ? ? ?* Additional Latancy for PLL: 1 Cycle
+ ? ? ?*/
+ ? ? val = 0x00212523;
+ ? ? writel(val, &dmc->memcontrol);
+
+ ? ? /* Start Auto refresh */
Quoted 8 lines

board/samsung/smdk5250/dmc_init.c line 507

Quoted 2 lines
board/samsung/smdk5250/dmc_init.c new file +2 -0
+ ? ? val = 0x0FFF10E0;
+ ? ? writel(val, &dmc->concontrol);

All those magic numbers above...
Can't those be defined appropriately?
Splitting the function to several functions would make it much more readable and nice (because currently it looks very ugly...). Are all these writes board specific?

I will submit a patch with proper defines and and modules shortly,

Quoted 83 lines

[...]

Quoted 80 lines
board/samsung/smdk5250/smdk5250.c new file +74 -0
new file mode 100644
index 0000000..66d56ab
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ?See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <netdev.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/mmc.h>
+#include <asm/arch/sromc.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+struct exynos5_gpio_part1 *gpio1;
+
+int board_init(void)
+{
+ ? ? gpio1 = (struct exynos5_gpio_part1 *) samsung_get_base_gpio_part1();
+
+ ? ? gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
+ ? ? return 0;
+}
+
+int dram_init(void)
+{
+ ? ? gd->ram_size ? ?= get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE)
+ ? ? ? ? ? ? ? ? ? ? + get_ram_size((long *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE)
+ ? ? ? ? ? ? ? ? ? ? + get_ram_size((long *)PHYS_SDRAM_3, PHYS_SDRAM_3_SIZE)
+ ? ? ? ? ? ? ? ? ? ? + get_ram_size((long *)PHYS_SDRAM_4, PHYS_SDRAM_4_SIZE)
+ ? ? ? ? ? ? ? ? ? ? + get_ram_size((long *)PHYS_SDRAM_5, PHYS_SDRAM_7_SIZE)
+ ? ? ? ? ? ? ? ? ? ? + get_ram_size((long *)PHYS_SDRAM_6, PHYS_SDRAM_7_SIZE)
+ ? ? ? ? ? ? ? ? ? ? + get_ram_size((long *)PHYS_SDRAM_7, PHYS_SDRAM_7_SIZE)
+ ? ? ? ? ? ? ? ? ? ? + get_ram_size((long *)PHYS_SDRAM_8, PHYS_SDRAM_8_SIZE);
+ ? ? return 0;
+}
+
+void dram_init_banksize(void)
+{
+ ? ? 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);
+ ? ? gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
+ ? ? gd->bd->bi_dram[1].size = get_ram_size((long *)PHYS_SDRAM_2, \
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? PHYS_SDRAM_2_SIZE);
+ ? ? gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
+ ? ? gd->bd->bi_dram[2].size = get_ram_size((long *)PHYS_SDRAM_3, \
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? PHYS_SDRAM_3_SIZE);
+ ? ? gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
+ ? ? gd->bd->bi_dram[3].size = get_ram_size((long *)PHYS_SDRAM_4, \
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? PHYS_SDRAM_4_SIZE);
+ ? ? gd->bd->bi_dram[4].start = PHYS_SDRAM_5;
+ ? ? gd->bd->bi_dram[4].size = get_ram_size((long *)PHYS_SDRAM_5, \
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? PHYS_SDRAM_5_SIZE);
+ ? ? gd->bd->bi_dram[5].start = PHYS_SDRAM_6;
+ ? ? gd->bd->bi_dram[5].size = get_ram_size((long *)PHYS_SDRAM_6, \
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? PHYS_SDRAM_6_SIZE);
Quoted 8 lines

board/samsung/smdk5250/smdk5250.c line 80

Quoted 6 lines
board/samsung/smdk5250/smdk5250.c new file +6 -0
+ ? ? gd->bd->bi_dram[6].start = PHYS_SDRAM_7;
+ ? ? gd->bd->bi_dram[6].size = get_ram_size((long *)PHYS_SDRAM_7, \
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? PHYS_SDRAM_7_SIZE);
+ ? ? gd->bd->bi_dram[7].start = PHYS_SDRAM_8;
+ ? ? gd->bd->bi_dram[7].size = get_ram_size((long *)PHYS_SDRAM_8, \
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? PHYS_SDRAM_8_SIZE);

No need for the back slashes...

Yes will remove them.

Quoted 36 lines

[...]

Quoted 33 lines
include/configs/smdk5250.h new file +27 -0
new file mode 100644
index 0000000..194130d
@@ -0,0 +1,198 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics
+ *
+ * Configuration settings for the SAMSUNG SMDK5250 (EXYNOS5250) board.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ?See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
Quoted 8 lines

include/configs/smdk5250.h line 33

Quoted 6 lines
include/configs/smdk5250.h new file +6 -0
+/* High Level Configuration Options */
+#define CONFIG_SAMSUNG ? ? ? ? ? ? ? 1 ? ? ? /* in a SAMSUNG core */
+#define CONFIG_S5P ? ? ? ? ? 1 ? ? ? /* S5P Family */
+#define CONFIG_EXYNOS5 ? ? ? ? ? ? ? 1 ? ? ? /* which is in a Exynos5 Family */
+#define CONFIG_CPU_EXYNOS5250 ? ? ? ?1 ? ? ? /* which is in a Exynos5250 */
+#define CONFIG_SMDK5250 ? ? ? ? ? ? ?1 ? ? ? /* which is in a SMDK5250 */

Boolean defines should not have a value. Please, fix globally...

Sure

Quoted 170 lines
Quoted 156 lines
include/configs/smdk5250.h new file +155 -0
+
+#include <asm/arch/cpu.h> ? ? ? ? ? ?/* get chip and board defs */
+
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+/* Keep L2 Cache Disabled */
+#define CONFIG_L2_OFF ? ? ? ? ? ? ? ? ? ? ? ?1
+#define CONFIG_SYS_DCACHE_OFF ? ? ? ? ? ? ? ?1
+
+#define CONFIG_SYS_SDRAM_BASE ? ? ? ? ? ? ? ?0x40000000
+#define CONFIG_SYS_TEXT_BASE ? ? ? ? 0x43E00000
+
+/* input clock of PLL: SMDK5250 has 24MHz input clock */
+#define CONFIG_SYS_CLK_FREQ ? ? ? ? ?24000000
+
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_INITRD_TAG
+#define CONFIG_CMDLINE_EDITING
+
+/* MACH_TYPE_SMDK5250 macro will be removed once added to mach-types */
+#define MACH_TYPE_SMDK5250 ? ? ? ? ? 3774
+#define CONFIG_MACH_TYPE ? ? ? ? ? ? MACH_TYPE_SMDK5250
+
+/* Power Down Modes */
+#define S5P_CHECK_SLEEP ? ? ? ? ? ? ? ? ? ? ?0x00000BAD
+#define S5P_CHECK_DIDLE ? ? ? ? ? ? ? ? ? ? ?0xBAD00000
+#define S5P_CHECK_LPA ? ? ? ? ? ? ? ? ? ? ? ?0xABAD0000
+
+/* Offset for inform registers */
+#define INFORM0_OFFSET ? ? ? ? ? ? ? ? ? ? ? 0x800
+#define INFORM1_OFFSET ? ? ? ? ? ? ? ? ? ? ? 0x804
+
+/* Size of malloc() pool */
+#define CONFIG_SYS_MALLOC_LEN ? ? ? ? ? ? ? ?(CONFIG_ENV_SIZE + (1 << 20))
+
+/* select serial console configuration */
+#define CONFIG_SERIAL_MULTI ? ? ? ? ?1
+#define CONFIG_SERIAL1 ? ? ? ? ? ? ? ? ? ? ? 1 ? ? ? /* use SERIAL 1 */
+#define CONFIG_BAUDRATE ? ? ? ? ? ? ? ? ? ? ?115200
+#define EXYNOS5_DEFAULT_UART_OFFSET ?0x010000
+
+#define TZPC_BASE_OFFSET ? ? ? ? ? ? 0x10000
+
+/* SD/MMC configuration */
+#define CONFIG_GENERIC_MMC ? ? ? ? ? 1
+#define CONFIG_MMC ? ? ? ? ? ? ? ? ? 1
+#define CONFIG_S5P_MMC ? ? ? ? ? ? ? ? ? ? ? 1
+
+#define CONFIG_BOARD_EARLY_INIT_F
+
+/* PWM */
+#define CONFIG_PWM ? ? ? ? ? ? ? ? ? 1
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+
+/* Command definition*/
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_ELF
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_NFS
+
+#define CONFIG_BOOTDELAY ? ? ? ? ? ? 3
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+
+#define CONFIG_BOOTCOMMAND ? "fatload mmc 0 40007000 uImage; bootm 40007000"
+
+/* Miscellaneous configurable options */
+#define CONFIG_SYS_LONGHELP ? ? ? ? ?/* undef to save memory */
+#define CONFIG_SYS_HUSH_PARSER ? ? ? ? ? ? ? /* use "hush" command parser ? ?*/
+#define CONFIG_SYS_PROMPT_HUSH_PS2 ? "> "
+#define CONFIG_SYS_PROMPT ? ? ? ? ? ?"SMDK5250 # "
+#define CONFIG_SYS_CBSIZE ? ? ? ? ? ?256 ? ? /* Console I/O Buffer Size */
+#define CONFIG_SYS_PBSIZE ? ? ? ? ? ?384 ? ? /* Print Buffer Size */
+#define CONFIG_SYS_MAXARGS ? ? ? ? ? 16 ? ? ?/* max number of command args */
+#define CONFIG_DEFAULT_CONSOLE ? ? ? ? ? ? ? "console=ttySAC1,115200n8\0"
+/* Boot Argument Buffer Size */
+#define CONFIG_SYS_BARGSIZE ? ? ? ? ?CONFIG_SYS_CBSIZE
+/* memtest works on */
+#define CONFIG_SYS_MEMTEST_START ? ? CONFIG_SYS_SDRAM_BASE
+#define CONFIG_SYS_MEMTEST_END ? ? ? ? ? ? ? (CONFIG_SYS_SDRAM_BASE + 0x5E00000)
+#define CONFIG_SYS_LOAD_ADDR ? ? ? ? (CONFIG_SYS_SDRAM_BASE + 0x3E00000)
+
+#define CONFIG_SYS_HZ ? ? ? ? ? ? ? ? ? ? ? ?1000
+
+/* valid baudrates */
+#define CONFIG_SYS_BAUDRATE_TABLE ? ?{ 9600, 19200, 38400, 57600, 115200 }
+
+/* Stack sizes */
+#define CONFIG_STACKSIZE ? ? ? ? ? ? (256 << 10) ? ? /* 256KB */
+
+#define CONFIG_NR_DRAM_BANKS 8
+#define SDRAM_BANK_SIZE ? ? ? ? ? ? ?(256UL << 20UL) /* 256 MB */
+#define PHYS_SDRAM_1 ? ? ? ? CONFIG_SYS_SDRAM_BASE
+#define PHYS_SDRAM_1_SIZE ? ?SDRAM_BANK_SIZE
+#define PHYS_SDRAM_2 ? ? ? ? (CONFIG_SYS_SDRAM_BASE + SDRAM_BANK_SIZE)
+#define PHYS_SDRAM_2_SIZE ? ?SDRAM_BANK_SIZE
+#define PHYS_SDRAM_3 ? ? ? ? (CONFIG_SYS_SDRAM_BASE + (2 * SDRAM_BANK_SIZE))
+#define PHYS_SDRAM_3_SIZE ? ?SDRAM_BANK_SIZE
+#define PHYS_SDRAM_4 ? ? ? ? (CONFIG_SYS_SDRAM_BASE + (3 * SDRAM_BANK_SIZE))
+#define PHYS_SDRAM_4_SIZE ? ?SDRAM_BANK_SIZE
+#define PHYS_SDRAM_5 ? ? ? ? (CONFIG_SYS_SDRAM_BASE + (4 * SDRAM_BANK_SIZE))
+#define PHYS_SDRAM_5_SIZE ? ?SDRAM_BANK_SIZE
+#define PHYS_SDRAM_6 ? ? ? ? (CONFIG_SYS_SDRAM_BASE + (5 * SDRAM_BANK_SIZE))
+#define PHYS_SDRAM_6_SIZE ? ?SDRAM_BANK_SIZE
+#define PHYS_SDRAM_7 ? ? ? ? (CONFIG_SYS_SDRAM_BASE + (6 * SDRAM_BANK_SIZE))
+#define PHYS_SDRAM_7_SIZE ? ?SDRAM_BANK_SIZE
+#define PHYS_SDRAM_8 ? ? ? ? (CONFIG_SYS_SDRAM_BASE + (7 * SDRAM_BANK_SIZE))
+#define PHYS_SDRAM_8_SIZE ? ?SDRAM_BANK_SIZE
+
+#define CONFIG_SYS_MONITOR_BASE ? ? ?0x00000000
+
+/* (Memory Interleaving Size = 1 << IV_SIZE) */
+#define CONFIG_IV_SIZE ? ? ? ? ? ? ? 0x07
+#define CONFIG_RD_LVL ? ? ? ? ? ? ? ?1
+
+/* FLASH and environment organization */
+#define CONFIG_SYS_NO_FLASH ? ? ? ? ?1
+#undef CONFIG_CMD_IMLS
+#define CONFIG_IDENT_STRING ? ? ? ? ?" for SMDK5250"
+
+#define CONFIG_ENV_IS_IN_MMC ? ? ? ? 1
+#define CONFIG_SYS_MMC_ENV_DEV ? ? ? ? ? ? ? 0
+
+#define CONFIG_SECURE_BL1_ONLY
+
+/* Secure FW size configuration */
+#ifdef ? ? ? CONFIG_SECURE_BL1_ONLY
+#define ? ? ?CONFIG_SEC_FW_SIZE ? ? ? ? ? ? ?(8 << 10) ? ? ? /* 8KB */
+#else
+#define ? ? ?CONFIG_SEC_FW_SIZE ? ? ? ? ? ? ?0
+#endif
+
+/* Configuration of BL1, BL2, ENV Blocks on mmc */
+#define CONFIG_RES_BLOCK_SIZE ? ? ? ?(512)
+#define CONFIG_BL1_SIZE ? ? ? ? ? ? ?(16 << 10) /*16 K reserved for BL1*/
+#define ? ? ?CONFIG_BL2_SIZE ? ? ? ? (512UL << 10UL) /* 512 KB */
+#define CONFIG_ENV_SIZE ? ? ? ? ? ? ?(16 << 10) ? ? ?/* 16 KB */
+
+#define CONFIG_BL1_OFFSET ? ?(CONFIG_RES_BLOCK_SIZE + CONFIG_SEC_FW_SIZE)
+#define CONFIG_BL2_OFFSET ? ?(CONFIG_BL1_OFFSET + CONFIG_BL1_SIZE)
+#define CONFIG_ENV_OFFSET ? ?(CONFIG_BL2_OFFSET + CONFIG_BL2_SIZE)
+
+/* U-boot copy size from boot Media to DRAM.*/
+#define BL2_START_OFFSET ? ? (CONFIG_BL2_OFFSET/512)
+#define BL2_SIZE_BLOC_COUNT ?(CONFIG_BL2_SIZE/512)
+#define CONFIG_DOS_PARTITION ? ? ? ? 1

include/configs/smdk5250.h

Quoted 10 lines
include/configs/smdk5250.h new file +10 -0
+
+#define CONFIG_IRAM_STACK ? ?0x02050000
+
+#define CONFIG_SYS_INIT_SP_ADDR ? ? ?(CONFIG_SYS_LOAD_ADDR - 0x1000000)
+#define MMC_MAX_CHANNEL ? ? ? ? ? ? ?5
+
+/* Enable devicetree support */
+#define CONFIG_OF_LIBFDT
+
+#endif ? ? ? /* __CONFIG_H */

--
Regards,
Igor.

Signature · 2 lines
with warm regards,
Chander Kashyap
#6 lore raw

PATCH v6 4/4 EXYNOS: SMDK5250: Add MMC SPL support

In reply to Chander Kashyap

This patch adds support for MMC SPL booting.

---
Changes for v2:
- None
Changes for v3:
- None
Changes for v4:
- None
Changes for v5:
- None
Changes for v5:
- None

 board/samsung/smdk5250/Makefile               |   16 ++++
 board/samsung/smdk5250/mmc_boot.c             |   58 ++++++++++++
 board/samsung/smdk5250/tools/mkexynos_image.c |  117 +++++++++++++++++++++++++
 include/configs/smdk5250.h                    |    6 +-
 4 files changed, 196 insertions(+), 1 deletions(-)
 create mode 100644 board/samsung/smdk5250/mmc_boot.c
 create mode 100644 board/samsung/smdk5250/tools/mkexynos_image.c
board/samsung/smdk5250/Makefile +16 -0
index d9c2774..908ce5b 100644
@@ -29,18 +29,34 @@ SOBJS	:= lowlevel_init.o
 COBJS	:= clock_init.o
 COBJS	+= dmc_init.o
 COBJS	+= tzpc_init.o
+
+ifndef CONFIG_SPL_BUILD
 COBJS	+= smdk5250.o
+endif
+
+ifdef CONFIG_SPL_BUILD
+COBJS	+= mmc_boot.o
+endif
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
 
 ALL	:=	 $(obj).depend $(LIB)
 
+ifdef CONFIG_SPL_BUILD
+ALL	+= $(OBJTREE)/tools/mk$(BOARD)spl
+endif
+
 all:	$(ALL)
 
 $(LIB):	$(OBJS)
 	$(call cmd_link_o_target, $(OBJS))
 
+ifdef CONFIG_SPL_BUILD
+$(OBJTREE)/tools/mk$(BOARD)spl:	tools/mkexynos_image.c
+	$(HOSTCC) tools/mkexynos_image.c -o $(OBJTREE)/tools/mk$(BOARD)spl
+endif
+
 #########################################################################
 
 # defines $(obj).depend target
board/samsung/smdk5250/mmc_boot.c new file +58 -0

58 lines not on this page · raw message

board/samsung/smdk5250/tools/mkexynos_image.c new file +117 -0

117 lines not on this page · raw message

include/configs/smdk5250.h +5 -1
index 194130d..6f2ef4c 100644
@@ -104,7 +104,11 @@
 #define CONFIG_BOOTDELAY		3
 #define CONFIG_ZERO_BOOTDELAY_CHECK
 
-#define CONFIG_BOOTCOMMAND	"fatload mmc 0 40007000 uImage; bootm 40007000"
+/* MMC SPL */
+#define CONFIG_SPL
+#define COPY_BL2_FNPTR_ADDR	0x02020030
+
+#define CONFIG_BOOTCOMMAND	"mmc read 40007000 451 2000; bootm 40007000"
 
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP		/* undef to save memory */
Signature · 1 line
1.7.5.4