Davinci: eliminate pinmux offset verbosity
authorCyril Chemparathy <cyril@ti.com>
Sat, 1 May 2010 22:38:27 +0000 (18:38 -0400)
committerKevin Hilman <khilman@deeprootsystems.com>
Thu, 6 May 2010 22:02:09 +0000 (15:02 -0700)
Pinmux registers are sequential, and do not need to be enumerated out as they
currently are.  This reduces code volume and keeps things simple.

If some future SoC comes up with a discontiguous register map, PINMUX() can
then be expanded with local token pasting.

Signed-off-by: Cyril Chemparathy <cyril@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
arch/arm/mach-davinci/dm355.c
arch/arm/mach-davinci/dm365.c
arch/arm/mach-davinci/dm644x.c
arch/arm/mach-davinci/dm646x.c
arch/arm/mach-davinci/gpio.c
arch/arm/mach-davinci/include/mach/da8xx.h
arch/arm/mach-davinci/include/mach/mux.h
arch/arm/mach-davinci/mux.h

index f9a54ff2d249477ee7c404910510d62995336222..f91e9a1ab9212829e9bff3f3aea0934a34252acd 100644 (file)
@@ -450,11 +450,6 @@ void __init dm355_init_spi0(unsigned chipselect_mask,
 
 /*----------------------------------------------------------------------*/
 
-#define PINMUX0                0x00
-#define PINMUX1                0x04
-#define PINMUX2                0x08
-#define PINMUX3                0x0c
-#define PINMUX4                0x10
 #define INTMUX         0x18
 #define EVTMUX         0x1c
 
index 05666754aebeb613a4bf7b3a4e5fc7f7670fcf30..f2b1d93b2256ccf0d9918e61e8e40cc69ba8d19c 100644 (file)
@@ -467,11 +467,6 @@ static struct clk_lookup dm365_clks[] = {
 
 /*----------------------------------------------------------------------*/
 
-#define PINMUX0                0x00
-#define PINMUX1                0x04
-#define PINMUX2                0x08
-#define PINMUX3                0x0c
-#define PINMUX4                0x10
 #define INTMUX         0x18
 #define EVTMUX         0x1c
 
index 4af349efbd54ead61b6c4c2afb7856211cf98a21..85c88ecd6cf06e98f78a6bcd7efdd584e325dfa4 100644 (file)
@@ -350,9 +350,6 @@ static struct platform_device dm644x_emac_device = {
        .resource       = dm644x_emac_resources,
 };
 
-#define PINMUX0                0x00
-#define PINMUX1                0x04
-
 /*
  * Device specific mux setup
  *
index bdb1acebe203f1e04f9f9d74c319ed1a37a0f9b2..a8189c919e927c33a0aac3ab549ee440cd5aeaab 100644 (file)
@@ -401,9 +401,6 @@ static struct platform_device dm646x_emac_device = {
        .resource       = dm646x_emac_resources,
 };
 
-#define PINMUX0                0x00
-#define PINMUX1                0x04
-
 /*
  * Device specific mux setup
  *
index b62d5e2bd37ee038108278f35d0476c0dfdae758..2efb4468ebd099e6bf0a979fef6f9d584db52f41 100644 (file)
@@ -71,11 +71,7 @@ static int __init davinci_gpio_irq_setup(void);
 
 /*--------------------------------------------------------------------------*/
 
-/*
- * board setup code *MUST* set PINMUX0 and PINMUX1 as
- * needed, and enable the GPIO clock.
- */
-
+/* board setup code *MUST* setup pinmux and enable the GPIO clock. */
 static inline int __davinci_direction(struct gpio_chip *chip,
                        unsigned offset, bool out, int value)
 {
index 33471c9cbca35ca565137ae2488fac69967a82f4..dbb4ebe4d114aabe064a281083130777f5da4dc9 100644 (file)
@@ -64,27 +64,6 @@ extern void __iomem *da8xx_syscfg1_base;
 #define DA8XX_DDR2_CTL_BASE    0xb0000000
 #define DA8XX_ARM_RAM_BASE     0xffff0000
 
-#define PINMUX0                        0x00
-#define PINMUX1                        0x04
-#define PINMUX2                        0x08
-#define PINMUX3                        0x0c
-#define PINMUX4                        0x10
-#define PINMUX5                        0x14
-#define PINMUX6                        0x18
-#define PINMUX7                        0x1c
-#define PINMUX8                        0x20
-#define PINMUX9                        0x24
-#define PINMUX10               0x28
-#define PINMUX11               0x2c
-#define PINMUX12               0x30
-#define PINMUX13               0x34
-#define PINMUX14               0x38
-#define PINMUX15               0x3c
-#define PINMUX16               0x40
-#define PINMUX17               0x44
-#define PINMUX18               0x48
-#define PINMUX19               0x4c
-
 void __init da830_init(void);
 void __init da850_init(void);
 
index 923debec748733b72ddd0544fc049c2b5449f4dc..743dbd2e0ea3afeaba4e1d3303464ffbc12d3bee 100644 (file)
@@ -1174,6 +1174,8 @@ enum davinci_tnetv107x_index {
        TNETV107X_TDM0_RX,
 };
 
+#define PINMUX(x)              (4 * (x))
+
 #ifdef CONFIG_DAVINCI_MUX
 /* setup pin muxing */
 extern int davinci_cfg_reg(unsigned long reg_cfg);
index adc86941337112fc58ab6baae3b9ca1b5dd6d36c..5aad1e7dd2103d84096d8064a96eb6eca5962767 100644 (file)
@@ -20,7 +20,7 @@
                        .name =  #desc,                                 \
                        .debug = dbg,                                   \
                        .mux_reg_name = "PINMUX"#muxreg,                \
-                       .mux_reg = PINMUX##muxreg,                      \
+                       .mux_reg = PINMUX(muxreg),                      \
                        .mask_offset = mode_offset,                     \
                        .mask = mode_mask,                              \
                        .mode = mux_mode,                               \