summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJagan Teki <jagan@amarulasolutions.com>2020-07-21 09:46:37 +0300
committerKever Yang <kever.yang@rock-chips.com>2020-07-22 15:55:13 +0300
commitc60d1c4e17ee14910e1f11192b34e33984de972d (patch)
tree46f79a6f16034471f47357f4a52c33b202d10a63
parent1f1395405fc633afe93fae4d923a84452412734b (diff)
downloadu-boot-c60d1c4e17ee14910e1f11192b34e33984de972d.tar.xz
rockchip: Add rk3288 SoC detection helper
Rockchip SoC's has a new revision chip for rk3288 SoCs. RK3288 has a new revision chip called RK3288W which is similar but different hclk_vio clock and fixed OHCI host. Add common Rockchip SoC detection helper to support this rk3288w detection. Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
-rw-r--r--arch/arm/include/asm/arch-rockchip/cpu_rk3288.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/arch/arm/include/asm/arch-rockchip/cpu_rk3288.h b/arch/arm/include/asm/arch-rockchip/cpu_rk3288.h
new file mode 100644
index 0000000000..7445e64b8c
--- /dev/null
+++ b/arch/arm/include/asm/arch-rockchip/cpu_rk3288.h
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Rockchip Electronics Co., Ltd.
+ */
+
+#ifndef __ASM_ARCH_CPU_RK3288_H
+#define __ASM_ARCH_CPU_RK3288_H
+
+#include <asm/io.h>
+
+#define ROCKCHIP_CPU_MASK 0xffff0000
+#define ROCKCHIP_CPU_RK3288 0x32880000
+
+#define ROCKCHIP_SOC_MASK (ROCKCHIP_CPU_MASK | 0xff)
+#define ROCKCHIP_SOC_RK3288 (ROCKCHIP_CPU_RK3288 | 0x00)
+#define ROCKCHIP_SOC_RK3288W (ROCKCHIP_CPU_RK3288 | 0x01)
+
+#define RK3288_HDMI_PHYS 0xff980000
+#define HDMI_CONFIG0_ID 0x4
+#define RK3288W_HDMI_REVID 0x1a
+
+static inline int rockchip_soc_id(void)
+{
+ u8 reg;
+
+#if defined(CONFIG_ROCKCHIP_RK3288)
+ reg = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID);
+ if (reg == RK3288W_HDMI_REVID)
+ return ROCKCHIP_SOC_RK3288W;
+ else
+ return ROCKCHIP_SOC_RK3288;
+#else
+ return 0;
+#endif
+}
+
+#define ROCKCHIP_SOC(id, ID) \
+static inline bool soc_is_##id(void) \
+{ \
+ int soc_id = rockchip_soc_id(); \
+ if (soc_id) \
+ return ((soc_id & ROCKCHIP_SOC_MASK) == ROCKCHIP_SOC_ ##ID); \
+ return false; \
+}
+
+ROCKCHIP_SOC(rk3288, RK3288)
+ROCKCHIP_SOC(rk3288w, RK3288W)
+
+#endif /* __ASM_ARCH_CPU_RK3288_H */