Skip to contentSkip to conversation

Exynos4412 SPL support

PATCH New Simon Shields 3 participants 14 messages Sep 12, 2018 – Oct 29, 2018

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

cover Exynos4412 SPL support

Hi,

This patch series adds support for using U-Boot's SPL as the second stage bootloader ("BL2") on Exynos4412 SoCs.

- Patch #1 adds support for the EMMC/SD OM pin configuration, which is used by the boards I tested on.
- Patch #2 configures the magic values used to indicate system suspend state (which are identical to exynos5).
- Patch #3 renames the existing exynos4 clock/dmc initialisation code to reflect the fact that it only supports exynos4210.
- Patches #4 and #5 add/fill in structs reflecting the PMU and TZASC register layouts on exynos4412, respectively.
- Patch #6 adds the exynos4412 DMC and clock initialisation code and enables building the SPL on exynos4412 platforms.
- Patch #7 enables building the "mkexynosspl" utility for exynos4 SoCs.

The majority of the logic in patch #6 comes from a vendor u-boot dump (2010.12!), however, small portions (mostly code used for 2GB RAM initialisation) were reverse engineered from the vendor bootloader found on a GT-N7100.

This patch series has been tested on a GT-I9300 (exynos4412, 1GB RAM) and a GT-N7100 (exynos4412 prime, 2GB RAM), with a few additional patchsets applied for board/HW support (which I intend to upstream in the future).

Cheers,
Simon

Simon Shields (7):
ARM: exynos: spl: add EMMC/SD boot mode support
exynos4: configure power down magic values
ARM: exynos: rename exynos4 setup files to exynos4210
ARM: exynos: fill in exynos4412_power struct
ARM: exynos: add exynos4412 TZASC memory layout
ARM: exynos: SPL support for exynos 4412
tools: build mkexynosspl for exynos4 as well

 arch/arm/mach-exynos/Kconfig                  |   6 +
 arch/arm/mach-exynos/Makefile                 |   3 +-
 ...init_exynos4.c => clock_init_exynos4210.c} |   2 +-
 arch/arm/mach-exynos/clock_init_exynos4412.c  | 122 +++++
 ...c_init_exynos4.c => dmc_init_exynos4210.c} |   2 +-
 arch/arm/mach-exynos/dmc_init_exynos4412.c    | 185 ++++++++
 .../{exynos4_setup.h => exynos4210_setup.h}   |   0
 arch/arm/mach-exynos/exynos4412_setup.h       | 425 ++++++++++++++++++
 arch/arm/mach-exynos/include/mach/cpu.h       |   2 +-
 arch/arm/mach-exynos/include/mach/dmc.h       |  19 +
 arch/arm/mach-exynos/include/mach/power.h     | 290 +++++++++++-
 arch/arm/mach-exynos/power.c                  |  12 +
 arch/arm/mach-exynos/spl_boot.c               |  22 +-
 include/configs/exynos4-common.h              |   5 +
 tools/Makefile                                |   1 +
 15 files changed, 1084 insertions(+), 12 deletions(-)
 rename arch/arm/mach-exynos/{clock_init_exynos4.c => clock_init_exynos4210.c} (99%)
 create mode 100644 arch/arm/mach-exynos/clock_init_exynos4412.c
 rename arch/arm/mach-exynos/{dmc_init_exynos4.c => dmc_init_exynos4210.c} (99%)
 create mode 100644 arch/arm/mach-exynos/dmc_init_exynos4412.c
 rename arch/arm/mach-exynos/{exynos4_setup.h => exynos4210_setup.h} (100%)
 create mode 100644 arch/arm/mach-exynos/exynos4412_setup.h
Signature · 1 line
2.18.0
#1 lore raw

PATCH 1/7 ARM: exynos: spl: add EMMC/SD boot mode support

Match the iROM behaviour: try and load u-boot from EMMC, and if that fails, fall back to using the SD card.

---
 arch/arm/mach-exynos/spl_boot.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
arch/arm/mach-exynos/spl_boot.c +15 -7
index b4945bd8e2..6e84206fc5 100644
@@ -186,6 +186,7 @@ void copy_uboot_to_ram(void)
 
 	u32 (*copy_bl2)(u32 offset, u32 nblock, u32 dst) = NULL;
 	u32 offset = 0, size = 0;
+	u32 ret;
 #ifdef CONFIG_SPI_BOOTING
 	struct spl_machine_param *param = spl_get_machine_params();
 #endif
@@ -220,23 +221,30 @@ void copy_uboot_to_ram(void)
 		exynos_spi_copy(param->uboot_size, CONFIG_SYS_TEXT_BASE);
 		break;
 #endif
-	case BOOT_MODE_SD:
-		offset = BL2_START_OFFSET;
-		size = BL2_SIZE_BLOC_COUNT;
-		copy_bl2 = get_irom_func(MMC_INDEX);
-		break;
 #ifdef CONFIG_SUPPORT_EMMC_BOOT
 	case BOOT_MODE_EMMC:
+	case BOOT_MODE_EMMC_SD:
 		/* Set the FSYS1 clock divisor value for EMMC boot */
 		emmc_boot_clk_div_set();
 
 		copy_bl2_from_emmc = get_irom_func(EMMC44_INDEX);
 		end_bootop_from_emmc = get_irom_func(EMMC44_END_INDEX);
 
-		copy_bl2_from_emmc(BL2_SIZE_BLOC_COUNT, CONFIG_SYS_TEXT_BASE);
+		ret = copy_bl2_from_emmc(BL2_SIZE_BLOC_COUNT,
+					CONFIG_SYS_TEXT_BASE);
 		end_bootop_from_emmc();
-		break;
+
+		if (bootmode == BOOT_MODE_EMMC || ret)
+			break;
+		/* Fall through if EMMC boot failed and SD boot is enabled */
+#else
+	case BOOT_MODE_EMMC_SD:
 #endif
+	case BOOT_MODE_SD:
+		offset = BL2_START_OFFSET;
+		size = BL2_SIZE_BLOC_COUNT;
+		copy_bl2 = get_irom_func(MMC_INDEX);
+		break;
 #ifdef CONFIG_USB_BOOTING
 	case BOOT_MODE_USB:
 		/*
Signature · 1 line
2.18.0
#2 lore raw

PATCH 2/7 exynos4: configure power down magic values

In reply to Simon Shields

These values are used to indicate the power-down state of the system. We need them to know how much initialisation we should do on bootup.

---
 include/configs/exynos4-common.h | 5 +++++
 1 file changed, 5 insertions(+)
include/configs/exynos4-common.h +5 -0
index 005f65d4ed..d7997930e9 100644
@@ -22,6 +22,11 @@
 #define CONFIG_SYS_DFU_DATA_BUF_SIZE SZ_32M
 #define DFU_DEFAULT_POLL_TIMEOUT 300
 
+/* Power Down Modes */
+#define S5P_CHECK_SLEEP			0x00000BAD
+#define S5P_CHECK_DIDLE			0xBAD00000
+#define S5P_CHECK_LPA			0xABAD0000
+
 /* USB Samsung's IDs */
 #define CONFIG_G_DNL_THOR_VENDOR_NUM 0x04E8
 #define CONFIG_G_DNL_THOR_PRODUCT_NUM 0x685D
Signature · 1 line
2.18.0
#3 lore raw

PATCH 3/7 ARM: exynos: rename exynos4 setup files to exynos4210

In reply to Simon Shields

The current set of exynos4 initialisation code is only compatible with exynos4210. Rename it to reflect this, and allow for the introduction of exynos4412 support in a later patch set.

