[U-Boot] [PATCH] davinci: reduce pimux_config size by storing register id instead of address

Jérôme Carretero cJ-uboot at zougloub.eu
Sun Apr 8 23:02:03 CEST 2012


This patch does nothing except saving a few bytes (makes a difference SPL)

Signed-off-by: Jérôme Carretero <cJ at zougloub.eu>
CC: Manjunathappa, Prakash <prakash.pm at ti.com>
---
 arch/arm/cpu/arm926ejs/davinci/pinmux.c          |    2 +-
 arch/arm/include/asm/arch-davinci/davinci_misc.h |    2 +-
 arch/arm/include/asm/arch-davinci/hardware.h     |    2 +-
 drivers/gpio/da8xx_gpio.c                        |    2 --
 4 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/davinci/pinmux.c b/arch/arm/cpu/arm926ejs/davinci/pinmux.c
index ce58f71..bf7bfbb 100644
--- a/arch/arm/cpu/arm926ejs/davinci/pinmux.c
+++ b/arch/arm/cpu/arm926ejs/davinci/pinmux.c
@@ -65,7 +65,7 @@ int davinci_configure_pin_mux(const struct pinmux_config *pins,
 		const int offset = pins[i].field * PIN_MUX_FIELD_SIZE;
 		const unsigned int value = pins[i].value << offset;
 		const unsigned int mask = PIN_MUX_FIELD_MASK << offset;
-		const dv_reg *mux = pins[i].mux;
+		const dv_reg *mux = &davinci_syscfg_regs->pinmux[pins[i].mux];
 
 		writel(value | (readl(mux) & (~mask)), mux);
 	}
diff --git a/arch/arm/include/asm/arch-davinci/davinci_misc.h b/arch/arm/include/asm/arch-davinci/davinci_misc.h
index 463cbde..64e799b 100644
--- a/arch/arm/include/asm/arch-davinci/davinci_misc.h
+++ b/arch/arm/include/asm/arch-davinci/davinci_misc.h
@@ -29,7 +29,7 @@
 
 /* pin definition */
 struct pinmux_config {
-	dv_reg		*mux;		/* Address of mux register */
+	char		mux;		/* Mux register */
 	unsigned char	value;		/* Value to set in field */
 	unsigned char	field;		/* field number */
 };
diff --git a/arch/arm/include/asm/arch-davinci/hardware.h b/arch/arm/include/asm/arch-davinci/hardware.h
index 994657a..601c6f5 100644
--- a/arch/arm/include/asm/arch-davinci/hardware.h
+++ b/arch/arm/include/asm/arch-davinci/hardware.h
@@ -486,7 +486,7 @@ struct davinci_syscfg_regs {
 #define davinci_syscfg_regs \
 	((struct davinci_syscfg_regs *)DAVINCI_BOOTCFG_BASE)
 
-#define pinmux(x)	(&davinci_syscfg_regs->pinmux[x])
+#define pinmux(x)	(x)
 
 /* Emulation suspend bits */
 #define DAVINCI_SYSCFG_SUSPSRC_EMAC		(1 << 5)
diff --git a/drivers/gpio/da8xx_gpio.c b/drivers/gpio/da8xx_gpio.c
index 4c30fa3..ab05201 100644
--- a/drivers/gpio/da8xx_gpio.c
+++ b/drivers/gpio/da8xx_gpio.c
@@ -31,8 +31,6 @@ static struct gpio_registry {
 	char name[GPIO_NAME_SIZE];
 } gpio_registry[MAX_NUM_GPIOS] = {};
 
-#define pinmux(x)       (&davinci_syscfg_regs->pinmux[x])
-
 static const struct pinmux_config gpio_pinmux[] = {
 	{ pinmux(1), 8, 7 },	/* GP0[0] */
 	{ pinmux(1), 8, 6 },
-- 
1.7.9.4



More information about the U-Boot mailing list