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 af7e02c..c16d2f8 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 5aa2d54..7e01677 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 bb21db1..2c90663 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 53b41b5..f38eb21 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 7facf66..4e55e55 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 88b4652..456bb33 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 62ac685..7083a06 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 52f553c..faf8709 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 eb89540..b4f340b 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