---
 arch/arm/mach-exynos/Makefile                                   | 2 +-
 .../{clock_init_exynos4.c => clock_init_exynos4210.c}           | 2 +-
 .../mach-exynos/{dmc_init_exynos4.c => dmc_init_exynos4210.c}   | 2 +-
 arch/arm/mach-exynos/{exynos4_setup.h => exynos4210_setup.h}    | 0
 4 files changed, 3 insertions(+), 3 deletions(-)
 rename arch/arm/mach-exynos/{clock_init_exynos4.c => clock_init_exynos4210.c} (99%)
 rename arch/arm/mach-exynos/{dmc_init_exynos4.c => dmc_init_exynos4210.c} (99%)
 rename arch/arm/mach-exynos/{exynos4_setup.h => exynos4210_setup.h} (100%)
arch/arm/mach-exynos/Makefile +1 -1
index e895c13157..ce88921868 100644
@@ -12,7 +12,7 @@ obj-$(CONFIG_EXYNOS5420)	+= sec_boot.o
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_EXYNOS5)	+= clock_init_exynos5.o
 obj-$(CONFIG_EXYNOS5)	+= dmc_common.o dmc_init_ddr3.o
-obj-$(CONFIG_EXYNOS4210)+= dmc_init_exynos4.o clock_init_exynos4.o
+obj-$(CONFIG_EXYNOS4210)+= dmc_init_exynos4210.o clock_init_exynos4210.o
 obj-y	+= spl_boot.o tzpc.o
 obj-y	+= lowlevel_init.o
 endif
arch/arm/mach-exynos/clock_init_exynos4210.c renamed from arch/arm/mach-exynos/clock_init_exynos4.c +1 -1
similarity index 99%
rename from arch/arm/mach-exynos/clock_init_exynos4.c
rename to arch/arm/mach-exynos/clock_init_exynos4210.c
index 584e4bac09..77f866119e 100644
@@ -30,7 +30,7 @@
 #include <asm/arch/clk.h>
 #include <asm/arch/clock.h>
 #include "common_setup.h"
