Skip to contentSkip to conversation

EXYNOS: Convert Assembly code to c and make it common

PATCH New Rajeshwari Shinde 2 participants 6 messages Jul 4, 2013 – Jul 5, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 cover EXYNOS: Convert Assembly code to c and make it common

Convert the assembly code in board/samsung to c and move the same to arch/arm. lds file made common across SMDKV310, Origen and SMDK5250.
Add the power reset and exit wakeup api for exynos.
Initialise GPIO for uart in Origen and SMDKV310 using pinmux.

Changes in V2:
- Rebased on latest u-boot-samsung tree.
- Incorporated review comments from Simon glass and Minkyu Kang.
Changes in V3:
- Optimised the mem_ctrl_init function for exynos4.
- Removed magic numbers.
Changes in V4:
- Used samsung_get_base api instead of hardcoding base address.

Rajeshwari Shinde (4):
EXYNOS: Add API for power reset and exit wakeup
EXYNOS: LDS file move to common
EXYNOS4210: Configure GPIO for uart
EXYNOS: Move files from board/samsung to arch/arm

 arch/arm/cpu/armv7/exynos/Makefile                 |   17 +-
 .../arm/cpu/armv7/exynos}/clock_init.h             |    0
 arch/arm/cpu/armv7/exynos/clock_init_exynos4.c     |   95 +++++
 .../arm/cpu/armv7/exynos/clock_init_exynos5.c      |   56 ++--
 arch/arm/cpu/armv7/exynos/common_setup.h           |   45 ++
 .../arm/cpu/armv7/exynos}/dmc_common.c             |    7 +-
 .../arm/cpu/armv7/exynos}/dmc_init_ddr3.c          |   27 +-
 arch/arm/cpu/armv7/exynos/dmc_init_exynos4.c       |  213 ++++++++++
 .../arm/cpu/armv7/exynos/exynos4_setup.h           |  397 +++++++++----------
 .../arm/cpu/armv7/exynos/exynos5_setup.h           |   28 +-
 arch/arm/cpu/armv7/exynos/lowlevel_init.c          |   73 ++++
 arch/arm/cpu/armv7/exynos/pinmux.c                 |   40 ++
 arch/arm/cpu/armv7/exynos/power.c                  |   50 +++
 .../arm/cpu/armv7/exynos}/spl_boot.c               |   74 +++-
 arch/arm/include/asm/arch-exynos/cpu.h             |   13 +-
 arch/arm/include/asm/arch-exynos/power.h           |   12 +
 .../exynos-uboot-spl.lds}                          |    0
 board/samsung/origen/Makefile                      |   11 +-
 board/samsung/origen/lowlevel_init.S               |  357 -----------------
 board/samsung/origen/mem_setup.S                   |  421 --------------------
 board/samsung/origen/mmc_boot.c                    |   58 ---
 board/samsung/origen/origen.c                      |   46 +++
 board/samsung/smdk5250/Makefile                    |   14 +-
 board/samsung/smdkv310/Makefile                    |   10 +-
 board/samsung/smdkv310/lowlevel_init.S             |  414 -------------------
 board/samsung/smdkv310/mem_setup.S                 |  365 -----------------
 board/samsung/smdkv310/mmc_boot.c                  |   60 ---
 board/samsung/smdkv310/smdkv310.c                  |   46 +++
 include/configs/exynos5250-dt.h                    |   10 +-
 include/configs/origen.h                           |    9 +-
 include/configs/smdkv310.h                         |    8 +-
 31 files changed, 985 insertions(+), 1991 deletions(-)
 rename {board/samsung/smdk5250 => arch/arm/cpu/armv7/exynos}/clock_init.h (100%)
 create mode 100644 arch/arm/cpu/armv7/exynos/clock_init_exynos4.c
 rename board/samsung/smdk5250/clock_init.c => arch/arm/cpu/armv7/exynos/clock_init_exynos5.c (94%)
 create mode 100644 arch/arm/cpu/armv7/exynos/common_setup.h
 rename {board/samsung/smdk5250 => arch/arm/cpu/armv7/exynos}/dmc_common.c (97%)
 rename {board/samsung/smdk5250 => arch/arm/cpu/armv7/exynos}/dmc_init_ddr3.c (92%)
 create mode 100644 arch/arm/cpu/armv7/exynos/dmc_init_exynos4.c
 rename board/samsung/origen/origen_setup.h => arch/arm/cpu/armv7/exynos/exynos4_setup.h (65%)
 rename board/samsung/smdk5250/setup.h => arch/arm/cpu/armv7/exynos/exynos5_setup.h (96%)
 create mode 100644 arch/arm/cpu/armv7/exynos/lowlevel_init.c
 rename {board/samsung/smdk5250 => arch/arm/cpu/armv7/exynos}/spl_boot.c (74%)
 rename board/samsung/{smdk5250/smdk5250-uboot-spl.lds => common/exynos-uboot-spl.lds} (100%)
 delete mode 100644 board/samsung/origen/lowlevel_init.S
 delete mode 100644 board/samsung/origen/mem_setup.S
 delete mode 100644 board/samsung/origen/mmc_boot.c
 delete mode 100644 board/samsung/smdkv310/lowlevel_init.S
 delete mode 100644 board/samsung/smdkv310/mem_setup.S
 delete mode 100644 board/samsung/smdkv310/mmc_boot.c
