From: Jagan Teki <jagan@amarulasolutions.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 1/2] rockchip: Add SoC detection helper
Date: Sat, 4 Jul 2020 14:45:02 +0530 [thread overview]
Message-ID: <20200704091503.71121-1-jagan@amarulasolutions.com> (raw)
Rockchip SoC's has a new revision chip for rk3288, rk3308
based SoCs.
RK3288 has a new revision chip called RK3288W which is relevantly
similar but different hclk_vio clock and working ohci host.
Add common rockchip SoC detection helper to support this rk3288w
detection.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v2:
- new patch
arch/arm/include/asm/arch-rockchip/cpu.h | 49 ++++++++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 arch/arm/include/asm/arch-rockchip/cpu.h
diff --git a/arch/arm/include/asm/arch-rockchip/cpu.h b/arch/arm/include/asm/arch-rockchip/cpu.h
new file mode 100644
index 0000000000..d0d22e4967
--- /dev/null
+++ b/arch/arm/include/asm/arch-rockchip/cpu.h
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Rockchip Electronics Co., Ltd.
+ */
+
+#ifndef __ASM_ARCH_CPU_H
+#define __ASM_ARCH_CPU_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
--
2.25.1
next reply other threads:[~2020-07-04 9:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-04 9:15 Jagan Teki [this message]
2020-07-04 9:15 ` [PATCH v2 2/2] rockchip: rk3288: Add OF board setup Jagan Teki
2020-07-08 10:13 ` [PATCH v2 1/2] rockchip: Add SoC detection helper Kever Yang
2020-07-08 10:29 ` Jagan Teki
2020-07-18 3:18 ` Kever Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200704091503.71121-1-jagan@amarulasolutions.com \
--to=jagan@amarulasolutions.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox