ARM: 6678/1: SPEAr: update padmux code
authorviresh kumar <viresh.kumar@st.com>
Wed, 16 Feb 2011 06:40:30 +0000 (07:40 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Wed, 9 Mar 2011 09:49:44 +0000 (09:49 +0000)
- compile padmux only for spear3xx
- padmux initialization code rearranged in evaluation board and machine
  files.

Reviewed-by: Stanley Miao <stanley.miao@windriver.com>
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-spear3xx/include/mach/generic.h
arch/arm/mach-spear3xx/spear300.c
arch/arm/mach-spear3xx/spear300_evb.c
arch/arm/mach-spear3xx/spear310.c
arch/arm/mach-spear3xx/spear310_evb.c
arch/arm/mach-spear3xx/spear320.c
arch/arm/mach-spear3xx/spear320_evb.c
arch/arm/mach-spear3xx/spear3xx.c
arch/arm/plat-spear/Makefile

index af7e02c909a3efde91a8c49f05bf2dc7595875be..c16d2f8025e986a20e485e8a0a6df152231599d8 100644 (file)
@@ -40,7 +40,6 @@ void __init clk_init(void);
 void __init spear3xx_map_io(void);
 void __init spear3xx_init_irq(void);
 void __init spear3xx_init(void);
-void spear_pmx_init(struct pmx_driver *pmx_driver, uint base, uint size);
 
 /* pad mux declarations */
 #define PMX_FIRDA_MASK         (1 << 14)
@@ -133,8 +132,6 @@ extern struct pmx_dev pmx_telecom_sdio_4bit;
 extern struct pmx_dev pmx_telecom_sdio_8bit;
 extern struct pmx_dev pmx_gpio1;
 
-void spear300_pmx_init(void);
-
 /* Add spear300 machine function declarations here */
 void __init spear300_init(void);
 
@@ -154,8 +151,6 @@ extern struct pmx_dev pmx_fsmc;
 extern struct pmx_dev pmx_rs485_0_1;
 extern struct pmx_dev pmx_tdm0;
 
-void spear310_pmx_init(void);
-
 /* Add spear310 machine function declarations here */
 void __init spear310_init(void);
 
@@ -195,8 +190,6 @@ extern struct pmx_dev pmx_smii0;
 extern struct pmx_dev pmx_smii1;
 extern struct pmx_dev pmx_i2c1;
 
-void spear320_pmx_init(void);
-
 /* Add spear320 machine function declarations here */
 void __init spear320_init(void);
 
index 5aa2d54ebfaafc3b6f757cefb5679081b7a321f1..7e01677e2fc266b0199e753f234701503b643d20 100644 (file)
@@ -459,10 +459,16 @@ void __init spear300_init(void)
                if (ret)
                        printk(KERN_ERR "Error registering Shared IRQ\n");
        }
-}
 
-void spear300_pmx_init(void)
-{
-       spear_pmx_init(&pmx_driver, SPEAR300_SOC_CONFIG_BASE,
+       /* pmx initialization */
+       pmx_driver.base = ioremap(SPEAR300_SOC_CONFIG_BASE,
                        SPEAR300_SOC_CONFIG_SIZE);
+       if (pmx_driver.base) {
+               ret = pmx_register(&pmx_driver);
+               if (ret)
+                       printk(KERN_ERR "padmux: registeration failed. err no"
+                                       ": %d\n", ret);
+               /* Free Mapping, device selection already done */
+               iounmap(pmx_driver.base);
+       }
 }
index bb21db152a236adad4311a4a420dd4f93e4d4cf3..2c90663e5c71df3c61c94a945163f8ed6409ccb4 100644 (file)
@@ -51,14 +51,13 @@ static void __init spear300_evb_init(void)
 {
        unsigned int i;
 
-       /* call spear300 machine init function */
-       spear300_init();
-
-       /* padmux initialization */
+       /* padmux initialization, must be done before spear300_init */
        pmx_driver.mode = &photo_frame_mode;
        pmx_driver.devs = pmx_devs;
        pmx_driver.devs_count = ARRAY_SIZE(pmx_devs);
-       spear300_pmx_init();
+
+       /* call spear300 machine init function */
+       spear300_init();
 
        /* Add Platform Devices */
        platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
index 53b41b52d7ee503a9ecb283641931ad240670a24..f38eb2146e2fe8077a2870a4a3fffc61548ed04e 100644 (file)
@@ -293,10 +293,11 @@ void __init spear310_init(void)
                if (ret)
                        printk(KERN_ERR "Error registering Shared IRQ 4\n");
        }
-}
 