Signature · 1 line
1.7.4.4
#1 lore raw

PATCH v4 1/4 EXYNOS: Add API for power reset and exit wakeup

This patch adds APIs to get power reset status and exit the wakeup condition for both exynos5 and exynos4

---
Changes in V2:
- Expanded the comments for get_reset_status function declaration.
Changes in V3:
- None
Changes in V4:
- None

 arch/arm/cpu/armv7/exynos/power.c        |   50 ++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-exynos/power.h |   12 +++++++
 2 files changed, 62 insertions(+), 0 deletions(-)
arch/arm/cpu/armv7/exynos/power.c +50 -0
index 6375a81..5d3bda2 100644
@@ -140,3 +140,53 @@ void set_hw_thermal_trip(void)
 		setbits_le32(&power->ps_hold_control, POWER_ENABLE_HW_TRIP);
 	}
 }
+
+static uint32_t exynos5_get_reset_status(void)
+{
+	struct exynos5_power *power =
+		(struct exynos5_power *)samsung_get_base_power();
+
+	return power->inform1;
+}
+
+static uint32_t exynos4_get_reset_status(void)
+{
+	struct exynos4_power *power =
+		(struct exynos4_power *)samsung_get_base_power();
+
+	return power->inform1;
+}
+
+uint32_t get_reset_status(void)
+{
+	if (cpu_is_exynos5())
+		return exynos5_get_reset_status();
+	else
+		return  exynos4_get_reset_status();
+}
+
+static void exynos5_power_exit_wakeup(void)
+{
+	struct exynos5_power *power =
+		(struct exynos5_power *)samsung_get_base_power();
+	typedef void (*resume_func)(void);
+
+	((resume_func)power->inform0)();
+}
+
+static void exynos4_power_exit_wakeup(void)
+{
+	struct exynos4_power *power =
+		(struct exynos4_power *)samsung_get_base_power();
+	typedef void (*resume_func)(void);
+
+	((resume_func)power->inform0)();
+}
+
+void power_exit_wakeup(void)
+{
+	if (cpu_is_exynos5())
+		exynos5_power_exit_wakeup();
+	else
+		exynos4_power_exit_wakeup();
+}
arch/arm/include/asm/arch-exynos/power.h +12 -0
index 3549667..44ad8d3 100644
@@ -888,4 +888,16 @@ void set_ps_hold_ctrl(void);
  * source as XXTI
  */
 void set_xclkout(void);
+
+/*
+ *  Read inform1 to get the reset status.
+ *  @return: the value can be either S5P_CHECK_SLEEP or
+ *  S5P_CHECK_DIDLE or S5P_CHECK_LPA as stored in inform1
+ *  if none of these then its normal booting.
+ */
+uint32_t get_reset_status(void);
+
+
+/* Read the resume function and call it */
+void power_exit_wakeup(void);
 #endif
Signature · 1 line
1.7.4.4
#2 lore raw

PATCH v4 2/4 EXYNOS: LDS file move to common

In reply to Rajeshwari Shinde

smdk5250-uboot-spl.lds is moved to common folder, so that it can be reused. It is renamed to exynos-uboot-spl.lds

---
Changes in V2:
- None
Changes in V3:
- None
Changes in V4:
- None

 .../exynos-uboot-spl.lds}                          |    0
 include/configs/exynos5250-dt.h                    |    2 +-
 2 files changed, 1 insertions(+), 1 deletions(-)
 rename board/samsung/{smdk5250/smdk5250-uboot-spl.lds => common/exynos-uboot-spl.lds} (100%)
board/samsung/common/exynos-uboot-spl.lds renamed from board/samsung/smdk5250/smdk5250-uboot-spl.lds +0 -0
similarity index 100%
rename from board/samsung/smdk5250/smdk5250-uboot-spl.lds
rename to board/samsung/common/exynos-uboot-spl.lds
include/configs/exynos5250-dt.h +1 -1
index 1c9eca2..6c7a052 100644
@@ -153,7 +153,7 @@
 #define COPY_BL2_FNPTR_ADDR	0x02020030
 
 /* specific .lds file */
-#define CONFIG_SPL_LDSCRIPT	"board/samsung/smdk5250/smdk5250-uboot-spl.lds"
+#define CONFIG_SPL_LDSCRIPT	"board/samsung/common/exynos-uboot-spl.lds"
 #define CONFIG_SPL_TEXT_BASE	0x02023400
 #define CONFIG_SPL_MAX_FOOTPRINT	(14 * 1024)
 
Signature · 1 line
1.7.4.4
#3 lore raw

PATCH v4 3/4 EXYNOS4210: Configure GPIO for uart

In reply to Rajeshwari Shinde

This patch configures the gpio values for UART
on Origen and SMDKV310 using pinmux

---
Changes in V2:
- None
Changes in V3:
- None
Changes in V4:
- None

 arch/arm/cpu/armv7/exynos/pinmux.c |   40 +++++++++++++++++++++++++++++++
 board/samsung/origen/origen.c      |   46 ++++++++++++++++++++++++++++++++++++
 board/samsung/smdkv310/smdkv310.c  |   46 ++++++++++++++++++++++++++++++++++++
 include/configs/origen.h           |    1 +
 include/configs/smdkv310.h         |    1 +
 5 files changed, 134 insertions(+), 0 deletions(-)
arch/arm/cpu/armv7/exynos/pinmux.c +40 -0
index bd499b4..2042062 100644
@@ -408,9 +408,49 @@ static int exynos4_mmc_config(int peripheral, int flags)
 	return 0;
 }
 
+static void exynos4_uart_config(int peripheral)
+{
+	struct exynos4_gpio_part1 *gpio1 =
+		(struct exynos4_gpio_part1 *)samsung_get_base_gpio_part1();
+	struct s5p_gpio_bank *bank;
+	int i, start, count;
+
+	switch (peripheral) {
+	case PERIPH_ID_UART0:
+		bank = &gpio1->a0;
+		start = 0;
+		count = 4;
+		break;
+	case PERIPH_ID_UART1:
+		bank = &gpio1->a0;
+		start = 4;
+		count = 4;
+		break;
+	case PERIPH_ID_UART2:
+		bank = &gpio1->a1;
+		start = 0;
+		count = 4;
+		break;
+	case PERIPH_ID_UART3:
+		bank = &gpio1->a1;
+		start = 4;
+		count = 2;
+		break;
+	}
+	for (i = start; i < start + count; i++) {
+		s5p_gpio_set_pull(bank, i, GPIO_PULL_NONE);
+		s5p_gpio_cfg_pin(bank, i, GPIO_FUNC(0x2));
+	}
+}
 static int exynos4_pinmux_config(int peripheral, int flags)
 {
 	switch (peripheral) {
+	case PERIPH_ID_UART0:
+	case PERIPH_ID_UART1:
+	case PERIPH_ID_UART2:
+	case PERIPH_ID_UART3:
+		exynos4_uart_config(peripheral);
+		break;
 	case PERIPH_ID_I2C0:
 	case PERIPH_ID_I2C1:
 	case PERIPH_ID_I2C2:
board/samsung/origen/origen.c +46 -0

58 lines not on this page · raw message

board/samsung/smdkv310/smdkv310.c +46 -0

55 lines not on this page · raw message

include/configs/origen.h +1 -0
index e179911..f71a463 100644
@@ -36,6 +36,7 @@
 #define CONFIG_ARCH_CPU_INIT
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
+#define CONFIG_BOARD_EARLY_INIT_F
 
 /* Keep L2 Cache Disabled */
 #define CONFIG_L2_OFF			1
include/configs/smdkv310.h +1 -0
index 5e43066..db78127 100644
@@ -36,6 +36,7 @@
 #define CONFIG_ARCH_CPU_INIT
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
+#define CONFIG_BOARD_EARLY_INIT_F
 
 /* Mach Type */
 #define CONFIG_MACH_TYPE		MACH_TYPE_SMDKV310
Signature · 1 line
1.7.4.4
#4 lore raw

PATCH v4 4/4 EXYNOS: Move files from board/samsung to arch/arm

In reply to Rajeshwari Shinde

This patch performs the following:

1) Convert the assembly code for memory and clock initialization to C code.
2) Move the memory and clock init codes from board/samsung to arch/arm
3) Creat a common lowlevel_init file across Exynos4 and Exynos5. Converted the common lowlevel_init from assembly to C-code
4) Made spl_boot.c and tzpc_init.c common for both exynos4 and exynos5.
5) Enable CONFIG_SKIP_LOWLEVEL_INIT as stack pointer initialisation is already done in _main.
6) exynos-uboot-spl.lds made common across SMDKV310, Origen and SMDK5250.

TEST: Tested SD-MMC boot on SMDK5250 and Origen.
Tested USB and SPI boot on SMDK5250
Compile tested for SMDKV310.

