ramips: introduce ramips_soc_prom_init and move SoC detection into that
authorGabor Juhos <juhosg@openwrt.org>
Sun, 11 Mar 2012 19:05:53 +0000 (19:05 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Sun, 11 Mar 2012 19:05:53 +0000 (19:05 +0000)
SVN-Revision: 30887

target/linux/ramips/files/arch/mips/include/asm/mach-ralink/common.h
target/linux/ramips/files/arch/mips/include/asm/mach-ralink/rt288x.h
target/linux/ramips/files/arch/mips/include/asm/mach-ralink/rt305x.h
target/linux/ramips/files/arch/mips/include/asm/mach-ralink/rt3883.h
target/linux/ramips/files/arch/mips/ralink/common/prom.c
target/linux/ramips/files/arch/mips/ralink/rt288x/rt288x.c
target/linux/ramips/files/arch/mips/ralink/rt288x/setup.c
target/linux/ramips/files/arch/mips/ralink/rt305x/rt305x.c
target/linux/ramips/files/arch/mips/ralink/rt305x/setup.c
target/linux/ramips/files/arch/mips/ralink/rt3883/rt3883.c
target/linux/ramips/files/arch/mips/ralink/rt3883/setup.c

index 939062b498fe27a13daf16e901db6319d4b00ce5..7be24f7af5de47cb4a90964bff9ae91f39c74776 100644 (file)
@@ -15,6 +15,7 @@ extern unsigned char ramips_sys_type[RAMIPS_SYS_TYPE_LEN];
 void ramips_intc_irq_init(unsigned intc_base, unsigned irq, unsigned irq_base);
 u32 ramips_intc_get_status(void);
 
+void ramips_soc_prom_init(void);
 void ramips_soc_setup(void);
 void ramips_early_serial_setup(int line, unsigned base, unsigned freq,
                               unsigned irq);
index 29c7a72050ecd19da1ce1de7077b02e0b0134baa..ff6c82ec80cd05e15891d8f4911ce5b83d7b610a 100644 (file)
@@ -17,8 +17,6 @@
 #include <linux/init.h>
 #include <linux/io.h>
 
-void rt288x_detect_sys_type(void);
-
 #define RT288X_CPU_IRQ_BASE    0
 #define RT288X_INTC_IRQ_BASE   8
 #define RT288X_INTC_IRQ_COUNT  32
index d1a4df94447d58a9239735544a330e408f9c655f..2e3f9fcbf3466a30b266429657d0d738b8b80f1a 100644 (file)
@@ -16,8 +16,6 @@
 #include <linux/init.h>
 #include <linux/io.h>
 
-void rt305x_detect_sys_type(void);
-
 #define RT305X_MEM_SIZE_MIN (2 * 1024 * 1024)
 #define RT305X_MEM_SIZE_MAX (64 * 1024 * 1024)
 
index 2a88bb838c97c8533c75829a723f250bd49e4676..cf8fb6fd10b7805c618d7d75b60772bb80594d4e 100644 (file)
@@ -16,8 +16,6 @@
 #include <linux/init.h>
 #include <linux/io.h>
 
-void rt3883_detect_sys_type(void);
-
 #define RT3883_MEM_SIZE_MIN (2 * 1024 * 1024)
 #define RT3883_MEM_SIZE_MAX (256 * 1024 * 1024)
 
index fdbcb7979671e29872d05aa78d9427c3270c8207..d3f884b84433ffb0c828912cd601e0c5ce7a1824 100644 (file)
@@ -143,6 +143,8 @@ void __init prom_init(void)
        char **envp;
        char **argv;
 
+       ramips_soc_prom_init();
+
        printk(KERN_DEBUG
               "prom: fw_arg0=%08x, fw_arg1=%08x, fw_arg2=%08x, fw_arg3=%08x\n",
               (unsigned int)fw_arg0, (unsigned int)fw_arg1,
index 53b1a69114f3a277e7ae32de56134154a405fb9f..633e83d8c0276a7ee53434aeafae96c95d853a05 100644 (file)
 void __iomem * rt288x_sysc_base;
 void __iomem * rt288x_memc_base;
 
-void __init rt288x_detect_sys_type(void)
+void __init ramips_soc_prom_init(void)
 {
+       void __iomem *sysc = (void __iomem *) KSEG1ADDR(RT2880_SYSC_BASE);
        u32 n0;
        u32 n1;
        u32 id;
 
-       n0 = rt288x_sysc_rr(SYSC_REG_CHIP_NAME0);
-       n1 = rt288x_sysc_rr(SYSC_REG_CHIP_NAME1);
-       id = rt288x_sysc_rr(SYSC_REG_CHIP_ID);
+       n0 = __raw_readl(sysc + SYSC_REG_CHIP_NAME0);
+       n1 = __raw_readl(sysc + SYSC_REG_CHIP_NAME1);
+       id = __raw_readl(sysc + SYSC_REG_CHIP_ID);
 
        snprintf(ramips_sys_type, RAMIPS_SYS_TYPE_LEN,
                "Ralink %c%c%c%c%c%c%c%c id:%u rev:%u",
index 65e187d3ac9b4362b7250b7aedb2275de83b8a47..be474b5292d87f756d7cd7fb437a561c12856035 100644 (file)
@@ -52,7 +52,6 @@ void __init ramips_soc_setup(void)
        rt288x_sysc_base = ioremap_nocache(RT2880_SYSC_BASE, RT2880_SYSC_SIZE);
        rt288x_memc_base = ioremap_nocache(RT2880_MEMC_BASE, RT2880_MEMC_SIZE);
 
-       rt288x_detect_sys_type();
        rt288x_clocks_init();
 
        clk = clk_get(NULL, "cpu");
index 5916888f066ca37a9c71eb0206957e4eaed6fad7..fa0d0f6cc08b987b9ada7a2f7a37f87e64e7ad4b 100644 (file)
 void __iomem * rt305x_sysc_base;
 void __iomem * rt305x_memc_base;
 
-void __init rt305x_detect_sys_type(void)
+void __init ramips_soc_prom_init(void)
 {
+       void __iomem *sysc = (void __iomem *) KSEG1ADDR(RT305X_SYSC_BASE);
        u32 n0;
        u32 n1;
        u32 id;
 
-       n0 = rt305x_sysc_rr(SYSC_REG_CHIP_NAME0);
-       n1 = rt305x_sysc_rr(SYSC_REG_CHIP_NAME1);
-       id = rt305x_sysc_rr(SYSC_REG_CHIP_ID);
+       n0 = __raw_readl(sysc + SYSC_REG_CHIP_NAME0);
+       n1 = __raw_readl(sysc + SYSC_REG_CHIP_NAME1);
+       id = __raw_readl(sysc + SYSC_REG_CHIP_ID);
 
        snprintf(ramips_sys_type, RAMIPS_SYS_TYPE_LEN,
                "Ralink %c%c%c%c%c%c%c%c id:%u rev:%u",
index 6913006f7e8de5c1b9b538bc40b978501a66152a..5a069db4547a4510db5311f06d371cacf87c02ea 100644 (file)
@@ -52,7 +52,6 @@ void __init ramips_soc_setup(void)
        rt305x_sysc_base = ioremap_nocache(RT305X_SYSC_BASE, PAGE_SIZE);
        rt305x_memc_base = ioremap_nocache(RT305X_MEMC_BASE, PAGE_SIZE);
 
-       rt305x_detect_sys_type();
        rt305x_clocks_init();
 
        clk = clk_get(NULL, "cpu");
index 6e75b390f8c8d8390676a93e53064025f866ba72..8f5994892e6e9600370a9221736de2ea8368740a 100644 (file)
 void __iomem * rt3883_sysc_base;
 void __iomem * rt3883_memc_base;
 
-void __init rt3883_detect_sys_type(void)
+void __init ramips_soc_prom_init(void)
 {
+       void __iomem *sysc = (void __iomem *) KSEG1ADDR(RT3883_SYSC_BASE);
        u32 n0;
        u32 n1;
        u32 id;
 
-       n0 = rt3883_sysc_rr(RT3883_SYSC_REG_CHIPID0_3);
-       n1 = rt3883_sysc_rr(RT3883_SYSC_REG_CHIPID4_7);
-       id = rt3883_sysc_rr(RT3883_SYSC_REG_REVID);
+       n0 = __raw_readl(sysc + RT3883_SYSC_REG_CHIPID0_3);
+       n1 = __raw_readl(sysc + RT3883_SYSC_REG_CHIPID4_7);
+       id = __raw_readl(sysc + RT3883_SYSC_REG_REVID);
 
        snprintf(ramips_sys_type, RAMIPS_SYS_TYPE_LEN,
                "Ralink %c%c%c%c%c%c%c%c ver:%u eco:%u",
index f4c7296fa4206ca768bbb5ca8aac29943c8fde90..6e037a7291d09a67b1215cb87286efa222e5b47b 100644 (file)
@@ -52,7 +52,6 @@ void __init ramips_soc_setup(void)
        rt3883_sysc_base = ioremap_nocache(RT3883_SYSC_BASE, PAGE_SIZE);
        rt3883_memc_base = ioremap_nocache(RT3883_MEMC_BASE, PAGE_SIZE);
 
-       rt3883_detect_sys_type();
        rt3883_clocks_init();
 
        clk = clk_get(NULL, "cpu");