From 89e8fbc260aa7ce3d3ba1257db93a73f1c9ad9ce Mon Sep 17 00:00:00 2001 From: kfx Date: Thu, 27 Sep 2012 14:27:54 +0800 Subject: [PATCH] rk2928: add mach/cpu.h: soc_is_rk2926, soc_is_rk2928g, soc_is_rk2928l --- arch/arm/mach-rk2928/common.c | 2 ++ arch/arm/mach-rk2928/include/mach/cpu.h | 28 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100755 arch/arm/mach-rk2928/include/mach/cpu.h diff --git a/arch/arm/mach-rk2928/common.c b/arch/arm/mach-rk2928/common.c index a7ece64b1c4e..bfcbd008f1de 100755 --- a/arch/arm/mach-rk2928/common.c +++ b/arch/arm/mach-rk2928/common.c @@ -15,6 +15,7 @@ #include #include #include +#include static void __init rk2928_cpu_axi_init(void) { @@ -109,6 +110,7 @@ void __init rk2928_init_irq(void) rk_fiq_init(); #endif rk30_gpio_init(); + soc_gpio_init(); } extern void __init rk2928_map_common_io(void); diff --git a/arch/arm/mach-rk2928/include/mach/cpu.h b/arch/arm/mach-rk2928/include/mach/cpu.h new file mode 100755 index 000000000000..11fdb447ebb9 --- /dev/null +++ b/arch/arm/mach-rk2928/include/mach/cpu.h @@ -0,0 +1,28 @@ +#ifndef __MACH_CPU_H +#define __MACH_CPU_H + +#include +#include + +#define SOC_RK2928G 0x01 +#define SOC_RK2928L 0x02 +#define SOC_RK2926 0x00 + +static inline void soc_gpio_init(void) +{ + writel_relaxed(readl_relaxed(RK2928_GPIO3_BASE + 0x04) & (~0x07), RK2928_GPIO3_BASE + 0x04); +} +static inline int soc_is_rk2928g(void) +{ + return ((readl_relaxed(RK2928_GPIO3_BASE + 0x50) & 0x07) == SOC_RK2928G); +} +static inline int soc_is_rk2928l(void) +{ + return ((readl_relaxed(RK2928_GPIO3_BASE + 0x50) & 0x07) == SOC_RK2928L); +} +static inline int soc_is_rk2926(void) +{ + return ((readl_relaxed(RK2928_GPIO3_BASE + 0x50) & 0x07) == SOC_RK2926); +} + +#endif -- 2.34.1