-void spear310_pmx_init(void)
-{
-       spear_pmx_init(&pmx_driver, SPEAR310_SOC_CONFIG_BASE,
-                       SPEAR310_SOC_CONFIG_SIZE);
+       /* pmx initialization */
+       pmx_driver.base = base;
+       ret = pmx_register(&pmx_driver);
+       if (ret)
+               printk(KERN_ERR "padmux: registeration failed. err no: %d\n",
+                               ret);
 }
index 7facf6643199beacccc10c94e704a49be0ded8c8..4e55e553a2cf5284edf8762aacfdee424bcd88f4 100644 (file)
@@ -58,14 +58,13 @@ static void __init spear310_evb_init(void)
 {
        unsigned int i;
 
-       /* call spear310 machine init function */
-       spear310_init();
-
-       /* padmux initialization */
+       /* padmux initialization, must be done before spear310_init */
        pmx_driver.mode = NULL;
        pmx_driver.devs = pmx_devs;
        pmx_driver.devs_count = ARRAY_SIZE(pmx_devs);
-       spear310_pmx_init();
+
+       /* call spear310 machine init function */
+       spear310_init();
 
        /* Add Platform Devices */
        platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
index 88b465284c3607f25cea4775beaa9bd6e13e77ff..456bb331340f853abb3e2aaed946f55fd11c9878 100644 (file)
@@ -540,10 +540,11 @@ void __init spear320_init(void)
                if (ret)
                        printk(KERN_ERR "Error registering Shared IRQ 4\n");
        }
-}
 
-void spear320_pmx_init(void)
-{
-       spear_pmx_init(&pmx_driver, SPEAR320_SOC_CONFIG_BASE,
-                       SPEAR320_SOC_CONFIG_SIZE);
+       /* pmx initialization */
+       pmx_driver.base = base;
+       ret = pmx_register(&pmx_driver);
+       if (ret)
+               printk(KERN_ERR "padmux: registeration failed. err no: %d\n",
+                               ret);
 }
index 62ac685a41357070530afc04943608565ba15008..7083a06df9b6610d2a8f8a1ea735495105f33703 100644 (file)
@@ -55,14 +55,13 @@ static void __init spear320_evb_init(void)
 {
        unsigned int i;
 
-       /* call spear320 machine init function */
-       spear320_init();
-
-       /* padmux initialization */
+       /* padmux initialization, must be done before spear320_init */
        pmx_driver.mode = &auto_net_mii_mode;
        pmx_driver.devs = pmx_devs;
        pmx_driver.devs_count = ARRAY_SIZE(pmx_devs);
-       spear320_pmx_init();
+
+       /* call spear320 machine init function */
+       spear320_init();
 
        /* Add Platform Devices */
        platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
index 52f553c8c46d90562911544906383ec5f3cdc5be..faf87097767d6a31ab088204935dea9c8e5b8ff9 100644 (file)
@@ -525,24 +525,3 @@ struct pmx_dev pmx_plgpio_45_46_49_50 = {
 };
 
 #endif
-
-/* spear padmux initialization function */
-void spear_pmx_init(struct pmx_driver *pmx_driver, uint base, uint size)
-{
-       int ret = 0;
-
-       /* pad mux initialization */
-       pmx_driver->base = ioremap(base, size);
-       if (!pmx_driver->base) {
-               ret = -ENOMEM;
-               goto pmx_fail;
-       }
-
-       ret = pmx_register(pmx_driver);
-       iounmap(pmx_driver->base);
-
-pmx_fail:
-       if (ret)
-               printk(KERN_ERR "padmux: registration failed. err no: %d\n",
-                               ret);
-}
index eb89540aeda910dbfb764981470e7395c25f24a8..b4f340b8f1f1eeedfd630c13dba27dfe7710d51d 100644 (file)
@@ -3,6 +3,6 @@
 #
 
 # Common support
-obj-y  := clock.o padmux.o time.o
+obj-y  := clock.o time.o
 
-obj-$(CONFIG_ARCH_SPEAR3XX)    += shirq.o
+obj-$(CONFIG_ARCH_SPEAR3XX)    += shirq.o padmux.o