rockchip: rk322x: introduce arch_cpu_init() for SoC setting init
authorKever Yang <kever.yang@rock-chips.com>
Mon, 22 Jul 2019 11:59:19 +0000 (19:59 +0800)
committerKever Yang <kever.yang@rock-chips.com>
Mon, 29 Jul 2019 02:25:27 +0000 (10:25 +0800)
Use arch_cpu_init() to init SoC secure region and move it to
rk322x.c

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
arch/arm/mach-rockchip/rk322x-board-spl.c
arch/arm/mach-rockchip/rk322x/rk322x.c

index c825e31c02dd00a2b5b3b2d67b607e7328537ce6..6bf9e444ce80a58e77e5e838d2dee8d29002860c 100644 (file)
@@ -44,7 +44,11 @@ void rockchip_stimer_init(void)
               TIMER_CONTROL_REG);
 }
 
-#define SGRF_DDR_CON0 0x10150000
+__weak int arch_cpu_init(void)
+{
+       return 0;
+}
+
 void board_init_f(ulong dummy)
 {
        int ret;
@@ -60,9 +64,7 @@ void board_init_f(ulong dummy)
        rockchip_stimer_init();
        /* Init ARM arch timer in arch/arm/cpu/armv7/arch_timer.c */
        timer_init();
-
-       /* Disable the ddr secure region setting to make it non-secure */
-       rk_clrreg(SGRF_DDR_CON0, 0x4000);
+       arch_cpu_init();
 }
 
 #ifdef CONFIG_SPL_LOAD_FIT
index e5250bc78485ad6b3cb00c06f2efce7dba3ae218..c8c656ab4b64910a0f5ff9a14d7e8eb3a81fdf4e 100644 (file)
@@ -42,3 +42,15 @@ void board_debug_uart_init(void)
                     CON_IOMUX_UART2SEL_21 << CON_IOMUX_UART2SEL_SHIFT);
 }
 #endif
+
+int arch_cpu_init(void)
+{
+#ifdef CONFIG_SPL_BUILD
+#define SGRF_BASE      0x10150000
+       static struct rk322x_sgrf * const sgrf = (void *)SGRF_BASE;
+
+       /* Disable the ddr secure region setting to make it non-secure */
+       rk_clrreg(&sgrf->soc_con[0], 0x4000);
+#endif
+       return 0;
+}