---
Changes in V2:
- Rebased on latest u-boot-samsung tree.
- Incorporated review comments from Minkyu Kang.
Changes in V3:
- Optimised the mem_ctrl_init function for exynos4.
- Removed magic numbers.
Changes in V4:
- Used samsung_get_base api instead of hardcoding base address.

 arch/arm/cpu/armv7/exynos/Makefile                 |   17 +-
 .../arm/cpu/armv7/exynos}/clock_init.h             |    0
 arch/arm/cpu/armv7/exynos/clock_init_exynos4.c     |   95 +++++
 .../arm/cpu/armv7/exynos/clock_init_exynos5.c      |   56 ++--
 arch/arm/cpu/armv7/exynos/common_setup.h           |   45 ++
 .../arm/cpu/armv7/exynos}/dmc_common.c             |    7 +-
 .../arm/cpu/armv7/exynos}/dmc_init_ddr3.c          |   27 +-
 arch/arm/cpu/armv7/exynos/dmc_init_exynos4.c       |  213 ++++++++++
 .../arm/cpu/armv7/exynos/exynos4_setup.h           |  397 +++++++++----------
 .../arm/cpu/armv7/exynos/exynos5_setup.h           |   28 +-
 arch/arm/cpu/armv7/exynos/lowlevel_init.c          |   73 ++++
 .../arm/cpu/armv7/exynos}/spl_boot.c               |   74 +++-
 arch/arm/include/asm/arch-exynos/cpu.h             |   13 +-
 board/samsung/origen/Makefile                      |   11 +-
 board/samsung/origen/lowlevel_init.S               |  357 -----------------
 board/samsung/origen/mem_setup.S                   |  421 --------------------
 board/samsung/origen/mmc_boot.c                    |   58 ---
 board/samsung/smdk5250/Makefile                    |   14 +-
 board/samsung/smdkv310/Makefile                    |   10 +-
 board/samsung/smdkv310/lowlevel_init.S             |  414 -------------------
 board/samsung/smdkv310/mem_setup.S                 |  365 -----------------
 board/samsung/smdkv310/mmc_boot.c                  |   60 ---
 include/configs/exynos5250-dt.h                    |    8 +-
 include/configs/origen.h                           |    8 +-
 include/configs/smdkv310.h                         |    7 +-
 25 files changed, 788 insertions(+), 1990 deletions(-)
 rename {board/samsung/smdk5250 => arch/arm/cpu/armv7/exynos}/clock_init.h (100%)
 create mode 100644 arch/arm/cpu/armv7/exynos/clock_init_exynos4.c
 rename board/samsung/smdk5250/clock_init.c => arch/arm/cpu/armv7/exynos/clock_init_exynos5.c (94%)
 create mode 100644 arch/arm/cpu/armv7/exynos/common_setup.h
 rename {board/samsung/smdk5250 => arch/arm/cpu/armv7/exynos}/dmc_common.c (97%)
 rename {board/samsung/smdk5250 => arch/arm/cpu/armv7/exynos}/dmc_init_ddr3.c (92%)
 create mode 100644 arch/arm/cpu/armv7/exynos/dmc_init_exynos4.c
 rename board/samsung/origen/origen_setup.h => arch/arm/cpu/armv7/exynos/exynos4_setup.h (65%)
 rename board/samsung/smdk5250/setup.h => arch/arm/cpu/armv7/exynos/exynos5_setup.h (96%)
 create mode 100644 arch/arm/cpu/armv7/exynos/lowlevel_init.c
 rename {board/samsung/smdk5250 => arch/arm/cpu/armv7/exynos}/spl_boot.c (74%)
 delete mode 100644 board/samsung/origen/lowlevel_init.S
 delete mode 100644 board/samsung/origen/mem_setup.S
 delete mode 100644 board/samsung/origen/mmc_boot.c
 delete mode 100644 board/samsung/smdkv310/lowlevel_init.S
 delete mode 100644 board/samsung/smdkv310/mem_setup.S
 delete mode 100644 board/samsung/smdkv310/mmc_boot.c
arch/arm/cpu/armv7/exynos/Makefile +13 -4
index b2f9152..4661155 100644
@@ -22,10 +22,19 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(SOC).o
 
-COBJS	+= clock.o power.o soc.o system.o pinmux.o tzpc.o
-
-SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
+COBJS-y	+= clock.o power.o soc.o system.o pinmux.o tzpc.o
+
+ifdef CONFIG_SPL_BUILD
+COBJS-$(CONFIG_EXYNOS5)	+= clock_init_exynos5.o
+COBJS-$(CONFIG_EXYNOS5)	+= dmc_common.o dmc_init_ddr3.o
+COBJS-$(CONFIG_EXYNOS4210)+= dmc_init_exynos4.o clock_init_exynos4.o
+COBJS-y	+= spl_boot.o
+COBJS-y	+= lowlevel_init.o
+endif
+
+COBJS   := $(COBJS-y)
+SRCS	:= $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS))
 
 all:	 $(obj).depend $(LIB)
 
arch/arm/cpu/armv7/exynos/clock_init.h renamed from board/samsung/smdk5250/clock_init.h +0 -0
similarity index 100%
rename from board/samsung/smdk5250/clock_init.h
rename to arch/arm/cpu/armv7/exynos/clock_init.h
arch/arm/cpu/armv7/exynos/clock_init_exynos4.c new file +95 -0

95 lines not on this page · raw message

arch/arm/cpu/armv7/exynos/clock_init_exynos5.c renamed from board/samsung/smdk5250/clock_init.c +28 -28

117 lines not on this page · raw message

arch/arm/cpu/armv7/exynos/common_setup.h new file +45 -0

45 lines not on this page · raw message

arch/arm/cpu/armv7/exynos/dmc_common.c renamed from board/samsung/smdk5250/dmc_common.c +4 -3
similarity index 97%
rename from board/samsung/smdk5250/dmc_common.c
rename to arch/arm/cpu/armv7/exynos/dmc_common.c
index 109602a..645f57e 100644
@@ -26,7 +26,8 @@
 #include <asm/arch/spl.h>
 
 #include "clock_init.h"
-#include "setup.h"
+#include "common_setup.h"
+#include "exynos5_setup.h"
 
 #define ZQ_INIT_TIMEOUT	10000
 
