iomux: move iomux_init to plat
authorkfx <kfx@rock-chips.com>
Sat, 5 Jan 2013 03:19:25 +0000 (11:19 +0800)
committerkfx <kfx@rock-chips.com>
Sat, 5 Jan 2013 03:19:25 +0000 (11:19 +0800)
arch/arm/mach-rk2928/include/mach/iomux-rk2928.h
arch/arm/mach-rk2928/iomux.c
arch/arm/mach-rk30/include/mach/iomux-rk30.h
arch/arm/mach-rk30/iomux.c
arch/arm/plat-rk/include/plat/iomux.h
arch/arm/plat-rk/iomux.c

index 8cfdf9de240c6c5de4c5521e3fe11d28ef6a7bb3..0ec1c988c6718e7cd19a5d3904fdd899870bc040 100644 (file)
@@ -125,5 +125,4 @@ enum{
        GPIO3_D7 = 0x3d70, TEST_CLK_OUT, 
 
 };
-void __init iomux_init(void);
 #endif
index 0cbe1ecd6ece150ac690fa62cd096b67a38df4ca..7006402c840e6913d5f6b7f1d3eb15bbfd1bc6aa 100755 (executable)
 #include <mach/iomux.h>
 #include <mach/gpio.h>
 
-/******************** new iomux ********************/
-static unsigned int default_mode[] = {
-       #if defined(CONFIG_UART0_RK29) || (CONFIG_RK_DEBUG_UART == 0)
-        UART0_SOUT, UART0_SIN,
-       #ifdef CONFIG_UART0_CTS_RTS_RK29
-       UART0_RTSN, UART0_CTSN,
-       #endif
-       #endif
-
-       #if defined(CONFIG_UART1_RK29) || (CONFIG_RK_DEBUG_UART == 1)
-       UART1_SIN, UART1_SOUT,
-       #ifdef CONFIG_UART1_CTS_RTS_RK29
-       UART1_CTSN, UART1_RTSN,
-       #endif
-       #endif
-
-       #if defined(CONFIG_UART2_RK29) || (CONFIG_RK_DEBUG_UART == 2)
-        UART2_SIN, UART2_SOUT,
-       #ifdef CONFIG_UART2_CTS_RTS_RK29
-        UART2_RTSN, UART2_CTSN,
-       #endif
-       #endif
-
-       #ifdef CONFIG_SPIM0_RK29
-        SPI0_CLK, SPI0_TXD, SPI0_RXD, SPI0_CSN0,
-       #endif
-
-       #ifdef CONFIG_I2C0_RK30
-        I2C0_SCL, I2C0_SDA,
-       #endif
-
-       #ifdef CONFIG_I2C1_RK30
-        I2C1_SCL, I2C1_SDA,
-       #endif
-
-       #ifdef CONFIG_I2C2_RK30
-        I2C2_SDA, I2C2_SCL,
-       #endif
-
-       #ifdef CONFIG_I2C3_RK30
-        I2C3_SDA, I2C3_SCL,
-       #endif
-};
-void __init iomux_init(void)
-{
-        int i, len;
-
-        len = ARRAY_SIZE(default_mode);
-        for(i = 0; i < len; i++)
-                iomux_set(default_mode[i]);
-        return;
-}
-/***************************************************/
-
 //#define IOMUX_DBG
 #define INVALID_MUX     "invalid"
 static struct mux_config rk30_muxs[] = {
index d82a3258b7c2d82fea889c88dd3a64ff375179f0..5d070db557a0490f7aa1e552791c0abedd137fe7 100644 (file)
@@ -359,6 +359,5 @@ enum{
        /* GPIO6_D */
 };
 #endif
-void __init iomux_init(void);
 
 #endif
index 6dea75fe7cb11e6c8c2ffb43245b42f1eab098eb..b5b7869a1a7d7561daaeaf9f1199056f0e1aecb1 100755 (executable)
 #include <mach/io.h>  
 #include <mach/iomux.h>
 
-/******************** new iomux ********************/
-static unsigned int default_mode[] = {
-       #if defined(CONFIG_UART0_RK29) || (CONFIG_RK_DEBUG_UART == 0)
-        UART0_SOUT, UART0_SIN,
-       #ifdef CONFIG_UART0_CTS_RTS_RK29
-       UART0_RTSN, UART0_CTSN,
-       #endif
-       #endif
-
-       #if defined(CONFIG_UART1_RK29) || (CONFIG_RK_DEBUG_UART == 1)
-       UART1_SIN, UART1_SOUT,
-       #ifdef CONFIG_UART1_CTS_RTS_RK29
-       UART1_CTSN, UART1_RTSN,
-       #endif
-       #endif
-
-       #if defined(CONFIG_UART2_RK29) || (CONFIG_RK_DEBUG_UART == 2)
-        UART2_SIN, UART2_SOUT,
-       #endif
-
-       #if defined(CONFIG_UART3_RK29) || (CONFIG_RK_DEBUG_UART == 3)
-        UART3_SIN, UART3_SOUT,
-       #endif
-
-       #ifdef CONFIG_SPIM0_RK29
-        SPI0_CLK, SPI0_TXD, SPI0_RXD, SPI0_CSN0,
-       #endif
-
-       #ifdef CONFIG_SPIM1_RK29
-        SPI1_CLK, SPI1_TXD, SPI1_RXD, SPI1_CSN0,
-       #endif
-
-       #ifdef CONFIG_I2C0_RK30
-        I2C0_SCL, I2C0_SDA,
-       #endif
-
-       #ifdef CONFIG_I2C1_RK30
-        I2C1_SCL, I2C1_SDA,
-       #endif
-
-       #ifdef CONFIG_I2C2_RK30
-        I2C2_SDA, I2C2_SCL,
-       #endif
-
-       #ifdef CONFIG_I2C3_RK30
-        I2C3_SDA, I2C3_SCL, 
-       #endif
-
-       #ifdef CONFIG_I2C4_RK30
-        I2C4_SDA, I2C4_SCL,
-       #endif
-
-       #ifdef CONFIG_RK30_VMAC
-       RMII_CLKOUT, RMII_TXEN, RMII_TXD1, RMII_TXD0, RMII_RXERR, 
-       RMII_CRS, RMII_RXD1, RMII_RXD0, RMII_MD, RMII_MDCLK,
-       #endif
-};
-
-void __init iomux_init(void)
-{
-        int i, len;
-
-        len = ARRAY_SIZE(default_mode);
-        for(i = 0; i < len; i++)
-                iomux_set(default_mode[i]);
-       
-       return;
-}
-
-/***************************************************/
-
 //#define IOMUX_DBG
 
 #if defined(CONFIG_ARCH_RK3066B)
index 37c7a2a960301f119a869031fef94332c617d3df..443b7d853df76c61ad588027911ea094d8b8692c 100644 (file)
@@ -3,9 +3,12 @@
 
 #define INVALID_MODE   0xffffffff
 
+#define get_gpio_mode(m)       ((m) & 0x03)
+
 int gpio_to_mode(int gpio);
 int mode_to_gpio(unsigned int mode);
 void iomux_set_gpio_mode(int gpio);
 void iomux_set(unsigned int mode);
+void __init iomux_init(void);
 
 #endif
index d3bd579f563c4b9befe2fde37d13562d9ebabf4c..6892629529813f6acd177405b6b004cc351c4ae2 100644 (file)
@@ -37,6 +37,7 @@ static inline int mode_is_valid(unsigned int mode)
                return 1;
 
 }
