Skip to contentSkip to conversation

Exynos5: spl: Reduce spl size

PATCH New Akshay Saraswat 2 participants 4 messages Mar 6, 2013 – Mar 8, 2013 Arm/actions semi architecture

lore
Share & tools
lore
#0 lore raw

v3 cover Exynos5: spl: Reduce spl size

This patch set tries to gain some space in spl by restructuring and reorganising some code in two different clock init's for two different times of execution.

Compiler arm-2011.09:
With patches u-boot-spl.bin size - 3900 bytes. Without patches u-boot-spl.bin size - 4924 bytes.

Compiler arm-2009q3:
With patches u-boot-spl.bin size - 4412 bytes. Without patches u-boot-spl.bin size - 5692 bytes.

Changes since v1:
- Patch1: Rebased on ToT.
- Patch2: Rebased on ToT.

Changes since v2:
- Patch1:
- Replaced non_spl_clock_div with clock_div.
- Replaced ns_clk_div with clk_div.
- Added few new comments.
- Modified few comments.
- Patch2: None.

Akshay Saraswat (2):
Exynos5: spl: Reorganize mem_timing struct to gain space in spl
Exynos5: spl: Reduce clock init in spl

 board/samsung/smdk5250/Makefile         |   3 +-
 board/samsung/smdk5250/clock_init.c     | 493 +-------------------------------
 board/samsung/smdk5250/clock_init.h     |  76 +++--
 board/samsung/smdk5250/dmc_common.c     |  40 +--
 board/samsung/smdk5250/dmc_init_ddr3.c  | 116 ++++----
 board/samsung/smdk5250/lowlevel_init.S  |   4 +-
 board/samsung/smdk5250/setup.h          |  16 +-
 board/samsung/smdk5250/smdk5250.c       |   4 +
 board/samsung/smdk5250/spl_clock_init.c | 469 ++++++++++++++++++++++++++++++
 9 files changed, 641 insertions(+), 580 deletions(-)
 create mode 100644 board/samsung/smdk5250/spl_clock_init.c
Signature · 1 line
1.8.0
#1 lore raw

PATCH v3 1/2 Exynos5: spl: Reorganize mem_timing struct to gain space in spl

Distributes struct mem_timings into new different structures to gain space in spl by removing necessity of maintaining two big and almost similar mem_timings instances.

---
Changes since v1:
- None.

Changes since v2:
- Replaced non_spl_clock_div with clock_div.
- Replaced ns_clk_div with clk_div.
- Added few new comments.
- Modified few comments.

 board/samsung/smdk5250/clock_init.c    | 177 ++++++++++++---------------------
 board/samsung/smdk5250/clock_init.h    |  74 ++++++++++----
 board/samsung/smdk5250/dmc_common.c    |  40 ++++----
 board/samsung/smdk5250/dmc_init_ddr3.c | 116 +++++++++++----------
 board/samsung/smdk5250/setup.h         |  15 ++-
 5 files changed, 211 insertions(+), 211 deletions(-)
board/samsung/smdk5250/clock_init.c +64 -113
index c009ae5..2a07f44 100644
@@ -127,14 +127,17 @@ struct arm_clk_ratios arm_clk_ratios[] = {
 		.arm_ratio = 0x0,
 	}
 };