@@ -175,7 +176,7 @@ void dmc_config_memory(struct mem_timings *mem, struct exynos5_dmc *dmc)
 	writel(DMC_MEMBASECONFIG1_VAL, &dmc->membaseconfig1);
 }
 
-void mem_ctrl_init()
+void mem_ctrl_init(int reset)
 {
 	struct spl_machine_param *param = spl_get_machine_params();
 	struct mem_timings *mem;
@@ -185,7 +186,7 @@ void mem_ctrl_init()
 
 	/* If there are any other memory variant, add their init call below */
 	if (param->mem_type == DDR_MODE_DDR3) {
-		ret = ddr3_mem_ctrl_init(mem, param->mem_iv_size);
+		ret = ddr3_mem_ctrl_init(mem, param->mem_iv_size, reset);
 		if (ret) {
 			/* will hang if failed to init memory control */
 			while (1)
arch/arm/cpu/armv7/exynos/dmc_init_ddr3.c renamed from board/samsung/smdk5250/dmc_init_ddr3.c +16 -11
similarity index 92%
rename from board/samsung/smdk5250/dmc_init_ddr3.c
rename to arch/arm/cpu/armv7/exynos/dmc_init_ddr3.c
index e050790..e03d74b 100644
@@ -27,31 +27,36 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/dmc.h>
-#include "setup.h"
+#include "common_setup.h"
+#include "exynos5_setup.h"
 #include "clock_init.h"
 
 #define RDLVL_COMPLETE_TIMEOUT	10000
 
 static void reset_phy_ctrl(void)
 {
-	struct exynos5_clock *clk = (struct exynos5_clock *)EXYNOS5_CLOCK_BASE;
+	struct exynos5_clock *clk =
+		(struct exynos5_clock *)samsung_get_base_clock();
 
 	writel(DDR3PHY_CTRL_PHY_RESET_OFF, &clk->lpddr3phy_ctrl);
 	writel(DDR3PHY_CTRL_PHY_RESET, &clk->lpddr3phy_ctrl);
 }
 
-int ddr3_mem_ctrl_init(struct mem_timings *mem, unsigned long mem_iv_size)
+int ddr3_mem_ctrl_init(struct mem_timings *mem, unsigned long mem_iv_size,
+		       int reset)
 {
 	unsigned int val;
 	struct exynos5_phy_control *phy0_ctrl, *phy1_ctrl;
 	struct exynos5_dmc *dmc;
 	int i;
 
-	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;
+	phy0_ctrl = (struct exynos5_phy_control *)samsung_get_base_dmc_phy();
+	phy1_ctrl = (struct exynos5_phy_control *)(samsung_get_base_dmc_phy()
+							+ DMC_OFFSET);
+	dmc = (struct exynos5_dmc *)samsung_get_base_dmc_ctrl();
 
-	reset_phy_ctrl();
+	if (reset)
+		reset_phy_ctrl();
 
 	/* Set Impedance Output Driver */
 	val = (mem->impedance << CA_CK_DRVR_DS_OFFSET) |
@@ -100,14 +105,14 @@ int ddr3_mem_ctrl_init(struct mem_timings *mem, unsigned long mem_iv_size)
 
 	/* Start DLL locking */
 	writel(val | (mem->ctrl_start << PHY_CON12_CTRL_START_SHIFT),
-		&phy0_ctrl->phy_con12);
+	       &phy0_ctrl->phy_con12);
 	writel(val | (mem->ctrl_start << PHY_CON12_CTRL_START_SHIFT),
-		&phy1_ctrl->phy_con12);
+	       &phy1_ctrl->phy_con12);
 
 	update_reset_dll(dmc, DDR_MODE_DDR3);
 
 	writel(mem->concontrol | (mem->rd_fetch << CONCONTROL_RD_FETCH_SHIFT),
-		&dmc->concontrol);
+	       &dmc->concontrol);
 
 	/* Memory Channel Inteleaving Size */
 	writel(mem->iv_size, &dmc->ivcontrol);
@@ -119,7 +124,7 @@ int ddr3_mem_ctrl_init(struct mem_timings *mem, unsigned long mem_iv_size)
 
 	/* Precharge Configuration */
 	writel(mem->prechconfig_tp_cnt << PRECHCONFIG_TP_CNT_SHIFT,
-		&dmc->prechconfig);
+	       &dmc->prechconfig);
 
 	/* Power Down mode Configuration */
 	writel(mem->dpwrdn_cyc << PWRDNCONFIG_DPWRDN_CYC_SHIFT |
arch/arm/cpu/armv7/exynos/dmc_init_exynos4.c new file +213 -0

213 lines not on this page · raw message

arch/arm/cpu/armv7/exynos/exynos4_setup.h renamed from board/samsung/origen/origen_setup.h +192 -205

418 lines not on this page · raw message

arch/arm/cpu/armv7/exynos/exynos5_setup.h renamed from board/samsung/smdk5250/setup.h +13 -15
similarity index 96%
rename from board/samsung/smdk5250/setup.h
rename to arch/arm/cpu/armv7/exynos/exynos5_setup.h
index eb91d13..8f36c16 100644
@@ -93,17 +93,17 @@
 #define DMC_MEMCONTROL_MRR_BYTE_31_24   (3 << 25)
 
 /* MEMCONFIG0 register bit fields */
-#define DMC_MEMCONFIGx_CHIP_MAP_INTERLEAVED     (1 << 12)
-#define DMC_MEMCONFIGx_CHIP_COL_10              (3 << 8)
-#define DMC_MEMCONFIGx_CHIP_ROW_14              (2 << 4)
-#define DMC_MEMCONFIGx_CHIP_ROW_15              (3 << 4)
-#define DMC_MEMCONFIGx_CHIP_BANK_8              (3 << 0)
-
-#define DMC_MEMBASECONFIGx_CHIP_BASE(x)         (x << 16)
-#define DMC_MEMBASECONFIGx_CHIP_MASK(x)         (x << 0)
+#define DMC_MEMCONFIGX_CHIP_MAP_INTERLEAVED     (1 << 12)
+#define DMC_MEMCONFIGX_CHIP_COL_10              (3 << 8)
+#define DMC_MEMCONFIGX_CHIP_ROW_14              (2 << 4)
+#define DMC_MEMCONFIGX_CHIP_ROW_15              (3 << 4)
+#define DMC_MEMCONFIGX_CHIP_BANK_8              (3 << 0)
+
+#define DMC_MEMBASECONFIGX_CHIP_BASE(x)         (x << 16)
+#define DMC_MEMBASECONFIGX_CHIP_MASK(x)         (x << 0)
 #define DMC_MEMBASECONFIG_VAL(x)        (       \
-	DMC_MEMBASECONFIGx_CHIP_BASE(x) |       \
-	DMC_MEMBASECONFIGx_CHIP_MASK(0x780)     \
+	DMC_MEMBASECONFIGX_CHIP_BASE(x) |       \
+	DMC_MEMBASECONFIGX_CHIP_MASK(0x780)     \
 )
 
 #define DMC_MEMBASECONFIG0_VAL  DMC_MEMBASECONFIG_VAL(0x40)
@@ -513,9 +513,11 @@ enum {
  *			which the DMC uses to decide how to split a memory
  *			chunk into smaller chunks to support concurrent
  *			accesses; may vary across boards.
+ * @param reset         Reset DDR PHY during initialization.
  * @return 0 if ok, SETUP_ERR_... if there is a problem
  */
-int ddr3_mem_ctrl_init(struct mem_timings *mem, unsigned long mem_iv_size);
+int ddr3_mem_ctrl_init(struct mem_timings *mem, unsigned long mem_iv_size,
+			int reset);
 
 /*
  * Configure ZQ I/O interface
@@ -562,8 +564,4 @@ void dmc_config_memory(struct mem_timings *mem, struct exynos5_dmc *dmc);
  * @param ddr_mode	Type of DDR memory
  */
 void update_reset_dll(struct exynos5_dmc *, enum ddr_mode);
-
-void sdelay(unsigned long);
-void mem_ctrl_init(void);
-void system_clock_init(void);
 #endif
arch/arm/cpu/armv7/exynos/lowlevel_init.c new file +73 -0

73 lines not on this page · raw message

arch/arm/cpu/armv7/exynos/spl_boot.c renamed from board/samsung/smdk5250/spl_boot.c +63 -11

143 lines not on this page · raw message

arch/arm/include/asm/arch-exynos/cpu.h +7 -6
index 36b98c8..8685c42 100644
@@ -40,8 +40,7 @@
 #define EXYNOS4_WATCHDOG_BASE		0x10060000
 #define EXYNOS4_TZPC_BASE		0x10110000
 #define EXYNOS4_MIU_BASE		0x10600000
-#define EXYNOS4_DMC0_BASE		0x10400000
-#define EXYNOS4_DMC1_BASE		0x10410000
+#define EXYNOS4_DMC_CTRL_BASE		0x10400000
 #define EXYNOS4_GPIO_PART2_BASE		0x11000000
 #define EXYNOS4_GPIO_PART1_BASE		0x11400000
 #define EXYNOS4_FIMD_BASE		0x11C00000
@@ -64,6 +63,7 @@
 #define EXYNOS4_DP_BASE			DEVICE_NOT_AVAILABLE
 #define EXYNOS4_SPI_ISP_BASE		DEVICE_NOT_AVAILABLE
 #define EXYNOS4_ACE_SFR_BASE		DEVICE_NOT_AVAILABLE
+#define EXYNOS4_DMC_PHY_BASE		DEVICE_NOT_AVAILABLE
 
 /* EXYNOS4X12 */
 #define EXYNOS4X12_GPIO_PART3_BASE	0x03860000
@@ -76,8 +76,7 @@
 #define EXYNOS4X12_SYSTIMER_BASE	0x10050000
 #define EXYNOS4X12_WATCHDOG_BASE	0x10060000
 #define EXYNOS4X12_TZPC_BASE		0x10110000
-#define EXYNOS4X12_DMC0_BASE		0x10600000
-#define EXYNOS4X12_DMC1_BASE		0x10610000
+#define EXYNOS4X12_DMC_CTRL_BASE	0x10600000
 #define EXYNOS4X12_GPIO_PART4_BASE	0x106E0000
 #define EXYNOS4X12_GPIO_PART2_BASE	0x11000000
 #define EXYNOS4X12_GPIO_PART1_BASE	0x11400000
@@ -99,6 +98,7 @@
 #define EXYNOS4X12_SPI_BASE		DEVICE_NOT_AVAILABLE
 #define EXYNOS4X12_SPI_ISP_BASE		DEVICE_NOT_AVAILABLE
 #define EXYNOS4X12_ACE_SFR_BASE		DEVICE_NOT_AVAILABLE
+#define EXYNOS4X12_DMC_PHY_BASE		DEVICE_NOT_AVAILABLE
 
 /* EXYNOS5 Common*/
 #define EXYNOS5_I2C_SPACING		0x10000
@@ -112,8 +112,7 @@
 #define EXYNOS5_TZPC_BASE		0x10100000
 #define EXYNOS5_WATCHDOG_BASE		0x101D0000
 #define EXYNOS5_ACE_SFR_BASE            0x10830000
-#define EXYNOS5_DMC_PHY0_BASE		0x10C00000
-#define EXYNOS5_DMC_PHY1_BASE		0x10C10000
+#define EXYNOS5_DMC_PHY_BASE		0x10C00000
 #define EXYNOS5_GPIO_PART3_BASE		0x10D10000
 #define EXYNOS5_DMC_CTRL_BASE		0x10DD0000
 #define EXYNOS5_GPIO_PART1_BASE		0x11400000
@@ -237,6 +236,8 @@ SAMSUNG_BASE(power, POWER_BASE)
 SAMSUNG_BASE(spi, SPI_BASE)
 SAMSUNG_BASE(spi_isp, SPI_ISP_BASE)
 SAMSUNG_BASE(tzpc, TZPC_BASE)
+SAMSUNG_BASE(dmc_ctrl, DMC_CTRL_BASE)
+SAMSUNG_BASE(dmc_phy, DMC_PHY_BASE)
 #endif
 
 #endif	/* _EXYNOS4_CPU_H */
board/samsung/origen/Makefile +2 -9
index 3a885a5..63c8b46 100644
@@ -24,19 +24,12 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).o
 