-#include "exynos4_setup.h"
+#include "exynos4210_setup.h"
 
 /*
  * system_clock_init: Initialize core clock and bus clock.
arch/arm/mach-exynos/dmc_init_exynos4210.c renamed from arch/arm/mach-exynos/dmc_init_exynos4.c +1 -1
similarity index 99%
rename from arch/arm/mach-exynos/dmc_init_exynos4.c
rename to arch/arm/mach-exynos/dmc_init_exynos4210.c
index ecddc72684..3343496271 100644
@@ -26,7 +26,7 @@
 #include <config.h>
 #include <asm/arch/dmc.h>
 #include "common_setup.h"
-#include "exynos4_setup.h"
+#include "exynos4210_setup.h"
 
 struct mem_timings mem = {
 	.direct_cmd_msr = {
arch/arm/mach-exynos/exynos4210_setup.h renamed from arch/arm/mach-exynos/exynos4_setup.h +0 -0
similarity index 100%
rename from arch/arm/mach-exynos/exynos4_setup.h
rename to arch/arm/mach-exynos/exynos4210_setup.h
Signature · 1 line
2.18.0
#4 lore raw

PATCH 4/7 ARM: exynos: fill in exynos4412_power struct

In reply to Simon Shields

add all registers of the exynos4412 PMU according to the datasheet

---
 arch/arm/mach-exynos/include/mach/power.h | 290 +++++++++++++++++++++-
 1 file changed, 289 insertions(+), 1 deletion(-)
arch/arm/mach-exynos/include/mach/power.h +289 -1
index a3d8974dcb..8a84eab98b 100644
@@ -210,10 +210,298 @@ struct exynos4_power {
 };
 
 struct exynos4412_power {
-	unsigned char	res1[0x0704];
+	unsigned int	om_stat;
+	unsigned int	lpi_mask0;
+	unsigned int	lpi_mask1;
+	unsigned int	lpi_mask2;
+	unsigned int	rtc_clko_sel;
+	unsigned int	gnss_rtc_out_ctrl;
+	unsigned int	lpi_denial_mask0;
+	unsigned int	lpi_denial_mask1;
+	unsigned int	lpi_denial_mask2;
+	unsigned int	c2c_ctrl;
+	unsigned char	res1[0xd8];
+	unsigned int	intr_sspread_enable;
+	unsigned int	intr_sspread_use_standbywfi;
+	unsigned int	intr_sspread_blocking_duration;
+	unsigned char	res2[0xf4];
+	unsigned int	central_seq_configuration;
+	unsigned char	res3[0x4];
+	unsigned int	central_seq_option;
+	unsigned char	res4[0x34];
+	unsigned int	central_seq_configuration_coreblk;
+	unsigned char	res5[0x1bc];
+	unsigned int	swreset;
+	unsigned int	rst_stat;
+	unsigned int	automatic_wdt_reset_disable;
+	unsigned int	mask_wdt_reset_request;
+	unsigned char	res6[0x1f0];
+	unsigned int	wakeup_stat;
+	unsigned int	eint_wakeup_mask;
+	unsigned int	wakeup_mask;
+	unsigned char	res7[0x14];
+	unsigned int	wakeup_stat_coreblk;
+	unsigned char	res8[0x4];
+	unsigned int	wakeup_mask_coreblk;
+	unsigned char	res9[0xd4];
+	unsigned int	hdmi_phy_control;
 	unsigned int	usbhost_phy_control;
 	unsigned int	hsic1_phy_control;
 	unsigned int	hsic2_phy_control;
+	unsigned int	mipi_phy0_control;
+	unsigned int	mipi_phy1_control;
+	unsigned int	adc_phy_control;
+	unsigned char	res10[0x64];
+	unsigned int	body_bias_con0;
+	unsigned int	body_bias_con1;
+	unsigned int	body_bias_con2;
+	unsigned int	body_bias_con3;
+	unsigned char	res11[0x70];
+	unsigned int	inform0;
+	unsigned int	inform1;
+	unsigned int	inform2;
+	unsigned int	inform3;
+	unsigned int	inform4;
+	unsigned int	inform5;
+	unsigned int	inform6;
+	unsigned int	inform7;
+	unsigned char	res12[0xe0];
+	unsigned char	res13[0x80];
+	unsigned int	irom_data_reg0;
+	unsigned int	irom_data_reg1;
+	unsigned int	irom_data_reg2;
+	unsigned int	irom_data_reg3;
+	unsigned char	res14[0x70];
+	unsigned int	pmu_debug;
+	unsigned char	res15[0x5fc];
+	unsigned int	arm_core0_sys_pwr_reg;
+	unsigned int	dis_irq_arm_core0_local_sys_pwr_reg;
+	unsigned int	dis_irq_arm_core0_central_sys_pwr_reg;
+	unsigned char	res16[0x4];
+	unsigned int	arm_core1_pwr_reg;
+	unsigned int	dis_irq_arm_core1_local_sys_pwr_reg;
+	unsigned int	dis_irq_arm_core1_central_sys_pwr_reg;
+	unsigned char	res17[0x34];
+	unsigned int	isp_arm_sys_pwr_reg;
+	unsigned int	dis_irq_isp_arm_local_sys_pwr_reg;
+	unsigned int	dis_irq_isp_arm_central_sys_pwr_reg;
+	unsigned char	res18[0x24];
+	unsigned int	arm_common_sys_pwr_reg;
+	unsigned char	res19[0x3c];
+	unsigned int	arm_l2_0_sys_pwr_reg;
+	unsigned int	arm_l2_1_sys_pwr_reg;
+	unsigned char	res20[0x38];
+	unsigned int	cmu_aclkstop_sys_pwr_reg;
+	unsigned int	cmu_sclkstop_sys_pwr_reg;
+	unsigned char	res21[0x4];
+	unsigned int	cmu_reset_sys_pwr_reg;
+	unsigned int	cmu_aclkstop_coreblk_sys_pwr_reg;
+	unsigned int	cmu_sclkstop_coreblk_sys_pwr_reg;
+	unsigned char	res22[0x4];
+	unsigned int	cmu_reset_coreblk_sys_pwr_reg;
+	unsigned int	apll_sysclk_sys_pwr_reg;
+	unsigned int	mpll_sysclk_sys_pwr_reg;
+	unsigned int	vpll_sysclk_sys_pwr_reg;
+	unsigned int	epll_sysclk_sys_pwr_reg;
+	unsigned int	mplluser_sysclk_sys_pwr_reg;
+	unsigned char	res23[0x4];
+	unsigned int	cmu_clkstop_gps_alive_sys_pwr_reg;
+	unsigned int	cmu_reset_gps_alive_sys_pwr_reg;
+	unsigned int	cmu_clkstop_cam_sys_pwr_reg;
+	unsigned int	cmu_clkstop_tv_sys_pwr_reg;
+	unsigned int	cmu_clkstop_mfc_sys_pwr_reg;
+	unsigned int	cmu_clkstop_g3d_sys_pwr_reg;
+	unsigned int	cmu_clkstop_lcd0_sys_pwr_reg;
+	unsigned int	cmu_clkstop_isp_sys_pwr_reg;
+	unsigned int	cmu_clkstop_maudio_sys_pwr_reg;
+	unsigned int	cmu_clkstop_gps_sys_pwr_reg;
+	unsigned int	cmu_reset_cam_sys_pwr_reg;
+	unsigned int	cmu_reset_tv_sys_pwr_reg;
+	unsigned int	cmu_reset_mfc_sys_pwr_reg;
+	unsigned int	cmu_reset_g3d_sys_pwr_reg;
+	unsigned int	cmu_reset_lcd0_sys_pwr_reg;
+	unsigned int	cmu_reset_isp_sys_pwr_reg;
+	unsigned int	cmu_reset_maudio_sys_pwr_reg;
+	unsigned int	cmu_reset_gps_sys_pwr_reg;
+	unsigned int	top_bus_sys_pwr_reg;
+	unsigned int	top_retention_sys_pwr_reg;
+	unsigned int	top_pwr_sys_pwr_reg;
+	unsigned char	res24[0x4];
+	unsigned int	top_bus_coreblk_pwr_reg;
+	unsigned int	top_retention_coreblk_pwr_reg;
+	unsigned int	top_pwr_coreblk_pwr_reg;
+	unsigned char	res25[0x4];
+	unsigned int	logic_reset_sys_pwr_reg;
+	unsigned int	oscclk_gate_sys_pwr_reg;
+	unsigned char	res26[0x8];
+	unsigned int	logic_reset_coreblk_sys_pwr_reg;
+	unsigned int	oscclk_gate_coreblk_sys_pwr_reg;
+	unsigned char	res27[0x8];
+	unsigned int	onenandxl_mem_sys_pwr_reg;
+	unsigned int	hsi_mem_sys_pwr_reg;
+	unsigned int	g2d_acp_mem_sys_pwr_reg;
+	unsigned int	usbotg_mem_sys_pwr_reg;
+	unsigned int	sdmmc_mem_sys_pwr_reg;
+	unsigned int	cssys_mem_sys_pwr_reg;
+	unsigned int	secss_mem_sys_pwr_reg;
+	unsigned int	rotator_mem_sys_pwr_reg;
+	unsigned char	res28[0x20];
+	unsigned int	pad_retention_dram_sys_pwr_reg;
+	unsigned int	pad_retention_maudio_sys_pwr_reg;
+	unsigned char	res29[0x18];
+	unsigned int	pad_retention_gpio_sys_pwr_reg;
+	unsigned int	pad_retention_uart_sys_pwr_reg;
+	unsigned int	pad_retention_mmca_sys_pwr_reg;
+	unsigned int	pad_retention_mmcb_sys_pwr_reg;
+	unsigned int	pad_retention_ebia_sys_pwr_reg;
+	unsigned int	pad_retention_ebib_sys_pwr_reg;
+	unsigned char	resZ1[0x4];
+	unsigned int	pad_retention_gpio_coreblk_sys_pwr_reg;
+	unsigned int	pad_isolation_sys_pwr_reg;
+	unsigned char	res30[0xc];
+	unsigned int	pad_isolation_coreblk_sys_pwr_reg;
+	unsigned char	res31[0xc];
+	unsigned int	pad_alv_sel_sys_pwr_reg;
+	unsigned char	res32[0x1c];
+	unsigned int	xusbxti_sys_pwr_reg;
+	unsigned int	xxti_sys_pwr_reg;
+	unsigned char	res33[0x38];
+	unsigned int	ext_regulator_sys_pwr_reg;
+	unsigned char	res34[0x3c];
+	unsigned int	gpio_mode_sys_pwr_reg;
+	unsigned char	resZ2[0x1c];
+	unsigned int	gpio_mode_coreblk_sys_pwr_reg;
+	unsigned char	res35[0x1c];
+	unsigned int	gpio_mode_maudio_sys_pwr_reg;
+	unsigned int	top_asb_reset_sys_pwr_reg;
+	unsigned int	top_asb_isolation_sys_pwr_reg;
+	unsigned char	res36[0x34];
+	unsigned int	cam_sys_pwr_reg;
+	unsigned int	tv_sys_pwr_reg;
+	unsigned int	mfc_sys_pwr_reg;
+	unsigned int	g3d_sys_pwr_reg;
+	unsigned int	lcd0_sys_pwr_reg;
+	unsigned int	isp_sys_pwr_reg;
+	unsigned int	maudio_sys_pwr_reg;
+	unsigned int	gps_sys_pwr_reg;
+	unsigned int	gps_alive_sys_pwr_reg;
+	unsigned char	res37[0xc];
+	unsigned int	dram_freq_down_sys_pwr_reg;
+	unsigned int	ddrphy_dlloff_sys_pwr_reg;
+	unsigned int	cmu_sysclk_isp_sys_pwr_reg;
+	unsigned int	cmu_sysclk_gps_sys_pwr_reg;
+	unsigned int	lpddr_phy_dll_lock_sys_pwr_reg;
+	unsigned char	res38[0xc3c];
+	unsigned int	arm_core0_configuration;
+	unsigned int	arm_core0_status;
+	unsigned int	arm_core0_option;
+	unsigned char	res39[0x74];
+	unsigned int	arm_core1_configuration;
+	unsigned int	arm_core1_status;
+	unsigned int	arm_core1_option;
+	unsigned char	res40[0x1f4];
+	unsigned int	isp_arm_configuration;
+	unsigned int	isp_arm_status;
+	unsigned int	isp_arm_option;
+	unsigned char	res41[0x17c];
+	unsigned int	arm_common_option;
+	unsigned char	res42[0x1f4];
+	unsigned int	arm_l2_0_configuration;
+	unsigned int	arm_l2_0_status;
+	unsigned int	arm_l2_0_option;
+	unsigned char	res43[0x14];
+	unsigned int	arm_l2_1_configuration;
+	unsigned int	arm_l2_1_status;
+	unsigned int	arm_l2_1_option;
+	unsigned char	res44[0x37c];
+	unsigned int	dram_freq_down_option;
+	unsigned char	res45[0x41c];
+	unsigned int	ddrphy_dlloff_option;
+	unsigned char	res46[0x3c];
+	unsigned int	onenandxl_mem_option;
+	unsigned char	res47[0x1c];
+	unsigned int	hsi_mem_option;
+	unsigned char	res48[0x1c];
+	unsigned int	g2d_acp_mem_option;
+	unsigned char	res49[0x1c];
+	unsigned int	usbotg_mem_option;
+	unsigned char	res50[0x1c];
+	unsigned int	sdmmc_mem_option;
+	unsigned char	res51[0x1c];
+	unsigned int	cssys_mem_option;
+	unsigned char	res52[0x1c];
+	unsigned int	secss_mem_option;
+	unsigned char	res53[0x7c];
+	unsigned int	rotator_mem_option;
+	unsigned char	res54[0xdc];
+	unsigned int	pad_retention_maudio_option;
+	unsigned char	res55[0xdc];
+	unsigned int	pad_retention_gpio_option;
+	unsigned char	res56[0x1c];
+	unsigned int	pad_retention_uart_option;
+	unsigned char	res57[0x1c];
+	unsigned int	pad_retention_mmca_option;
+	unsigned char	res58[0x1c];
+	unsigned int	pad_retention_mmcb_option;
+	unsigned char	res59[0x1c];
+	unsigned int	pad_retention_ebia_option;
+	unsigned char	res60[0x1c];
+	unsigned int	pad_retention_ebib_option;
+	unsigned char	res61[0x3c];
+	unsigned int	pad_retention_gpio_coreblk_option;
+	unsigned char	res62[0x114];
+	unsigned char	res63[0xc];
+	unsigned int	ps_hold_control;
+	unsigned char	res64[0xf0];
+	unsigned int	xusbxti_configuration;
+	unsigned int	xusbxti_status;
+	unsigned char	res65[0x14];
+	unsigned int	xusbxti_duration;
+	unsigned int	xxti_configuration;
+	unsigned int	xxti_status;
+	unsigned char	res66[0x14];
+	unsigned int	xxti_duration;
+	unsigned char	res67[0x1c0];
+	unsigned char	res68[0x1c];
+	unsigned int	ext_reguilator_duration;
+	unsigned char	res69[0x5e0];
+	unsigned int	cam_configuration;
+	unsigned int	cam_status;
+	unsigned int	cam_option;
+	unsigned char	res70[0x14];
+	unsigned int	tv_configuration;
+	unsigned int	tv_status;
+	unsigned int	tv_option;
+	unsigned char	res71[0x14];
+	unsigned int	mfc_configuration;
+	unsigned int	mfc_status;
+	unsigned int	mfc_option;
+	unsigned char	res72[0x14];
+	unsigned int	g3d_configuration;
+	unsigned int	g3d_status;
+	unsigned int	g3d_option;
+	unsigned char	res73[0x14];
+	unsigned int	lcd0_configuration;
+	unsigned int	lcd0_status;
+	unsigned int	lcd0_option;
+	unsigned char	res74[0x14];
+	unsigned int	isp_configuration;
+	unsigned int	isp_status;
+	unsigned int	isp_option;
+	unsigned char	res75[0xc];
+	unsigned int	isp_duration0;
+	unsigned char	res76[0x4];
+	unsigned int	maudio_configuration;
+	unsigned int	maudio_status;
+	unsigned int	maudio_option;
+	unsigned char	res77[0x14];
+	unsigned int	gps_configuration;
+	unsigned int	gps_status;
+	unsigned int	gps_option;
+	unsigned char	res78[0x14];
+	unsigned int	gps_alive_configuration;
+	unsigned int	gps_alive_status;
+	unsigned int	gps_alive_option;
 };
 
 struct exynos5_power {
Signature · 1 line
2.18.0
#5 lore raw

PATCH 5/7 ARM: exynos: add exynos4412 TZASC memory layout

In reply to Simon Shields

This patch adds the TZASC registers and base address as documented in the user manual. A follow-up patch will use this to mark all address spaces as non-secure.

---
 arch/arm/mach-exynos/include/mach/cpu.h |  2 +-
 arch/arm/mach-exynos/include/mach/dmc.h | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)
arch/arm/mach-exynos/include/mach/cpu.h +1 -1
index aeb3755fe6..37d3118749 100644
@@ -69,6 +69,7 @@
 #define EXYNOS4X12_TZPC_BASE		0x10110000
 #define EXYNOS4X12_DMC_CTRL_BASE	0x10600000
 #define EXYNOS4X12_GPIO_PART4_BASE	0x106E0000
+#define EXYNOS4X12_DMC_TZASC_BASE	0x10700000
 #define EXYNOS4X12_ACE_SFR_BASE		0x10830000
 #define EXYNOS4X12_GPIO_PART2_BASE	0x11000000
 #define EXYNOS4X12_GPIO_PART2_0		0x11000000
@@ -100,7 +101,6 @@
 #define EXYNOS4X12_AUDIOSS_BASE		DEVICE_NOT_AVAILABLE
 #define EXYNOS4X12_USB_HOST_XHCI_BASE	DEVICE_NOT_AVAILABLE
 #define EXYNOS4X12_USB3PHY_BASE		DEVICE_NOT_AVAILABLE
-#define EXYNOS4X12_DMC_TZASC_BASE	DEVICE_NOT_AVAILABLE
 
 /* EXYNOS5 */
 #define EXYNOS5_I2C_SPACING		0x10000
