rk2928: add mach/cpu.h: soc_is_rk2926, soc_is_rk2928g, soc_is_rk2928l
authorkfx <kfx@rock-chips.com>
Thu, 27 Sep 2012 06:27:54 +0000 (14:27 +0800)
committerkfx <kfx@rock-chips.com>
Thu, 27 Sep 2012 06:27:54 +0000 (14:27 +0800)
arch/arm/mach-rk2928/common.c
arch/arm/mach-rk2928/include/mach/cpu.h [new file with mode: 0755]

index a7ece64b1c4e086daf91b62c348a0a8fa2179325..bfcbd008f1de5101afe739822c0272c48d03ea17 100755 (executable)
@@ -15,6 +15,7 @@
 #include <mach/fiq.h>
 #include <mach/loader.h>
 #include <mach/ddr.h>
+#include <mach/cpu.h>
 
 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 (executable)
index 0000000..11fdb44
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef __MACH_CPU_H
+#define __MACH_CPU_H
+
+#include <mach/io.h>
+#include <linux/io.h>
+
+#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