-SOBJS	:= mem_setup.o
-SOBJS	+= lowlevel_init.o
-
 ifndef CONFIG_SPL_BUILD
 COBJS	+= origen.o
 endif
 
-ifdef CONFIG_SPL_BUILD
-COBJS	+= mmc_boot.o
-endif
-
-SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
+SRCS	:= $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS))
 
 ALL	+=$(obj).depend $(LIB)
 
board/samsung/origen/lowlevel_init.S deleted +0 -357

357 lines not on this page · raw message

board/samsung/origen/mem_setup.S deleted +0 -421

421 lines not on this page · raw message

board/samsung/origen/mmc_boot.c deleted +0 -58

58 lines not on this page · raw message

board/samsung/smdk5250/Makefile +3 -11
index f2c32ee..9412e37 100644
@@ -24,10 +24,6 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).o
 
-SOBJS	:= lowlevel_init.o
-
-COBJS	:= clock_init.o
-COBJS	+= dmc_common.o dmc_init_ddr3.o
 COBJS	+= smdk5250_spl.o
 
 ifndef CONFIG_SPL_BUILD
@@ -38,14 +34,10 @@ COBJS	+= smdk5250.o
 endif
 endif
 
-ifdef CONFIG_SPL_BUILD
-COBJS	+= spl_boot.o
-endif
-
-SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
+SRCS	:= $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS))
 
-ALL	:=	 $(obj).depend $(LIB)
+ALL	:= $(obj).depend $(LIB)
 
 all:	$(ALL)
 
board/samsung/smdkv310/Makefile +2 -8
index 56e0c16..c4cd0a3 100644
@@ -24,18 +24,12 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).o
 
-SOBJS	:= mem_setup.o
-SOBJS	+= lowlevel_init.o
 ifndef CONFIG_SPL_BUILD
 COBJS	+= smdkv310.o
 endif
 
-ifdef CONFIG_SPL_BUILD
-COBJS	+= mmc_boot.o
-endif
-
-SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
+SRCS	:= $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS))
 
 ALL	:=	 $(obj).depend $(LIB)
 
board/samsung/smdkv310/lowlevel_init.S deleted +0 -414

414 lines not on this page · raw message

board/samsung/smdkv310/mem_setup.S deleted +0 -365

365 lines not on this page · raw message

board/samsung/smdkv310/mmc_boot.c deleted +0 -60

1 line not on this page · raw message

include/configs/exynos5250-dt.h +6 -2
index 6c7a052..b32d1bd 100644

Lines of this file are not shown. View the raw message.

include/configs/origen.h +7 -1
index f71a463..5013aee 100644

Lines of this file are not shown. View the raw message.

include/configs/smdkv310.h +6 -1
index db78127..0f04597 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.4.4

Part of the diff is not shown here. View the raw message.

#5 lore raw

v4 cover EXYNOS: Convert Assembly code to c and make it common

In reply to Rajeshwari Shinde
Quoted 63 lines · Rajeshwari Shinde

