diff --git a/arch/arm/mach-rockchip/rk3576/rk3576.c b/arch/arm/mach-rockchip/rk3576/rk3576.c index e3e93f66395..76119cdb1ae 100644 --- a/arch/arm/mach-rockchip/rk3576/rk3576.c +++ b/arch/arm/mach-rockchip/rk3576/rk3576.c @@ -9,7 +9,8 @@ #include #include #include -#include +#include +#include #define SYS_GRF_BASE 0x2600A000 #define SYS_GRF_SOC_CON2 0x0008 @@ -21,6 +22,10 @@ #define GPIO0B_PULL_L 0x0024 #define GPIO0B_IE_L 0x002C +#define TOP_IOC_BASE 0x26044000 +#define IOC_MISC_CON 0x00F0 +#define TOP_IOC_FORCE_JTAG BIT(1) + #define SYS_SGRF_BASE 0x26004000 #define SYS_SGRF_SOC_CON14 0x0058 #define SYS_SGRF_SOC_CON15 0x005C @@ -190,6 +195,11 @@ int arch_cpu_init(void) */ writel(0xffffff00, SYS_SGRF_BASE + SYS_SGRF_SOC_CON20); + /* Disable JTAG exposed on SDMMC pins (GPIO2A2 and GPIO2A3) */ + if (IS_ENABLED(CONFIG_ROCKCHIP_DISABLE_FORCE_JTAG)) + writel(FIELD_PREP_WM16(TOP_IOC_FORCE_JTAG, 0), + TOP_IOC_BASE + IOC_MISC_CON); + /* Disable USB3OTG0 U3 port, later enabled by USBDP PHY driver */ writel(0xffff0188, USB_GRF_BASE + USB3OTG0_CON1);