-struct mem_timings mem_timings[] = {
-	{
-		.mem_manuf = MEM_MANUF_ELPIDA,
-		.mem_type = DDR_MODE_DDR3,
-		.frequency_mhz = 800,
+
+struct spl_clock_div spl_clock_div = {
 		.mpll_mdiv = 0xc8,
 		.mpll_pdiv = 0x3,
 		.mpll_sdiv = 0x0,
+		.bpll_mdiv = 0x64,
+		.bpll_pdiv = 0x3,
+		.bpll_sdiv = 0x0,
+};
+
+struct clock_div clock_div = {
 		.cpll_mdiv = 0xde,
 		.cpll_pdiv = 0x4,
 		.cpll_sdiv = 0x2,
@@ -147,14 +150,10 @@ struct mem_timings mem_timings[] = {
 		.vpll_mdiv = 0x96,
 		.vpll_pdiv = 0x3,
 		.vpll_sdiv = 0x2,
+};
 
-		.bpll_mdiv = 0x64,
-		.bpll_pdiv = 0x3,
-		.bpll_sdiv = 0x0,
+struct mem_timings mem_timings = {
 		.pclk_cdrex_ratio = 0x5,
-		.direct_cmd_msr = {
-			0x00020018, 0x00030000, 0x00010042, 0x00000d70
-		},
 		.timing_ref = 0x000000bb,
 		.timing_row = 0x8c36650e,
 		.timing_data = 0x3630580b,
@@ -163,8 +162,6 @@ struct mem_timings mem_timings[] = {
 		.phy1_dqs = 0x08080808,
 		.phy0_dq = 0x08080808,
 		.phy1_dq = 0x08080808,
-		.phy0_tFS = 0x4,
-		.phy1_tFS = 0x4,
 		.phy0_pulld_dqs = 0xf,
 		.phy1_pulld_dqs = 0xf,
 
@@ -186,10 +183,6 @@ struct mem_timings mem_timings[] = {
 
 		.rd_fetch = 0x3,
 
-		.zq_mode_dds = 0x7,
-		.zq_mode_term = 0x1,
-		.zq_mode_noterm = 0,
-
 		/*
 		* Dynamic Clock: Always Running
 		* Memory Burst length: 8
@@ -229,114 +222,49 @@ struct mem_timings mem_timings[] = {
 		.chips_per_channel = 2,
 		.chips_to_configure = 1,
 		.send_zq_init = 1,
+};
+
+struct mem_params mem_params[] = {
+	{
+		.mem_manuf = MEM_MANUF_ELPIDA,
+		.mem_type = DDR_MODE_DDR3,
+		.frequency_mhz = 800,
+
+		.direct_cmd_msr = {
+			0x00020018, 0x00030000, 0x00010042, 0x00000d70
+		},
+
+		.phy0_tFS = 0x4,
+		.phy1_tFS = 0x4,
+
+		.zq_mode_dds = 0x7,
+		.zq_mode_term = 0x1,
+		.zq_mode_noterm = 0,
+
 		.impedance = IMP_OUTPUT_DRV_30_OHM,
 		.gate_leveling_enable = 0,
 	}, {
 		.mem_manuf = MEM_MANUF_SAMSUNG,
 		.mem_type = DDR_MODE_DDR3,
 		.frequency_mhz = 800,
-		.mpll_mdiv = 0xc8,
-		.mpll_pdiv = 0x3,
-		.mpll_sdiv = 0x0,
-		.cpll_mdiv = 0xde,
-		.cpll_pdiv = 0x4,
-		.cpll_sdiv = 0x2,
-		.gpll_mdiv = 0x215,
-		.gpll_pdiv = 0xc,
-		.gpll_sdiv = 0x1,
-		.epll_mdiv = 0x60,
-		.epll_pdiv = 0x3,
-		.epll_sdiv = 0x3,
-		.vpll_mdiv = 0x96,
-		.vpll_pdiv = 0x3,
-		.vpll_sdiv = 0x2,
 
-		.bpll_mdiv = 0x64,
-		.bpll_pdiv = 0x3,
-		.bpll_sdiv = 0x0,
-		.pclk_cdrex_ratio = 0x5,
 		.direct_cmd_msr = {
 			0x00020018, 0x00030000, 0x00010000, 0x00000d70
 		},
-		.timing_ref = 0x000000bb,
-		.timing_row = 0x8c36650e,
-		.timing_data = 0x3630580b,
-		.timing_power = 0x41000a44,
-		.phy0_dqs = 0x08080808,
-		.phy1_dqs = 0x08080808,
-		.phy0_dq = 0x08080808,
-		.phy1_dq = 0x08080808,
+
 		.phy0_tFS = 0x8,
 		.phy1_tFS = 0x8,
-		.phy0_pulld_dqs = 0xf,
-		.phy1_pulld_dqs = 0xf,
-
-		.lpddr3_ctrl_phy_reset = 0x1,
-		.ctrl_start_point = 0x10,
-		.ctrl_inc = 0x10,
-		.ctrl_start = 0x1,
-		.ctrl_dll_on = 0x1,
-		.ctrl_ref = 0x8,
-
-		.ctrl_force = 0x1a,
-		.ctrl_rdlat = 0x0b,
-		.ctrl_bstlen = 0x08,
-
-		.fp_resync = 0x8,
-		.iv_size = 0x7,
-		.dfi_init_start = 1,
-		.aref_en = 1,
-
-		.rd_fetch = 0x3,
 
 		.zq_mode_dds = 0x5,
 		.zq_mode_term = 0x1,
 		.zq_mode_noterm = 1,
 
-		/*
-		* Dynamic Clock: Always Running
-		* Memory Burst length: 8
-		* Number of chips: 1
-		* Memory Bus width: 32 bit
-		* Memory Type: DDR3
-		* Additional Latancy for PLL: 0 Cycle
-		*/
-		.memcontrol = DMC_MEMCONTROL_CLK_STOP_DISABLE |
-			DMC_MEMCONTROL_DPWRDN_DISABLE |
-			DMC_MEMCONTROL_DPWRDN_ACTIVE_PRECHARGE |
-			DMC_MEMCONTROL_TP_DISABLE |
-			DMC_MEMCONTROL_DSREF_ENABLE |
-			DMC_MEMCONTROL_ADD_LAT_PALL_CYCLE(0) |
-			DMC_MEMCONTROL_MEM_TYPE_DDR3 |
-			DMC_MEMCONTROL_MEM_WIDTH_32BIT |
-			DMC_MEMCONTROL_NUM_CHIP_1 |
-			DMC_MEMCONTROL_BL_8 |
-			DMC_MEMCONTROL_PZQ_DISABLE |
-			DMC_MEMCONTROL_MRR_BYTE_7_0,
-		.memconfig = DMC_MEMCONFIGx_CHIP_MAP_INTERLEAVED |
-			DMC_MEMCONFIGx_CHIP_COL_10 |
-			DMC_MEMCONFIGx_CHIP_ROW_15 |
-			DMC_MEMCONFIGx_CHIP_BANK_8,
-		.membaseconfig0 = DMC_MEMBASECONFIG_VAL(0x40),
-		.membaseconfig1 = DMC_MEMBASECONFIG_VAL(0x80),
-		.prechconfig_tp_cnt = 0xff,
-		.dpwrdn_cyc = 0xff,
-		.dsref_cyc = 0xffff,
-		.concontrol = DMC_CONCONTROL_DFI_INIT_START_DISABLE |
-			DMC_CONCONTROL_TIMEOUT_LEVEL0 |
-			DMC_CONCONTROL_RD_FETCH_DISABLE |
-			DMC_CONCONTROL_EMPTY_DISABLE |
-			DMC_CONCONTROL_AREF_EN_DISABLE |
-			DMC_CONCONTROL_IO_PD_CON_DISABLE,
-		.dmc_channels = 2,
-		.chips_per_channel = 2,
-		.chips_to_configure = 1,
-		.send_zq_init = 1,
 		.impedance = IMP_OUTPUT_DRV_40_OHM,
 		.gate_leveling_enable = 1,
 	}
 };
 
+
 /**
  * Get the required memory type and speed (SPL version).
  *
@@ -388,9 +316,24 @@ struct arm_clk_ratios *get_arm_ratios(void)
 	return NULL;
 }
 
+struct spl_clock_div *clock_get_spl_div(void)
+{
+	return &spl_clock_div;
+}
+
+struct clock_div *clock_get_div(void)
+{
+	return &clock_div;
+}
+
 struct mem_timings *clock_get_mem_timings(void)
 {
-	struct mem_timings *mem;
+	return &mem_timings;
+}
+
+struct mem_params *clock_get_mem_params(void)
+{
+	struct mem_params *mem;
 	enum ddr_mode mem_type;
 	enum mem_manuf mem_manuf;
 	unsigned frequency_mhz, arm_freq;
@@ -398,7 +341,7 @@ struct mem_timings *clock_get_mem_timings(void)
 
 	if (!clock_get_mem_selection(&mem_type, &frequency_mhz,
 						&arm_freq, &mem_manuf)) {
-		for (i = 0, mem = mem_timings; i < ARRAY_SIZE(mem_timings);
+		for (i = 0, mem = mem_params; i < ARRAY_SIZE(mem_params);
 				i++, mem++) {
 			if (mem->mem_type == mem_type &&
 					mem->frequency_mhz == frequency_mhz &&
@@ -417,12 +360,14 @@ struct mem_timings *clock_get_mem_timings(void)
 void system_clock_init()
 {
 	struct exynos5_clock *clk = (struct exynos5_clock *)EXYNOS5_CLOCK_BASE;
-	struct mem_timings *mem;
 	struct arm_clk_ratios *arm_clk_ratio;
+	struct spl_clock_div *s_clk_div;
+	struct clock_div *clk_div;
 	u32 val, tmp;
 
-	mem = clock_get_mem_timings();
 	arm_clk_ratio = get_arm_ratios();
+	s_clk_div = clock_get_spl_div();
+	clk_div = clock_get_div();
 
 	clrbits_le32(&clk->src_cpu, MUX_APLL_SEL_MASK);
 	do {
@@ -499,28 +444,32 @@ void system_clock_init()
 
 	/* Set MPLL */
 	writel(MPLL_CON1_VAL, &clk->mpll_con1);
-	val = set_pll(mem->mpll_mdiv, mem->mpll_pdiv, mem->mpll_sdiv);
+	val = set_pll(s_clk_div->mpll_mdiv,
+				s_clk_div->mpll_pdiv, s_clk_div->mpll_sdiv);
 	writel(val, &clk->mpll_con0);
 	while (readl(&clk->mpll_con0) & MPLL_CON0_LOCKED)
 		;
 
 	/* Set BPLL */
 	writel(BPLL_CON1_VAL, &clk->bpll_con1);
-	val = set_pll(mem->bpll_mdiv, mem->bpll_pdiv, mem->bpll_sdiv);
+	val = set_pll(s_clk_div->bpll_mdiv,
+				s_clk_div->bpll_pdiv, s_clk_div->bpll_sdiv);
 	writel(val, &clk->bpll_con0);
 	while (readl(&clk->bpll_con0) & BPLL_CON0_LOCKED)
 		;
 
 	/* Set CPLL */
 	writel(CPLL_CON1_VAL, &clk->cpll_con1);
-	val = set_pll(mem->cpll_mdiv, mem->cpll_pdiv, mem->cpll_sdiv);
+	val = set_pll(clk_div->cpll_mdiv,
+				clk_div->cpll_pdiv, clk_div->cpll_sdiv);
 	writel(val, &clk->cpll_con0);
 	while (readl(&clk->cpll_con0) & CPLL_CON0_LOCKED)
 		;
 
 	/* Set GPLL */
 	writel(GPLL_CON1_VAL, &clk->gpll_con1);
-	val = set_pll(mem->gpll_mdiv, mem->gpll_pdiv, mem->gpll_sdiv);
+	val = set_pll(clk_div->gpll_mdiv,
+				clk_div->gpll_pdiv, clk_div->gpll_sdiv);
 	writel(val, &clk->gpll_con0);
 	while (readl(&clk->gpll_con0) & GPLL_CON0_LOCKED)
 		;
@@ -528,7 +477,8 @@ void system_clock_init()
 	/* Set EPLL */
 	writel(EPLL_CON2_VAL, &clk->epll_con2);
 	writel(EPLL_CON1_VAL, &clk->epll_con1);
-	val = set_pll(mem->epll_mdiv, mem->epll_pdiv, mem->epll_sdiv);
+	val = set_pll(clk_div->epll_mdiv,
+				clk_div->epll_pdiv, clk_div->epll_sdiv);
 	writel(val, &clk->epll_con0);
 	while (readl(&clk->epll_con0) & EPLL_CON0_LOCKED)
 		;
@@ -536,7 +486,8 @@ void system_clock_init()
 	/* Set VPLL */
 	writel(VPLL_CON2_VAL, &clk->vpll_con2);
 	writel(VPLL_CON1_VAL, &clk->vpll_con1);
-	val = set_pll(mem->vpll_mdiv, mem->vpll_pdiv, mem->vpll_sdiv);
+	val = set_pll(clk_div->vpll_mdiv,
+				clk_div->vpll_pdiv, clk_div->vpll_sdiv);
 	writel(val, &clk->vpll_con0);
 	while (readl(&clk->vpll_con0) & VPLL_CON0_LOCKED)
 		;
board/samsung/smdk5250/clock_init.h +54 -20

119 lines not on this page · raw message

board/samsung/smdk5250/dmc_common.c +22 -18
index 109602a..1166cb7 100644
@@ -30,7 +30,7 @@
 
 #define ZQ_INIT_TIMEOUT	10000
 
-int dmc_config_zq(struct mem_timings *mem,
+int dmc_config_zq(struct mem_params *mparams,
 		  struct exynos5_phy_control *phy0_ctrl,
 		  struct exynos5_phy_control *phy1_ctrl)
 {
@@ -43,14 +43,14 @@ int dmc_config_zq(struct mem_timings *mem,
 	 * long calibration for manual calibration
 	 */
 	val = PHY_CON16_RESET_VAL;
-	val |= mem->zq_mode_dds << PHY_CON16_ZQ_MODE_DDS_SHIFT;
-	val |= mem->zq_mode_term << PHY_CON16_ZQ_MODE_TERM_SHIFT;
+	val |= mparams->zq_mode_dds << PHY_CON16_ZQ_MODE_DDS_SHIFT;
+	val |= mparams->zq_mode_term << PHY_CON16_ZQ_MODE_TERM_SHIFT;
 	val |= ZQ_CLK_DIV_EN;
 	writel(val, &phy0_ctrl->phy_con16);
 	writel(val, &phy1_ctrl->phy_con16);
 
 	/* Disable termination */
-	if (mem->zq_mode_noterm)
+	if (mparams->zq_mode_noterm)
 		val |= PHY_CON16_ZQ_MODE_NOTERM_MASK;
 	writel(val, &phy0_ctrl->phy_con16);
 	writel(val, &phy1_ctrl->phy_con16);
@@ -108,15 +108,17 @@ void update_reset_dll(struct exynos5_dmc *dmc, enum ddr_mode mode)
 	writel(val, &dmc->phycontrol0);
 }
 
-void dmc_config_mrs(struct mem_timings *mem, struct exynos5_dmc *dmc)
+void dmc_config_mrs(struct mem_timings *mtimings,
+			struct mem_params *mparams,
+			struct exynos5_dmc *dmc)
 {
 	int channel, chip;
 
-	for (channel = 0; channel < mem->dmc_channels; channel++) {
+	for (channel = 0; channel < mtimings->dmc_channels; channel++) {
 		unsigned long mask;
 
 		mask = channel << DIRECT_CMD_CHANNEL_SHIFT;
-		for (chip = 0; chip < mem->chips_to_configure; chip++) {
+		for (chip = 0; chip < mtimings->chips_to_configure; chip++) {
 			int i;
 
 			mask |= chip << DIRECT_CMD_CHIP_SHIFT;
@@ -133,12 +135,12 @@ void dmc_config_mrs(struct mem_timings *mem, struct exynos5_dmc *dmc)
 
 			/* Sending EMRS/MRS commands */
 			for (i = 0; i < MEM_TIMINGS_MSR_COUNT; i++) {
-				writel(mem->direct_cmd_msr[i] | mask,
+				writel(mparams->direct_cmd_msr[i] | mask,
 				       &dmc->directcmd);
 				sdelay(0x10000);
 			}
 
-			if (mem->send_zq_init) {
+			if (mtimings->send_zq_init) {
 				/* Sending ZQINIT command */
 				writel(DIRECT_CMD_ZQINIT | mask,
 				       &dmc->directcmd);
@@ -149,15 +151,15 @@ void dmc_config_mrs(struct mem_timings *mem, struct exynos5_dmc *dmc)
 	}
 }
 
-void dmc_config_prech(struct mem_timings *mem, struct exynos5_dmc *dmc)
+void dmc_config_prech(struct mem_timings *mtimings, struct exynos5_dmc *dmc)
 {
 	int channel, chip;
 
-	for (channel = 0; channel < mem->dmc_channels; channel++) {
+	for (channel = 0; channel < mtimings->dmc_channels; channel++) {
 		unsigned long mask;
 
 		mask = channel << DIRECT_CMD_CHANNEL_SHIFT;
-		for (chip = 0; chip < mem->chips_per_channel; chip++) {
+		for (chip = 0; chip < mtimings->chips_per_channel; chip++) {
 			mask |= chip << DIRECT_CMD_CHIP_SHIFT;
 
 			/* PALL (all banks precharge) CMD */
@@ -167,10 +169,10 @@ void dmc_config_prech(struct mem_timings *mem, struct exynos5_dmc *dmc)
 	}
 }
 
-void dmc_config_memory(struct mem_timings *mem, struct exynos5_dmc *dmc)
+void dmc_config_memory(struct mem_timings *mtimings, struct exynos5_dmc *dmc)
 {
-	writel(mem->memconfig, &dmc->memconfig0);
-	writel(mem->memconfig, &dmc->memconfig1);
+	writel(mtimings->memconfig, &dmc->memconfig0);
+	writel(mtimings->memconfig, &dmc->memconfig1);
 	writel(DMC_MEMBASECONFIG0_VAL, &dmc->membaseconfig0);
 	writel(DMC_MEMBASECONFIG1_VAL, &dmc->membaseconfig1);
 }
@@ -178,14 +180,16 @@ void dmc_config_memory(struct mem_timings *mem, struct exynos5_dmc *dmc)
 void mem_ctrl_init()
 {
 	struct spl_machine_param *param = spl_get_machine_params();
-	struct mem_timings *mem;
+	struct mem_timings *mtimings;
+	struct mem_params *mparams;
 	int ret;
 
-	mem = clock_get_mem_timings();
+	mtimings = clock_get_mem_timings();
+	mparams = clock_get_mem_params();
 
 	/* 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(mtimings, mparams, param->mem_iv_size);
 		if (ret) {
 			/* will hang if failed to init memory control */
 			while (1)
board/samsung/smdk5250/dmc_init_ddr3.c +61 -55

198 lines not on this page · raw message

board/samsung/smdk5250/setup.h +10 -5
index a159601..b30d7d0 100644
@@ -521,6 +521,7 @@
 #define PHY_CON42_CTRL_RDLAT_SHIFT	0
 
 struct mem_timings;
+struct mem_params;
 
 /* Errors that we can encourter in low-level setup */
 enum {
@@ -539,7 +540,9 @@ enum {
  *			accesses; may vary across boards.
  * @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 *mtimings,
+			struct mem_params *mparams,
+			unsigned long mem_iv_size);
 
 /*
  * Configure ZQ I/O interface
@@ -549,7 +552,7 @@ int ddr3_mem_ctrl_init(struct mem_timings *mem, unsigned long mem_iv_size);
  * @param phy1_ctrl	Pointer to struct containing PHY1 control reg
  * @return 0 if ok, -1 on error
  */
-int dmc_config_zq(struct mem_timings *mem,
+int dmc_config_zq(struct mem_params *mparams,
 		  struct exynos5_phy_control *phy0_ctrl,
 		  struct exynos5_phy_control *phy1_ctrl);
 
@@ -559,7 +562,9 @@ int dmc_config_zq(struct mem_timings *mem,
  * @param mem		Memory timings for this memory type.
  * @param dmc		Pointer to struct of DMC registers
  */
-void dmc_config_mrs(struct mem_timings *mem, struct exynos5_dmc *dmc);
+void dmc_config_mrs(struct mem_timings *mtimings,
+			struct mem_params *mparams,
+			struct exynos5_dmc *dmc);
 
 /*
  * Send PALL Direct commands
@@ -567,7 +572,7 @@ void dmc_config_mrs(struct mem_timings *mem, struct exynos5_dmc *dmc);
  * @param mem		Memory timings for this memory type.
  * @param dmc		Pointer to struct of DMC registers
  */
-void dmc_config_prech(struct mem_timings *mem, struct exynos5_dmc *dmc);
+void dmc_config_prech(struct mem_timings *mtimings, struct exynos5_dmc *dmc);
 
 /*
  * Configure the memconfig and membaseconfig registers
@@ -575,7 +580,7 @@ void dmc_config_prech(struct mem_timings *mem, struct exynos5_dmc *dmc);
  * @param mem		Memory timings for this memory type.
  * @param exynos5_dmc	Pointer to struct of DMC registers
  */
-void dmc_config_memory(struct mem_timings *mem, struct exynos5_dmc *dmc);
+void dmc_config_memory(struct mem_timings *mtimings, struct exynos5_dmc *dmc);
 
 /*
  * Reset the DLL. This function is common between DDR3 and LPDDR2.
Signature · 1 line
1.8.0
#2 lore raw

PATCH v3 1/2 Exynos5: spl: Reorganize mem_timing struct to gain space in spl

Hi Akshay,

Quoted 15 lines · Akshay Saraswat

Distributes struct mem_timings into new different structures to gain space in spl by removing necessity of maintaining two big and almost similar mem_timings instances.

---
Changes since v1:
- None.

Changes since v2:
- Replaced non_spl_clock_div with clock_div.
- Replaced ns_clk_div with clk_div.
- Added few new comments.
- Modified few comments.

Quoted 6 lines
 board/samsung/smdk5250/clock_init.c    | 177 ++++++++++++---------------------
 board/samsung/smdk5250/clock_init.h    |  74 ++++++++++----
 board/samsung/smdk5250/dmc_common.c    |  40 ++++----
 board/samsung/smdk5250/dmc_init_ddr3.c | 116 +++++++++++----------
 board/samsung/smdk5250/setup.h         |  15 ++-
 5 files changed, 211 insertions(+), 211 deletions(-)

Is it possible to move the non-spl code into a separate file? I think it would be better if SPL includes one clock_init (memory, boot peripheral) and U-Boot includes the other, and that there is nothing in common. Would that work?

Regards,
Simon

#3 lore raw

PATCH v3 2/2 Exynos5: spl: Reduce clock init in spl

In reply to Akshay Saraswat

This patch subtracts a part of clock init from spl and executes it after relocation. spl_clock_init executes in spl and system_clock_init executes after relocation in u-boot. This is done to gain some space by removing initially not necessary code.

---
Changes since v1:
- Rebased on ToT.

Changes since v2:
- None.

 board/samsung/smdk5250/Makefile         |   3 +-
 board/samsung/smdk5250/clock_init.c     | 428 +----------------------------
 board/samsung/smdk5250/clock_init.h     |   2 +
 board/samsung/smdk5250/lowlevel_init.S  |   4 +-
 board/samsung/smdk5250/setup.h          |   1 +
 board/samsung/smdk5250/smdk5250.c       |   4 +
 board/samsung/smdk5250/spl_clock_init.c | 469 ++++++++++++++++++++++++++++++++
 7 files changed, 481 insertions(+), 430 deletions(-)
 create mode 100644 board/samsung/smdk5250/spl_clock_init.c
board/samsung/smdk5250/Makefile +2 -1
index 47c6a5a..3ceb7e2 100644
@@ -26,12 +26,13 @@ LIB	= $(obj)lib$(BOARD).o
 
 SOBJS	:= lowlevel_init.o
 
-COBJS	:= clock_init.o
+COBJS	:= spl_clock_init.o
 COBJS	+= dmc_common.o dmc_init_ddr3.o
 COBJS	+= tzpc_init.o
 COBJS	+= smdk5250_spl.o
 
 ifndef CONFIG_SPL_BUILD
+COBJS	+= clock_init.o
 COBJS	+= smdk5250.o
 endif
 
board/samsung/smdk5250/clock_init.c +1 -427

478 lines not on this page · raw message

board/samsung/smdk5250/clock_init.h +2 -0
index ae68333..a6fc801 100644
@@ -179,5 +179,7 @@ struct mem_params *clock_get_mem_params(void);
 /*
  * Initialize clock for the device
  */
+void spl_clock_init(void);
+
 void system_clock_init(void);
 #endif
board/samsung/smdk5250/lowlevel_init.S +2 -2
index bc6cb6f..1e69c02 100644
@@ -69,7 +69,7 @@ lowlevel_init:
 	beq	1f			/* r0 == r1 then skip sdram init */
 
 	/* init system clock */
-	bl	system_clock_init
+	bl	spl_clock_init
 
 	/* Memory initialize */
 	bl	mem_ctrl_init
@@ -79,7 +79,7 @@ lowlevel_init:
 	ldmia	r13!, {ip,pc}
 
 wakeup_reset:
-	bl	system_clock_init
+	bl	spl_clock_init
 	bl	mem_ctrl_init
 	bl	tzpc_init
 
board/samsung/smdk5250/setup.h +1 -0
index b30d7d0..074219f 100644
@@ -595,5 +595,6 @@ void update_reset_dll(struct exynos5_dmc *, enum ddr_mode);
 void sdelay(unsigned long);
 void mem_ctrl_init(void);
 void system_clock_init(void);
+void spl_clock_init(void);
 void tzpc_init(void);
 #endif
board/samsung/smdk5250/smdk5250.c +4 -0
index ffc5ee5..b6e611c 100644
@@ -29,6 +29,7 @@
 #include <netdev.h>
 #include <spi.h>
 #include <asm/arch/cpu.h>
+#include <asm/arch/dmc.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/mmc.h>
 #include <asm/arch/pinmux.h>
@@ -37,6 +38,7 @@
 #include <asm/arch/dp_info.h>
 #include <power/pmic.h>
 #include <power/max77686_pmic.h>
+#include "clock_init.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -378,6 +380,8 @@ static int board_uart_init(void)
 int board_early_init_f(void)
 {
 	int err;
+
+	system_clock_init();
 	err = board_uart_init();
 	if (err) {
 		debug("UART init failed\n");
board/samsung/smdk5250/spl_clock_init.c new file +469 -0

469 lines not on this page · raw message

Signature · 1 line
1.8.0