Convert the assembly code in board/samsung to c and move the same to arch/arm. lds file made common across SMDKV310, Origen and SMDK5250.
Add the power reset and exit wakeup api for exynos.
Initialise GPIO for uart in Origen and SMDKV310 using pinmux.

Changes in V2:
- Rebased on latest u-boot-samsung tree.
- Incorporated review comments from Simon glass and Minkyu Kang.
Changes in V3:
- Optimised the mem_ctrl_init function for exynos4.
- Removed magic numbers.
Changes in V4:
- Used samsung_get_base api instead of hardcoding base address.

Rajeshwari Shinde (4):
EXYNOS: Add API for power reset and exit wakeup
EXYNOS: LDS file move to common
EXYNOS4210: Configure GPIO for uart
EXYNOS: Move files from board/samsung to arch/arm

 arch/arm/cpu/armv7/exynos/Makefile                 |   17 +-
 .../arm/cpu/armv7/exynos}/clock_init.h             |    0
 arch/arm/cpu/armv7/exynos/clock_init_exynos4.c     |   95 +++++
 .../arm/cpu/armv7/exynos/clock_init_exynos5.c      |   56 ++--
 arch/arm/cpu/armv7/exynos/common_setup.h           |   45 ++
 .../arm/cpu/armv7/exynos}/dmc_common.c             |    7 +-
 .../arm/cpu/armv7/exynos}/dmc_init_ddr3.c          |   27 +-
 arch/arm/cpu/armv7/exynos/dmc_init_exynos4.c       |  213 ++++++++++
 .../arm/cpu/armv7/exynos/exynos4_setup.h           |  397 +++++++++----------
 .../arm/cpu/armv7/exynos/exynos5_setup.h           |   28 +-
 arch/arm/cpu/armv7/exynos/lowlevel_init.c          |   73 ++++
 arch/arm/cpu/armv7/exynos/pinmux.c                 |   40 ++
 arch/arm/cpu/armv7/exynos/power.c                  |   50 +++
 .../arm/cpu/armv7/exynos}/spl_boot.c               |   74 +++-
 arch/arm/include/asm/arch-exynos/cpu.h             |   13 +-
 arch/arm/include/asm/arch-exynos/power.h           |   12 +
 .../exynos-uboot-spl.lds}                          |    0
 board/samsung/origen/Makefile                      |   11 +-
 board/samsung/origen/lowlevel_init.S               |  357 -----------------
 board/samsung/origen/mem_setup.S                   |  421 --------------------
 board/samsung/origen/mmc_boot.c                    |   58 ---
 board/samsung/origen/origen.c                      |   46 +++
 board/samsung/smdk5250/Makefile                    |   14 +-
 board/samsung/smdkv310/Makefile                    |   10 +-
 board/samsung/smdkv310/lowlevel_init.S             |  414 -------------------
 board/samsung/smdkv310/mem_setup.S                 |  365 -----------------
 board/samsung/smdkv310/mmc_boot.c                  |   60 ---
 board/samsung/smdkv310/smdkv310.c                  |   46 +++
 include/configs/exynos5250-dt.h                    |   10 +-
 include/configs/origen.h                           |    9 +-
 include/configs/smdkv310.h                         |    8 +-
 31 files changed, 985 insertions(+), 1991 deletions(-)
 rename {board/samsung/smdk5250 => arch/arm/cpu/armv7/exynos}/clock_init.h (100%)
 create mode 100644 arch/arm/cpu/armv7/exynos/clock_init_exynos4.c
 rename board/samsung/smdk5250/clock_init.c => arch/arm/cpu/armv7/exynos/clock_init_exynos5.c (94%)
 create mode 100644 arch/arm/cpu/armv7/exynos/common_setup.h
 rename {board/samsung/smdk5250 => arch/arm/cpu/armv7/exynos}/dmc_common.c (97%)
 rename {board/samsung/smdk5250 => arch/arm/cpu/armv7/exynos}/dmc_init_ddr3.c (92%)
 create mode 100644 arch/arm/cpu/armv7/exynos/dmc_init_exynos4.c
 rename board/samsung/origen/origen_setup.h => arch/arm/cpu/armv7/exynos/exynos4_setup.h (65%)
 rename board/samsung/smdk5250/setup.h => arch/arm/cpu/armv7/exynos/exynos5_setup.h (96%)
 create mode 100644 arch/arm/cpu/armv7/exynos/lowlevel_init.c
Quoted 9 lines
 rename {board/samsung/smdk5250 => arch/arm/cpu/armv7/exynos}/spl_boot.c (74%)
 rename board/samsung/{smdk5250/smdk5250-uboot-spl.lds => common/exynos-uboot-spl.lds} (100%)
 delete mode 100644 board/samsung/origen/lowlevel_init.S
 delete mode 100644 board/samsung/origen/mem_setup.S
 delete mode 100644 board/samsung/origen/mmc_boot.c
 delete mode 100644 board/samsung/smdkv310/lowlevel_init.S
 delete mode 100644 board/samsung/smdkv310/mem_setup.S
 delete mode 100644 board/samsung/smdkv310/mmc_boot.c

applied to u-boot-samsung.

Thanks,
Minkyu Kang.