blob: 7445e64b8c728ccee66b715dec89a10e7c3b6050 [file] [log] [blame]
Jagan Tekid9a22412020-07-21 12:16:37 +05301/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Rockchip Electronics Co., Ltd.
4 */
5
6#ifndef __ASM_ARCH_CPU_RK3288_H
7#define __ASM_ARCH_CPU_RK3288_H
8
9#include <asm/io.h>
10
11#define ROCKCHIP_CPU_MASK 0xffff0000
12#define ROCKCHIP_CPU_RK3288 0x32880000
13
14#define ROCKCHIP_SOC_MASK (ROCKCHIP_CPU_MASK | 0xff)
15#define ROCKCHIP_SOC_RK3288 (ROCKCHIP_CPU_RK3288 | 0x00)
16#define ROCKCHIP_SOC_RK3288W (ROCKCHIP_CPU_RK3288 | 0x01)
17
18#define RK3288_HDMI_PHYS 0xff980000
19#define HDMI_CONFIG0_ID 0x4
20#define RK3288W_HDMI_REVID 0x1a
21
22static inline int rockchip_soc_id(void)
23{
24 u8 reg;
25
26#if defined(CONFIG_ROCKCHIP_RK3288)
27 reg = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID);
28 if (reg == RK3288W_HDMI_REVID)
29 return ROCKCHIP_SOC_RK3288W;
30 else
31 return ROCKCHIP_SOC_RK3288;
32#else
33 return 0;
34#endif
35}
36
37#define ROCKCHIP_SOC(id, ID) \
38static inline bool soc_is_##id(void) \
39{ \
40 int soc_id = rockchip_soc_id(); \
41 if (soc_id) \
42 return ((soc_id & ROCKCHIP_SOC_MASK) == ROCKCHIP_SOC_ ##ID); \
43 return false; \
44}
45
46ROCKCHIP_SOC(rk3288, RK3288)
47ROCKCHIP_SOC(rk3288w, RK3288W)
48
49#endif /* __ASM_ARCH_CPU_RK3288_H */