arch/arm/mach-exynos/include/mach/dmc.h +19 -0
index 4990a1af39..49f00fc564 100644
@@ -419,6 +419,25 @@ struct exynos5420_phy_control {
 	unsigned int phy_con42;
 };
 
+struct exynos4412_tzasc {
+	unsigned char res1[0x100];
+	unsigned int region_setup_low_0;
+	unsigned int region_setup_high_0;
+	unsigned int region_attributes_0;
+	unsigned int res2;
+	unsigned int region_setup_low_1;
+	unsigned int region_setup_high_1;
+	unsigned int region_setup_attributes_1;
+	unsigned int res3;
+	unsigned int region_setup_low_2;
+	unsigned int region_setup_high_2;
+	unsigned int region_setup_attributes_2;
+	unsigned int res4;
+	unsigned int region_setup_low_3;
+	unsigned int region_setup_high_3;
+	unsigned int region_attributes_3;
+};
+
 struct exynos5420_tzasc {
 	unsigned char res1[0xf00];
 	unsigned int membaseconfig0;
Signature · 1 line
2.18.0
#6 lore raw

PATCH 6/7 ARM: exynos: SPL support for exynos 4412

In reply to Simon Shields

This patch adds support for using u-boot's SPL in place of a proprietary BL2 on exynos 4412 boards. This has been verified to work on both exynos4412 boards (i9300 and i9305), and exynos4412-prime boards (n7100 and n7105), with one or two gigabytes of RAM. Using u-boot as SPL requires an appropriate FWBL1 that does not verify the signature of BL2.

The majority of the configuration logic comes from the vendor u-boot drop, while some was reverse-engineered from a proprietary bootloader.

Note that this patch does not initialise the exynos4412-prime clocks as they're initialised by the proprietary bootloader - instead, they're initialised to the same state as normal exynos4412 clocks.

---
 arch/arm/mach-exynos/Kconfig                 |   6 +
 arch/arm/mach-exynos/Makefile                |   1 +
 arch/arm/mach-exynos/clock_init_exynos4412.c | 122 ++++++
 arch/arm/mach-exynos/dmc_init_exynos4412.c   | 185 ++++++++
 arch/arm/mach-exynos/exynos4412_setup.h      | 425 +++++++++++++++++++
 arch/arm/mach-exynos/power.c                 |  12 +
 6 files changed, 751 insertions(+)
 create mode 100644 arch/arm/mach-exynos/clock_init_exynos4412.c
 create mode 100644 arch/arm/mach-exynos/dmc_init_exynos4412.c
 create mode 100644 arch/arm/mach-exynos/exynos4412_setup.h
arch/arm/mach-exynos/Kconfig +6 -0
index ed04369cfa..17eaf99724 100644
@@ -42,6 +42,9 @@ endchoice
 
 if ARCH_EXYNOS4
 
+config EXYNOS4412
+	bool
+
 choice
 	prompt "EXYNOS4 board select"
 
@@ -59,12 +62,15 @@ config TARGET_S5PC210_UNIVERSAL
 config TARGET_ORIGEN
 	bool "Exynos4412 Origen board"
 	select SUPPORT_SPL
+	select EXYNOS4412
 
 config TARGET_TRATS2
 	bool "Exynos4412 Trat2 board"
+	select EXYNOS4412
 
 config TARGET_ODROID
 	bool "Exynos4412 Odroid board"
+	select EXYNOS4412
 
 endchoice
 endif
arch/arm/mach-exynos/Makefile +1 -0
index ce88921868..5dcad9643b 100644
@@ -13,6 +13,7 @@ ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_EXYNOS5)	+= clock_init_exynos5.o
 obj-$(CONFIG_EXYNOS5)	+= dmc_common.o dmc_init_ddr3.o
 obj-$(CONFIG_EXYNOS4210)+= dmc_init_exynos4210.o clock_init_exynos4210.o
+obj-$(CONFIG_EXYNOS4412)+= dmc_init_exynos4412.o clock_init_exynos4412.o
 obj-y	+= spl_boot.o tzpc.o
 obj-y	+= lowlevel_init.o
 endif
arch/arm/mach-exynos/clock_init_exynos4412.c new file +122 -0

122 lines not on this page · raw message

arch/arm/mach-exynos/dmc_init_exynos4412.c new file +185 -0

185 lines not on this page · raw message

arch/arm/mach-exynos/exynos4412_setup.h new file +425 -0

425 lines not on this page · raw message

arch/arm/mach-exynos/power.c +12 -0
index 63c410acef..a513b89551 100644
@@ -162,6 +162,16 @@ static void exynos5_set_ps_hold_ctrl(void)
 			EXYNOS_PS_HOLD_CONTROL_DATA_HIGH);
 }
 
+static void exynos4412_set_ps_hold_ctrl(void)
+{
+	struct exynos4412_power *power =
+		(struct exynos4412_power *)samsung_get_base_power();
+
+	/* Set PS-Hold high */
+	setbits_le32(&power->ps_hold_control,
+			EXYNOS_PS_HOLD_CONTROL_DATA_HIGH);
+}
+
 /*
  * Set ps_hold data driving value high
  * This enables the machine to stay powered on
@@ -172,6 +182,8 @@ void set_ps_hold_ctrl(void)
 {
 	if (cpu_is_exynos5())
 		exynos5_set_ps_hold_ctrl();
+	else if (proid_is_exynos4412())
+		exynos4412_set_ps_hold_ctrl();
 }
 
 
Signature · 1 line
2.18.0
#7 lore raw

PATCH 7/7 tools: build mkexynosspl for exynos4 as well

In reply to Simon Shields

Exynos4 uses the same SPL format as exynos5420/5250, so reuse mkexynosspl.

---
 tools/Makefile | 1 +
 1 file changed, 1 insertion(+)
tools/Makefile +1 -0
index 0c3341e695..63db215f9f 100644
@@ -166,6 +166,7 @@ HOSTLOADLIBES_fit_check_sign := $(HOSTLOADLIBES_mkimage)
 
 hostprogs-$(CONFIG_EXYNOS5250) += mkexynosspl
 hostprogs-$(CONFIG_EXYNOS5420) += mkexynosspl
+hostprogs-$(CONFIG_EXYNOS4) += mkexynosspl
 HOSTCFLAGS_mkexynosspl.o := -pedantic
 
 ifdtool-objs := $(LIBFDT_OBJS) ifdtool.o
Signature · 1 line
2.18.0
#8 lore raw

cover Exynos4412 SPL support

In reply to Simon Shields

Hi Simon,

Quoted 23 lines · Simon Shields

Hi,

This patch series adds support for using U-Boot's SPL as the second stage bootloader ("BL2") on Exynos4412 SoCs.

- Patch #1 adds support for the EMMC/SD OM pin configuration, which is used by the boards I tested on.
- Patch #2 configures the magic values used to indicate system suspend state (which are identical to exynos5).
- Patch #3 renames the existing exynos4 clock/dmc initialisation code to reflect the fact that it only supports exynos4210.
- Patches #4 and #5 add/fill in structs reflecting the PMU and TZASC register layouts on exynos4412, respectively.
- Patch #6 adds the exynos4412 DMC and clock initialisation code and enables building the SPL on exynos4412 platforms.
- Patch #7 enables building the "mkexynosspl" utility for exynos4 SoCs.

The majority of the logic in patch #6 comes from a vendor u-boot dump (2010.12!), however, small portions (mostly code used for 2GB RAM initialisation) were reverse engineered from the vendor bootloader found on a GT-N7100.

Quoted 8 lines

This patch series has been tested on a GT-I9300 (exynos4412, 1GB RAM) and a GT-N7100 (exynos4412 prime, 2GB RAM), with a few additional patchsets applied for board/HW support (which I intend to upstream in the future).

Cheers,
Simon

Could you elaborate more on how to generate stage bootloader (BL2) image, I am not aware of such process and what are next step to create SPL for Exynos platform.

I have build these patches for Odroid-U3 boards, with no SPL enable.

Best Regards
-Anand

#9 lore raw

cover Exynos4412 SPL support

Hi Anand,

Quoted 35 lines · Anand Moon

Hi Simon,

Quoted 23 lines · Simon Shields

Hi,

This patch series adds support for using U-Boot's SPL as the second stage bootloader ("BL2") on Exynos4412 SoCs.

- Patch #1 adds support for the EMMC/SD OM pin configuration, which is used by the boards I tested on.
- Patch #2 configures the magic values used to indicate system suspend state (which are identical to exynos5).
- Patch #3 renames the existing exynos4 clock/dmc initialisation code to reflect the fact that it only supports exynos4210.
- Patches #4 and #5 add/fill in structs reflecting the PMU and TZASC register layouts on exynos4412, respectively.
- Patch #6 adds the exynos4412 DMC and clock initialisation code and enables building the SPL on exynos4412 platforms.
- Patch #7 enables building the "mkexynosspl" utility for exynos4 SoCs.

The majority of the logic in patch #6 comes from a vendor u-boot dump (2010.12!), however, small portions (mostly code used for 2GB RAM initialisation) were reverse engineered from the vendor bootloader found on a GT-N7100.

Quoted 8 lines

This patch series has been tested on a GT-I9300 (exynos4412, 1GB RAM) and a GT-N7100 (exynos4412 prime, 2GB RAM), with a few additional patchsets applied for board/HW support (which I intend to upstream in the future).

Cheers,
Simon

Quoted 5 lines

Could you elaborate more on how to generate stage bootloader (BL2) image, I am not aware of such process and what are next step to create SPL for Exynos platform.

I have build these patches for Odroid-U3 boards, with no SPL enable.

Of course!

You need to add "select SUPPORT_SPL" to the relevant TARGET_ kconfig entry (e.g. [0]). Then, you need to configure the SPL suitably in include/configs/<target>.h - see [1], these values should not need changing between boards. Finally, you need to enable some SPL stuff in the defconfig (see [2]). That should allow u-boot to generate a SPL binary, which should go in spl/<target>-spl.bin.

After that, you need to assemble an image suitable for flashing to an sdcard/eMMC. I use these two scripts [3], [4] combined with this BL1 [5] (originally from the ODROID-X u-boot sources, which no longer appear to be available) for eMMC and sdcard respectively.

The usage of the script is:

./create_4412_<sd|emmc>_image.sh <bl1 binary> <spl binary> <u-boot.bin>
<outfile>

<outfile> can then be dd'd directly to an SD card or to the eMMC boot0 partition.

Hope that gets things working for you!

Cheers,
Simon

Quoted 3 lines

Best Regards
-Anand

[0]: https://github.com/fourkbomb/u-boot/blob/4be16a7/arch/arm/mach-exynos/Kconfig#L77
[1]: https://github.com/fourkbomb/u-boot/blob/4be16a7/include/configs/midas.h#L31-L53
[2]: https://github.com/fourkbomb/u-boot/blob/4be16a7/configs/midas_defconfig#L6-L10
[3]: https://github.com/fourkbomb/buildroot-external-midas/blob/master/board/midas/create_4412_emmc_image.sh
[4]: https://github.com/fourkbomb/buildroot-external-midas/blob/master/board/midas/create_4412_sd_image.sh
[5]: https://github.com/fourkbomb/buildroot-external-midas/blob/master/board/midas/p4412_s_fwbl1.bin

#10 lore raw

cover Exynos4412 SPL support

Hi Simon,

Quoted 76 lines · Simon Shields

Hi Anand,

Quoted 35 lines · Anand Moon

Hi Simon,

Quoted 23 lines · Simon Shields

Hi,

This patch series adds support for using U-Boot's SPL as the second stage bootloader ("BL2") on Exynos4412 SoCs.

- Patch #1 adds support for the EMMC/SD OM pin configuration, which is used by the boards I tested on.
- Patch #2 configures the magic values used to indicate system suspend state (which are identical to exynos5).
- Patch #3 renames the existing exynos4 clock/dmc initialisation code to reflect the fact that it only supports exynos4210.
- Patches #4 and #5 add/fill in structs reflecting the PMU and TZASC register layouts on exynos4412, respectively.
- Patch #6 adds the exynos4412 DMC and clock initialisation code and enables building the SPL on exynos4412 platforms.
- Patch #7 enables building the "mkexynosspl" utility for exynos4 SoCs.

The majority of the logic in patch #6 comes from a vendor u-boot dump (2010.12!), however, small portions (mostly code used for 2GB RAM initialisation) were reverse engineered from the vendor bootloader found on a GT-N7100.

Quoted 8 lines

This patch series has been tested on a GT-I9300 (exynos4412, 1GB RAM) and a GT-N7100 (exynos4412 prime, 2GB RAM), with a few additional patchsets applied for board/HW support (which I intend to upstream in the future).

Cheers,
Simon

Quoted 5 lines

Could you elaborate more on how to generate stage bootloader (BL2) image, I am not aware of such process and what are next step to create SPL for Exynos platform.

I have build these patches for Odroid-U3 boards, with no SPL enable.

Of course!

You need to add "select SUPPORT_SPL" to the relevant TARGET_ kconfig entry (e.g. [0]). Then, you need to configure the SPL suitably in include/configs/<target>.h - see [1], these values should not need changing between boards. Finally, you need to enable some SPL stuff in the defconfig (see [2]). That should allow u-boot to generate a SPL binary, which should go in spl/<target>-spl.bin.

After that, you need to assemble an image suitable for flashing to an sdcard/eMMC. I use these two scripts [3], [4] combined with this BL1 [5] (originally from the ODROID-X u-boot sources, which no longer appear to be available) for eMMC and sdcard respectively.

The usage of the script is:

./create_4412_<sd|emmc>_image.sh <bl1 binary> <spl binary> <u-boot.bin>
<outfile>

<outfile> can then be dd'd directly to an SD card or to the eMMC boot0 partition.

Hope that gets things working for you!

Cheers,
Simon

Quoted 3 lines

Best Regards
-Anand

Quoted 6 lines

[0]: https://github.com/fourkbomb/u-boot/blob/4be16a7/arch/arm/mach-exynos/Kconfig#L77
[1]: https://github.com/fourkbomb/u-boot/blob/4be16a7/include/configs/midas.h#L31-L53
[2]: https://github.com/fourkbomb/u-boot/blob/4be16a7/configs/midas_defconfig#L6-L10
[3]: https://github.com/fourkbomb/buildroot-external-midas/blob/master/board/midas/create_4412_emmc_image.sh
[4]: https://github.com/fourkbomb/buildroot-external-midas/blob/master/board/midas/create_4412_sd_image.sh
[5]: https://github.com/fourkbomb/buildroot-external-midas/blob/master/board/midas/p4412_s_fwbl1.bin

Thank you very much for this inside on building SPL image. I will give this a try on Odroid U3.

Do you have plan to add some low-level code to control clk memory cpu.

[0] https://github.com/SamsungARTIK/u-boot-artik/tree/artik-exynos/v2012.07/board/samsung/smdk4x12

Actually I failed to understand how the communication between the kernel binary and u-boot with out this code.

Also what about trusted zone, and do we need to get this spl image signed by Samsung/Hardkernel to make this work.

Best Regards
-Anand

#11 lore raw

cover Exynos4412 SPL support

Hi Anand,

Quoted 88 lines · Anand Moon

Hi Simon,

Quoted 76 lines · Simon Shields

Hi Anand,

Quoted 35 lines · Anand Moon

Hi Simon,

Quoted 23 lines · Simon Shields

Hi,

This patch series adds support for using U-Boot's SPL as the second stage bootloader ("BL2") on Exynos4412 SoCs.

- Patch #1 adds support for the EMMC/SD OM pin configuration, which is used by the boards I tested on.
- Patch #2 configures the magic values used to indicate system suspend state (which are identical to exynos5).
- Patch #3 renames the existing exynos4 clock/dmc initialisation code to reflect the fact that it only supports exynos4210.
- Patches #4 and #5 add/fill in structs reflecting the PMU and TZASC register layouts on exynos4412, respectively.
- Patch #6 adds the exynos4412 DMC and clock initialisation code and enables building the SPL on exynos4412 platforms.
- Patch #7 enables building the "mkexynosspl" utility for exynos4 SoCs.

The majority of the logic in patch #6 comes from a vendor u-boot dump (2010.12!), however, small portions (mostly code used for 2GB RAM initialisation) were reverse engineered from the vendor bootloader found on a GT-N7100.

Quoted 8 lines

This patch series has been tested on a GT-I9300 (exynos4412, 1GB RAM) and a GT-N7100 (exynos4412 prime, 2GB RAM), with a few additional patchsets applied for board/HW support (which I intend to upstream in the future).

Cheers,
Simon

Quoted 5 lines

Could you elaborate more on how to generate stage bootloader (BL2) image, I am not aware of such process and what are next step to create SPL for Exynos platform.

I have build these patches for Odroid-U3 boards, with no SPL enable.

Of course!

You need to add "select SUPPORT_SPL" to the relevant TARGET_ kconfig entry (e.g. [0]). Then, you need to configure the SPL suitably in include/configs/<target>.h - see [1], these values should not need changing between boards. Finally, you need to enable some SPL stuff in the defconfig (see [2]). That should allow u-boot to generate a SPL binary, which should go in spl/<target>-spl.bin.

After that, you need to assemble an image suitable for flashing to an sdcard/eMMC. I use these two scripts [3], [4] combined with this BL1 [5] (originally from the ODROID-X u-boot sources, which no longer appear to be available) for eMMC and sdcard respectively.

The usage of the script is:

./create_4412_<sd|emmc>_image.sh <bl1 binary> <spl binary> <u-boot.bin>
<outfile>

<outfile> can then be dd'd directly to an SD card or to the eMMC boot0 partition.

Hope that gets things working for you!

Cheers,
Simon

Quoted 3 lines

Best Regards
-Anand

Quoted 6 lines

[0]: https://github.com/fourkbomb/u-boot/blob/4be16a7/arch/arm/mach-exynos/Kconfig#L77
[1]: https://github.com/fourkbomb/u-boot/blob/4be16a7/include/configs/midas.h#L31-L53
[2]: https://github.com/fourkbomb/u-boot/blob/4be16a7/configs/midas_defconfig#L6-L10
[3]: https://github.com/fourkbomb/buildroot-external-midas/blob/master/board/midas/create_4412_emmc_image.sh
[4]: https://github.com/fourkbomb/buildroot-external-midas/blob/master/board/midas/create_4412_sd_image.sh
[5]: https://github.com/fourkbomb/buildroot-external-midas/blob/master/board/midas/p4412_s_fwbl1.bin

Thank you very much for this inside on building SPL image. I will give this a try on Odroid U3.

Quoted 6 lines

Do you have plan to add some low-level code to control clk memory cpu.

[0] https://github.com/SamsungARTIK/u-boot-artik/tree/artik-exynos/v2012.07/board/samsung/smdk4x12

Actually I failed to understand how the communication between the kernel binary and u-boot with out this code.

That code is not actually board-specific. It's added in patch #6.
All the BL2 does is initialise clocks and memory (DMC), then load U-Boot from the appropriate boot medium.

Quoted 3 lines

Also what about trusted zone, and do we need to get this spl image signed by Samsung/Hardkernel to make this work.

As with other Exynos SoCs in U-Boot, this doesn't support loading trustzone. As a result, you need to remove the "secure-firmware" node from the Linux kernel (you can also do it with CONFIG_OF_BOARD_SETUP[0]). Adding support for the TZSW could probably be done, but the goal here was to remove blobs from the boot process - so I don't really have any interest in adding TZSW support right now.

Quoted 3 lines

Best Regards
-Anand

Cheers,
Simon

[0]: https://github.com/fourkbomb/u-boot/blob/4be16a7/board/samsung/midas/midas.c#L377-L402

#12 lore raw

cover Exynos4412 SPL support

Hi Simon

Quoted 115 lines · Simon Shields

Hi Anand,

Quoted 88 lines · Anand Moon

Hi Simon,

Quoted 76 lines · Simon Shields

Hi Anand,

Quoted 35 lines · Anand Moon

Hi Simon,

Quoted 23 lines · Simon Shields

Hi,

This patch series adds support for using U-Boot's SPL as the second stage bootloader ("BL2") on Exynos4412 SoCs.

- Patch #1 adds support for the EMMC/SD OM pin configuration, which is used by the boards I tested on.
- Patch #2 configures the magic values used to indicate system suspend state (which are identical to exynos5).
- Patch #3 renames the existing exynos4 clock/dmc initialisation code to reflect the fact that it only supports exynos4210.
- Patches #4 and #5 add/fill in structs reflecting the PMU and TZASC register layouts on exynos4412, respectively.
- Patch #6 adds the exynos4412 DMC and clock initialisation code and enables building the SPL on exynos4412 platforms.
- Patch #7 enables building the "mkexynosspl" utility for exynos4 SoCs.

The majority of the logic in patch #6 comes from a vendor u-boot dump (2010.12!), however, small portions (mostly code used for 2GB RAM initialisation) were reverse engineered from the vendor bootloader found on a GT-N7100.

Quoted 8 lines

This patch series has been tested on a GT-I9300 (exynos4412, 1GB RAM) and a GT-N7100 (exynos4412 prime, 2GB RAM), with a few additional patchsets applied for board/HW support (which I intend to upstream in the future).

Cheers,
Simon

Quoted 5 lines

Could you elaborate more on how to generate stage bootloader (BL2) image, I am not aware of such process and what are next step to create SPL for Exynos platform.

I have build these patches for Odroid-U3 boards, with no SPL enable.

Of course!

You need to add "select SUPPORT_SPL" to the relevant TARGET_ kconfig entry (e.g. [0]). Then, you need to configure the SPL suitably in include/configs/<target>.h - see [1], these values should not need changing between boards. Finally, you need to enable some SPL stuff in the defconfig (see [2]). That should allow u-boot to generate a SPL binary, which should go in spl/<target>-spl.bin.

After that, you need to assemble an image suitable for flashing to an sdcard/eMMC. I use these two scripts [3], [4] combined with this BL1 [5] (originally from the ODROID-X u-boot sources, which no longer appear to be available) for eMMC and sdcard respectively.

The usage of the script is:

./create_4412_<sd|emmc>_image.sh <bl1 binary> <spl binary> <u-boot.bin>
<outfile>

<outfile> can then be dd'd directly to an SD card or to the eMMC boot0 partition.

Hope that gets things working for you!

Cheers,
Simon

Quoted 3 lines

Best Regards
-Anand

Quoted 6 lines

[0]: https://github.com/fourkbomb/u-boot/blob/4be16a7/arch/arm/mach-exynos/Kconfig#L77
[1]: https://github.com/fourkbomb/u-boot/blob/4be16a7/include/configs/midas.h#L31-L53
[2]: https://github.com/fourkbomb/u-boot/blob/4be16a7/configs/midas_defconfig#L6-L10
[3]: https://github.com/fourkbomb/buildroot-external-midas/blob/master/board/midas/create_4412_emmc_image.sh
[4]: https://github.com/fourkbomb/buildroot-external-midas/blob/master/board/midas/create_4412_sd_image.sh
[5]: https://github.com/fourkbomb/buildroot-external-midas/blob/master/board/midas/p4412_s_fwbl1.bin

Thank you very much for this inside on building SPL image. I will give this a try on Odroid U3.

Quoted 6 lines

Do you have plan to add some low-level code to control clk memory cpu.

[0] https://github.com/SamsungARTIK/u-boot-artik/tree/artik-exynos/v2012.07/board/samsung/smdk4x12

Actually I failed to understand how the communication between the kernel binary and u-boot with out this code.

That code is not actually board-specific. It's added in patch #6.
All the BL2 does is initialise clocks and memory (DMC), then load U-Boot from the appropriate boot medium.

Quoted 3 lines

Also what about trusted zone, and do we need to get this spl image signed by Samsung/Hardkernel to make this work.

As with other Exynos SoCs in U-Boot, this doesn't support loading trustzone. As a result, you need to remove the "secure-firmware" node from the Linux kernel (you can also do it with CONFIG_OF_BOARD_SETUP[0]). Adding support for the TZSW could probably be done, but the goal here was to remove blobs from the boot process - so I don't really have any interest in adding TZSW support right now.

Quoted 1 line
Quoted 7 lines
Quoted 2 lines

Best Regards
-Anand

Cheers,
Simon

[0]: https://github.com/fourkbomb/u-boot/blob/4be16a7/board/samsung/midas/midas.c#L377-L402

Adding samsung maintainers.
+ Minkyum and +Lukasz

Sorry for late testing of these patches

I manage to get the code compile on the my Archlinux Odroid U3 image with some twerks in the u-boot.
with the new odroid
I am able to boot using u-boot up till loading of the kernel but it failed to move ahead.
How can I debug this further.

------------------------------------------------------------
Starting Reboot...

[ 1613.704042] watchdog: watchdog0: nowayout prevents watchdog being stopped!
[ 1613.705323] watchdog: watchdog0: nowayout prevents watchdog being stopped!
[ 1613.712163] watchdog: watchdog0: watchdog did not stop!
[ 1613.718887] systemd-shutdow: 26 output lines suppressed due to ratelimiting
[ 1613.744412] systemd-shutdown[1]: Syncing filesystems and block devices.

U-Boot 2018.09-00275-g3502a38e59-dirty (Oct 29 2018 - 07:22:01 +0000)

CPU:   Exynos4412 @ 1 GHz
Model: Odroid based on Exynos4412
Board: Odroid based on Exynos4412
Type:  u3
DRAM:  2 GiB
LDO20 at VDDQ_EMMC_1.8V: set 1800000 uV; enabling
LDO22 at VDDQ_EMMC_2.8V: set 2800000 uV; enabling
LDO21 at TFLASH_2.8V: set 2800000 uV; enabling
MMC:   SAMSUNG SDHCI: 1, EXYNOS DWMMC: 0

Loading Environment from MMC... Card did not respond to voltage select! *** Warning - No block device, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   Net Initialization Skipped

No ethernet found.
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1...
Found U-Boot script /boot/boot.scr
732 bytes read in 5 ms (142.6 KiB/s)
## Executing script at 42000000
6355984 bytes read in 127 ms (47.7 MiB/s) 72400 bytes read in 122 ms (579.1 KiB/s) 5656893 bytes read in 117 ms (46.1 MiB/s)
## Flattened Device Tree blob at 40800000
Booting using the fdt blob at 0x40800000 Loading Ramdisk to 4fa9a000, end 4ffff13d ... OK Loading Device Tree to 4fa85000, end 4fa99acf ... OK

Starting kernel ...

------------------------------------------------------------
Best Regards
-Anand

#13 lore raw

cover Exynos4412 SPL support

In reply to Simon Shields

Dear Simon Shields,

Quoted 53 lines · Simon Shields

Hi,

This patch series adds support for using U-Boot's SPL as the second stage bootloader ("BL2") on Exynos4412 SoCs.

- Patch #1 adds support for the EMMC/SD OM pin configuration, which is used by the boards I tested on.
- Patch #2 configures the magic values used to indicate system suspend state (which are identical to exynos5).
- Patch #3 renames the existing exynos4 clock/dmc initialisation code to reflect the fact that it only supports exynos4210.
- Patches #4 and #5 add/fill in structs reflecting the PMU and TZASC register layouts on exynos4412, respectively.
- Patch #6 adds the exynos4412 DMC and clock initialisation code and enables building the SPL on exynos4412 platforms.
- Patch #7 enables building the "mkexynosspl" utility for exynos4 SoCs.

The majority of the logic in patch #6 comes from a vendor u-boot dump (2010.12!), however, small portions (mostly code used for 2GB RAM initialisation) were reverse engineered from the vendor bootloader found on a GT-N7100.

This patch series has been tested on a GT-I9300 (exynos4412, 1GB RAM) and a GT-N7100 (exynos4412 prime, 2GB RAM), with a few additional patchsets applied for board/HW support (which I intend to upstream in the future).

Cheers,
Simon

Simon Shields (7):
ARM: exynos: spl: add EMMC/SD boot mode support
exynos4: configure power down magic values
ARM: exynos: rename exynos4 setup files to exynos4210
ARM: exynos: fill in exynos4412_power struct
ARM: exynos: add exynos4412 TZASC memory layout
ARM: exynos: SPL support for exynos 4412
tools: build mkexynosspl for exynos4 as well

 arch/arm/mach-exynos/Kconfig                  |   6 +
 arch/arm/mach-exynos/Makefile                 |   3 +-
 ...init_exynos4.c => clock_init_exynos4210.c} |   2 +-
 arch/arm/mach-exynos/clock_init_exynos4412.c  | 122 +++++
 ...c_init_exynos4.c => dmc_init_exynos4210.c} |   2 +-
 arch/arm/mach-exynos/dmc_init_exynos4412.c    | 185 ++++++++
 .../{exynos4_setup.h => exynos4210_setup.h}   |   0
 arch/arm/mach-exynos/exynos4412_setup.h       | 425 ++++++++++++++++++
 arch/arm/mach-exynos/include/mach/cpu.h       |   2 +-
 arch/arm/mach-exynos/include/mach/dmc.h       |  19 +
 arch/arm/mach-exynos/include/mach/power.h     | 290 +++++++++++-
 arch/arm/mach-exynos/power.c                  |  12 +
 arch/arm/mach-exynos/spl_boot.c               |  22 +-
 include/configs/exynos4-common.h              |   5 +
Quoted 9 lines
 tools/Makefile                                |   1 +
 15 files changed, 1084 insertions(+), 12 deletions(-)
 rename arch/arm/mach-exynos/{clock_init_exynos4.c => clock_init_exynos4210.c} (99%)
 create mode 100644 arch/arm/mach-exynos/clock_init_exynos4412.c
 rename arch/arm/mach-exynos/{dmc_init_exynos4.c => dmc_init_exynos4210.c} (99%)
 create mode 100644 arch/arm/mach-exynos/dmc_init_exynos4412.c
 rename arch/arm/mach-exynos/{exynos4_setup.h => exynos4210_setup.h} (100%)
 create mode 100644 arch/arm/mach-exynos/exynos4412_setup.h

I've got warning/error.

arch/arm/mach-exynos/spl_boot.c: In function 'copy_uboot_to_ram':
arch/arm/mach-exynos/spl_boot.c:189:6: warning: unused variable 'ret' [-Wunused-variable]

  u32 ret;
      ^~~
  CC      spl/arch/arm/mach-exynos/lowlevel_init.o
  AS      spl/arch/arm/lib/crt0_arm_efi.o
  LD      spl/arch/arm/lib/built-in.o
  CC      spl/arch/arm/lib/reloc_arm_efi.o
  AR      spl/arch/arm/lib/lib.a
  LD      spl/arch/arm/mach-exynos/built-in.o

spl/arch/arm/mach-exynos/dmc_init_exynos4412.o: In function `board_num_mem_chips':
/home/share/Work/u-boot-samsung/arch/arm/mach-exynos/dmc_init_exynos4412.c:35: multiple definition of `mem_ctrl_init' spl/arch/arm/mach-exynos/dmc_init_exynos4210.o:/home/share/Work/u-boot-samsung/arch/arm/mach-exynos/dmc_init_exynos4210.c:169: first defined here spl/arch/arm/mach-exynos/clock_init_exynos4412.o: In function `system_clock_init':
/home/share/Work/u-boot-samsung/arch/arm/mach-exynos/clock_init_exynos4412.c:34: multiple definition of `system_clock_init' spl/arch/arm/mach-exynos/clock_init_exynos4210.o:/home/share/Work/u-boot-samsung/arch/arm/mach-exynos/clock_init_exynos4210.c:40: first defined here make[2]: *** [spl/arch/arm/mach-exynos/built-in.o] Error 1
make[1]: *** [spl/arch/arm/mach-exynos] Error 2
make: *** [spl/u-boot-spl] Error 2

Could you please check?

Thanks,
Minkyu Kang.