From f79adc89c30499428a3015800a14d84391090d6a Mon Sep 17 00:00:00 2001 From: Joseph Chen Date: Tue, 19 May 2020 16:48:22 +0800 Subject: [PATCH] rockchip: rv1126: support usbplug Signed-off-by: Joseph Chen Signed-off-by: Yifeng Zhao Change-Id: I841df666100e78dda2bac4b7ce9a8495a5e4a171 --- arch/arm/mach-rockchip/Kconfig | 10 +++++----- arch/arm/mach-rockchip/rv1126/rv1126.c | 14 +++++++++++++- include/configs/evb_rv1126.h | 3 +++ include/configs/rv1126_common.h | 5 +++++ 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig index 454a419d79..39fa942978 100644 --- a/arch/arm/mach-rockchip/Kconfig +++ b/arch/arm/mach-rockchip/Kconfig @@ -423,12 +423,12 @@ endif config ROCKCHIP_RV1126 bool "Support Rockchip RV1126" select CPU_V7 - select GICV2 - select ARM_SMCCC - select BOARD_LATE_INIT - select SUPPORT_SPL + select GICV2 if !SUPPORT_USBPLUG + select ARM_SMCCC if !SUPPORT_USBPLUG select SUPPORT_TPL - select SPL + select SUPPORT_SPL + select SPL if !SUPPORT_USBPLUG + select BOARD_LATE_INIT if !SUPPORT_USBPLUG help The Rockchip RV1126 is a ARM-based SoC with a quad-core Cortex-A7 and a risc-v core. diff --git a/arch/arm/mach-rockchip/rv1126/rv1126.c b/arch/arm/mach-rockchip/rv1126/rv1126.c index 8ef9ab2d42..34b774d593 100644 --- a/arch/arm/mach-rockchip/rv1126/rv1126.c +++ b/arch/arm/mach-rockchip/rv1126/rv1126.c @@ -56,6 +56,8 @@ DECLARE_GLOBAL_DATA_PTR; #define SGRF_CON_SCR1_BOOT_ADDR 0x0b0 #define SGRF_SOC_CON3 0x00c #define SCR1_START_ADDR 0x208000 +#define CRU_SOFTRST_CON11 0xFF49032C +#define PMUGRF_SOC_CON1 0xFE020104 void board_debug_uart_init(void) { @@ -64,7 +66,7 @@ void board_debug_uart_init(void) int arch_cpu_init(void) { -#if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD) +#if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD) || defined(CONFIG_SUPPORT_USBPLUG) /* Just set region 0 to unsecure */ writel(0, FIREWALL_APB_BASE + FW_DDR_CON_REG); #endif @@ -141,6 +143,16 @@ int arch_cpu_init(void) writel(0x101, CRYPTO_PRIORITY_REG); #endif +#if defined(CONFIG_SUPPORT_USBPLUG) + /* reset usbphy_otg usbphypor_otg */ + writel(((0x1 << 6 | (1 << 8)) << 16) | (0x1 << 6) | (1 << 8), CRU_SOFTRST_CON11); + udelay(50); + writel(((0x1 << 6 | (1 << 8)) << 16) | (0), CRU_SOFTRST_CON11); + + /* hold pmugrf's io reset */ + writel(0x1 << 7 | 1 << 23, PMUGRF_SOC_CON1); +#endif + return 0; } diff --git a/include/configs/evb_rv1126.h b/include/configs/evb_rv1126.h index b29d8dc8a6..5688faa496 100644 --- a/include/configs/evb_rv1126.h +++ b/include/configs/evb_rv1126.h @@ -9,7 +9,10 @@ #include +#ifndef CONFIG_SUPPORT_USBPLUG #define CONFIG_SUPPORT_EMMC_RPMB +#endif + #define CONFIG_SYS_MMC_ENV_DEV 0 #define ROCKCHIP_DEVICE_SETTINGS \ diff --git a/include/configs/rv1126_common.h b/include/configs/rv1126_common.h index e3803c1827..933917f3f0 100644 --- a/include/configs/rv1126_common.h +++ b/include/configs/rv1126_common.h @@ -15,7 +15,12 @@ #define CONFIG_SKIP_LOWLEVEL_INIT #define CONFIG_SYS_NS16550_MEM32 +#ifdef CONFIG_SUPPORT_USBPLUG +#define CONFIG_SYS_TEXT_BASE 0x00000000 +#else #define CONFIG_SYS_TEXT_BASE 0x00400000 +#endif + #define CONFIG_SYS_INIT_SP_ADDR 0x00580000 #define CONFIG_SYS_LOAD_ADDR 0x00C00800 #define CONFIG_SYS_BOOTM_LEN (64 << 20)