+
 int mode_to_gpio(unsigned int mode)
 {
         struct union_mode m;
@@ -49,6 +50,7 @@ int mode_to_gpio(unsigned int mode)
         m.mode = mode;
         return PIN_BASE + m.mux.bank * 32 + (m.mux.goff - 0x0A) * 8 + m.mux.off;
 }
+EXPORT_SYMBOL(mode_to_gpio);
 
 int gpio_to_mode(int gpio)
 {
@@ -73,6 +75,7 @@ int gpio_to_mode(int gpio)
 
         return m.mode;
 }
+EXPORT_SYMBOL(gpio_to_mode);
 
 #ifdef GRF_IOMUX_BASE
 void iomux_set(unsigned int mode)
@@ -113,5 +116,74 @@ void iomux_set_gpio_mode(int gpio)
 }
 EXPORT_SYMBOL(iomux_set_gpio_mode);
 
+static unsigned int default_mode[] = {
+#ifdef GRF_IOMUX_BASE
+       #if defined(CONFIG_UART0_RK29) || (CONFIG_RK_DEBUG_UART == 0)
+        UART0_SOUT, UART0_SIN,
+       #ifdef CONFIG_UART0_CTS_RTS_RK29
+       UART0_RTSN, UART0_CTSN,
+       #endif
+       #endif
+
+       #if defined(CONFIG_UART1_RK29) || (CONFIG_RK_DEBUG_UART == 1)
+       UART1_SIN, UART1_SOUT,
+       #ifdef CONFIG_UART1_CTS_RTS_RK29
+       UART1_CTSN, UART1_RTSN,
+       #endif
+       #endif
+
+       #if defined(CONFIG_UART2_RK29) || (CONFIG_RK_DEBUG_UART == 2)
+        UART2_SIN, UART2_SOUT,
+       #endif
+
+       #if defined(CONFIG_UART3_RK29) || (CONFIG_RK_DEBUG_UART == 3)
+        UART3_SIN, UART3_SOUT,
+       #endif
+
+       #ifdef CONFIG_SPIM0_RK29
+        SPI0_CLK, SPI0_TXD, SPI0_RXD, SPI0_CSN0,
+       #endif
+
+       #ifdef CONFIG_SPIM1_RK29
+        SPI1_CLK, SPI1_TXD, SPI1_RXD, SPI1_CSN0,
+       #endif
+
+       #ifdef CONFIG_I2C0_RK30
+        I2C0_SCL, I2C0_SDA,
+       #endif
+
+       #ifdef CONFIG_I2C1_RK30
+        I2C1_SCL, I2C1_SDA,
+       #endif
+
+       #ifdef CONFIG_I2C2_RK30
+        I2C2_SDA, I2C2_SCL,
+       #endif
+
+       #ifdef CONFIG_I2C3_RK30
+        I2C3_SDA, I2C3_SCL, 
+       #endif
+
+       #ifdef CONFIG_I2C4_RK30
+        I2C4_SDA, I2C4_SCL,
+       #endif
+
+       #ifdef CONFIG_RK30_VMAC
+       RMII_CLKOUT, RMII_TXEN, RMII_TXD1, RMII_TXD0, RMII_RXERR, 
+       RMII_CRS, RMII_RXD1, RMII_RXD0, RMII_MD, RMII_MDCLK,
+       #endif
+#endif
+};
 
+void __init iomux_init(void)
+{
+        int i, len;
+
+        len = ARRAY_SIZE(default_mode);
+        for(i = 0; i < len; i++)
+                iomux_set(default_mode[i]);
+       
+       return;
+}
+EXPORT_SYMBOL(iomux_init);