Patchwork [U-Boot,RFC,v2,03/12] arm, da850: Move the definitions of pinmux configurations to the arch tree

login
register
mail settings
Submitter Christian Riesch
Date Nov. 21, 2011, 4:33 p.m.
Message ID <1321893227-19545-5-git-send-email-christian.riesch@omicron.at>
Download mbox | patch
Permalink /patch/126837/
State Superseded
Delegated to: Tom Rini
Headers show

Comments

Christian Riesch - Nov. 21, 2011, 4:33 p.m.
The boards in board/davinci/da8xxevm/ define pinmux_config[] vectors
that contain pinmux configurations for emac, uarts, memory controllers...
This patch moves common configurations to a header file in the
arch tree for the da850evm and the hawkboard.

Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
Cc: Sandeep Paulraj <s-paulraj@ti.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
Cc: Syed Mohammed Khasim <sm.khasim@gmail.com>
Cc: Sughosh Ganu <urwithsughosh@gmail.com>
---
 arch/arm/include/asm/arch-davinci/da850_pinmux.h |  152 ++++++++++++++++++++++
 board/davinci/da8xxevm/da850evm.c                |  135 ++------------------
 board/davinci/da8xxevm/hawkboard_nand_spl.c      |   43 +------
 3 files changed, 165 insertions(+), 165 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-davinci/da850_pinmux.h
Mike Frysinger - Nov. 21, 2011, 7:03 p.m.
On Monday 21 November 2011 11:33:38 Christian Riesch wrote:
> --- /dev/null
> +++ b/arch/arm/include/asm/arch-davinci/da850_pinmux.h
>
> +const struct pinmux_config spi1_pins[] = {
> +	{ pinmux(5), 1, 1 },
> +	{ pinmux(5), 1, 2 },
> +	{ pinmux(5), 1, 4 },
> +	{ pinmux(5), 1, 5 }
> +};

variable storage should not be in headers.  why can't this be in a C file ?
-mike
Christian Riesch - Nov. 22, 2011, 7:26 a.m.
Hello Mike,
Thank you for your comments.

On Mon, Nov 21, 2011 at 8:03 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Monday 21 November 2011 11:33:38 Christian Riesch wrote:
>> --- /dev/null
>> +++ b/arch/arm/include/asm/arch-davinci/da850_pinmux.h
>>
>> +const struct pinmux_config spi1_pins[] = {
>> +     { pinmux(5), 1, 1 },
>> +     { pinmux(5), 1, 2 },
>> +     { pinmux(5), 1, 4 },
>> +     { pinmux(5), 1, 5 }
>> +};
>
> variable storage should not be in headers.  why can't this be in a C file ?

Ok, I'll move them to a C file.
Regards, Christian

Patch

diff --git a/arch/arm/include/asm/arch-davinci/da850_pinmux.h b/arch/arm/include/asm/arch-davinci/da850_pinmux.h
new file mode 100644
index 0000000..53df3f7
--- /dev/null
+++ b/arch/arm/include/asm/arch-davinci/da850_pinmux.h
@@ -0,0 +1,152 @@ 
+/*
+ * Pinmux configurations for the DA850 SoCs
+ *
+ * Copyright (C) 2011 OMICRON electronics GmbH
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __ASM_ARCH_DA850_PINMUX_H
+#define __ASM_ARCH_DA850_PINMUX_H
+
+#include <asm/arch/hardware.h>
+#include <asm/arch/davinci_misc.h>
+
+/* SPI pin muxer settings */
+const struct pinmux_config spi1_pins[] = {
+	{ pinmux(5), 1, 1 },
+	{ pinmux(5), 1, 2 },
+	{ pinmux(5), 1, 4 },
+	{ pinmux(5), 1, 5 }
+};
+
+/* UART pin muxer settings */
+const struct pinmux_config uart2_pins[] = {
+	{ pinmux(0), 4, 6 },
+	{ pinmux(0), 4, 7 },
+	{ pinmux(4), 2, 4 },
+	{ pinmux(4), 2, 5 }
+};
+
+/* EMAC pin muxer settings*/
+const struct pinmux_config emac_pins[] = {
+#ifdef CONFIG_DRIVER_TI_EMAC_USE_RMII
+	{ pinmux(14), 8, 2 },
+	{ pinmux(14), 8, 3 },
+	{ pinmux(14), 8, 4 },
+	{ pinmux(14), 8, 5 },
+	{ pinmux(14), 8, 6 },
+	{ pinmux(14), 8, 7 },
+	{ pinmux(15), 8, 1 },
+#else /* ! CONFIG_DRIVER_TI_EMAC_USE_RMII */
+	{ pinmux(2), 8, 1 },
+	{ pinmux(2), 8, 2 },
+	{ pinmux(2), 8, 3 },
+	{ pinmux(2), 8, 4 },
+	{ pinmux(2), 8, 5 },
+	{ pinmux(2), 8, 6 },
+	{ pinmux(2), 8, 7 },
+	{ pinmux(3), 8, 0 },
+	{ pinmux(3), 8, 1 },
+	{ pinmux(3), 8, 2 },
+	{ pinmux(3), 8, 3 },
+	{ pinmux(3), 8, 4 },
+	{ pinmux(3), 8, 5 },
+	{ pinmux(3), 8, 6 },
+	{ pinmux(3), 8, 7 },
+#endif /* CONFIG_DRIVER_TI_EMAC_USE_RMII */
+	{ pinmux(4), 8, 0 },
+	{ pinmux(4), 8, 1 }
+};
+
+/* I2C pin muxer settings */
+const struct pinmux_config i2c0_pins[] = {
+	{ pinmux(4), 2, 2 },
+	{ pinmux(4), 2, 3 }
+};
+
+const struct pinmux_config i2c1_pins[] = {
+	{ pinmux(4), 4, 4 },
+	{ pinmux(4), 4, 5 }
+};
+
+/* NAND pin muxer settings */
+const struct pinmux_config nand_pins[] = {
+	{ pinmux(7), 1, 1 },
+	{ pinmux(7), 1, 2 },
+	{ pinmux(7), 1, 4 },
+	{ pinmux(7), 1, 5 },
+	{ pinmux(9), 1, 0 },
+	{ pinmux(9), 1, 1 },
+	{ pinmux(9), 1, 2 },
+	{ pinmux(9), 1, 3 },
+	{ pinmux(9), 1, 4 },
+	{ pinmux(9), 1, 5 },
+	{ pinmux(9), 1, 6 },
+	{ pinmux(9), 1, 7 },
+	{ pinmux(12), 1, 5 },
+	{ pinmux(12), 1, 6 }
+};
+
+/* NOR pin muxer settings */
+const struct pinmux_config nor_pins[] = {
+	{ pinmux(5), 1, 6 },
+	{ pinmux(6), 1, 6 },
+	{ pinmux(7), 1, 0 },
+	{ pinmux(7), 1, 4 },
+	{ pinmux(7), 1, 5 },
+	{ pinmux(8), 1, 0 },
+	{ pinmux(8), 1, 1 },
+	{ pinmux(8), 1, 2 },
+	{ pinmux(8), 1, 3 },
+	{ pinmux(8), 1, 4 },
+	{ pinmux(8), 1, 5 },
+	{ pinmux(8), 1, 6 },
+	{ pinmux(8), 1, 7 },
+	{ pinmux(9), 1, 0 },
+	{ pinmux(9), 1, 1 },
+	{ pinmux(9), 1, 2 },
+	{ pinmux(9), 1, 3 },
+	{ pinmux(9), 1, 4 },
+	{ pinmux(9), 1, 5 },
+	{ pinmux(9), 1, 6 },
+	{ pinmux(9), 1, 7 },
+	{ pinmux(10), 1, 0 },
+	{ pinmux(10), 1, 1 },
+	{ pinmux(10), 1, 2 },
+	{ pinmux(10), 1, 3 },
+	{ pinmux(10), 1, 4 },
+	{ pinmux(10), 1, 5 },
+	{ pinmux(10), 1, 6 },
+	{ pinmux(10), 1, 7 },
+	{ pinmux(11), 1, 0 },
+	{ pinmux(11), 1, 1 },
+	{ pinmux(11), 1, 2 },
+	{ pinmux(11), 1, 3 },
+	{ pinmux(11), 1, 4 },
+	{ pinmux(11), 1, 5 },
+	{ pinmux(11), 1, 6 },
+	{ pinmux(11), 1, 7 },
+	{ pinmux(12), 1, 0 },
+	{ pinmux(12), 1, 1 },
+	{ pinmux(12), 1, 2 },
+	{ pinmux(12), 1, 3 },
+	{ pinmux(12), 1, 4 },
+	{ pinmux(12), 1, 5 },
+	{ pinmux(12), 1, 6 },
+	{ pinmux(12), 1, 7 }
+};
+
+#endif
diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index 844e585..7bc16e7 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -28,135 +28,14 @@ 
 #include <asm/arch/hardware.h>
 #include <asm/arch/emif_defs.h>
 #include <asm/arch/emac_defs.h>
+#include <asm/arch/da850_pinmux.h>
 #include <asm/io.h>
 #include <asm/arch/davinci_misc.h>
 #include <hwconfig.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-/* SPI0 pin muxer settings */
-static const struct pinmux_config spi1_pins[] = {
-	{ pinmux(5), 1, 1 },
-	{ pinmux(5), 1, 2 },
-	{ pinmux(5), 1, 4 },
-	{ pinmux(5), 1, 5 }
-};
-
-/* UART pin muxer settings */
-static const struct pinmux_config uart_pins[] = {
-	{ pinmux(0), 4, 6 },
-	{ pinmux(0), 4, 7 },
-	{ pinmux(4), 2, 4 },
-	{ pinmux(4), 2, 5 }
-};
-
 #ifdef CONFIG_DRIVER_TI_EMAC
-static const struct pinmux_config emac_pins[] = {
-#ifdef CONFIG_DRIVER_TI_EMAC_USE_RMII
-	{ pinmux(14), 8, 2 },
-	{ pinmux(14), 8, 3 },
-	{ pinmux(14), 8, 4 },
-	{ pinmux(14), 8, 5 },
-	{ pinmux(14), 8, 6 },
-	{ pinmux(14), 8, 7 },
-	{ pinmux(15), 8, 1 },
-#else /* ! CONFIG_DRIVER_TI_EMAC_USE_RMII */
-	{ pinmux(2), 8, 1 },
-	{ pinmux(2), 8, 2 },
-	{ pinmux(2), 8, 3 },
-	{ pinmux(2), 8, 4 },
-	{ pinmux(2), 8, 5 },
-	{ pinmux(2), 8, 6 },
-	{ pinmux(2), 8, 7 },
-	{ pinmux(3), 8, 0 },
-	{ pinmux(3), 8, 1 },
-	{ pinmux(3), 8, 2 },
-	{ pinmux(3), 8, 3 },
-	{ pinmux(3), 8, 4 },
-	{ pinmux(3), 8, 5 },
-	{ pinmux(3), 8, 6 },
-	{ pinmux(3), 8, 7 },
-#endif /* CONFIG_DRIVER_TI_EMAC_USE_RMII */
-	{ pinmux(4), 8, 0 },
-	{ pinmux(4), 8, 1 }
-};
-
-/* I2C pin muxer settings */
-static const struct pinmux_config i2c_pins[] = {
-	{ pinmux(4), 2, 2 },
-	{ pinmux(4), 2, 3 }
-};
-
-#ifdef CONFIG_NAND_DAVINCI
-const struct pinmux_config nand_pins[] = {
-	{ pinmux(7), 1, 1 },
-	{ pinmux(7), 1, 2 },
-	{ pinmux(7), 1, 4 },
-	{ pinmux(7), 1, 5 },
-	{ pinmux(9), 1, 0 },
-	{ pinmux(9), 1, 1 },
-	{ pinmux(9), 1, 2 },
-	{ pinmux(9), 1, 3 },
-	{ pinmux(9), 1, 4 },
-	{ pinmux(9), 1, 5 },
-	{ pinmux(9), 1, 6 },
-	{ pinmux(9), 1, 7 },
-	{ pinmux(12), 1, 5 },
-	{ pinmux(12), 1, 6 }
-};
-#elif defined(CONFIG_USE_NOR)
-/* NOR pin muxer settings */
-const struct pinmux_config nor_pins[] = {
-	/* GP0[11] is required for NOR to work on Rev 3 EVMs */
-	{ pinmux(0), 8, 4 },	/* GP0[11] */
-	{ pinmux(5), 1, 6 },
-	{ pinmux(6), 1, 6 },
-	{ pinmux(7), 1, 0 },
-	{ pinmux(7), 1, 4 },
-	{ pinmux(7), 1, 5 },
-	{ pinmux(8), 1, 0 },
-	{ pinmux(8), 1, 1 },
-	{ pinmux(8), 1, 2 },
-	{ pinmux(8), 1, 3 },
-	{ pinmux(8), 1, 4 },
-	{ pinmux(8), 1, 5 },
-	{ pinmux(8), 1, 6 },
-	{ pinmux(8), 1, 7 },
-	{ pinmux(9), 1, 0 },
-	{ pinmux(9), 1, 1 },
-	{ pinmux(9), 1, 2 },
-	{ pinmux(9), 1, 3 },
-	{ pinmux(9), 1, 4 },
-	{ pinmux(9), 1, 5 },
-	{ pinmux(9), 1, 6 },
-	{ pinmux(9), 1, 7 },
-	{ pinmux(10), 1, 0 },
-	{ pinmux(10), 1, 1 },
-	{ pinmux(10), 1, 2 },
-	{ pinmux(10), 1, 3 },
-	{ pinmux(10), 1, 4 },
-	{ pinmux(10), 1, 5 },
-	{ pinmux(10), 1, 6 },
-	{ pinmux(10), 1, 7 },
-	{ pinmux(11), 1, 0 },
-	{ pinmux(11), 1, 1 },
-	{ pinmux(11), 1, 2 },
-	{ pinmux(11), 1, 3 },
-	{ pinmux(11), 1, 4 },
-	{ pinmux(11), 1, 5 },
-	{ pinmux(11), 1, 6 },
-	{ pinmux(11), 1, 7 },
-	{ pinmux(12), 1, 0 },
-	{ pinmux(12), 1, 1 },
-	{ pinmux(12), 1, 2 },
-	{ pinmux(12), 1, 3 },
-	{ pinmux(12), 1, 4 },
-	{ pinmux(12), 1, 5 },
-	{ pinmux(12), 1, 6 },
-	{ pinmux(12), 1, 7 }
-};
-#endif
-
 #ifdef CONFIG_DRIVER_TI_EMAC_USE_RMII
 #define HAS_RMII 1
 #else
@@ -222,17 +101,25 @@  int misc_init_r(void)
 	return 0;
 }
 
+const struct pinmux_config gpio_pins[] = {
+#ifdef CONFIG_USE_NOR
+	/* GP0[11] is required for NOR to work on Rev 3 EVMs */
+	{ pinmux(0), 8, 4 },	/* GP0[11] */
+#endif
+};
+
 static const struct pinmux_resource pinmuxes[] = {
 #ifdef CONFIG_SPI_FLASH
 	PINMUX_ITEM(spi1_pins),
 #endif
-	PINMUX_ITEM(uart_pins),
-	PINMUX_ITEM(i2c_pins),
+	PINMUX_ITEM(uart2_pins),
+	PINMUX_ITEM(i2c0_pins),
 #ifdef CONFIG_NAND_DAVINCI
 	PINMUX_ITEM(nand_pins),
 #elif defined(CONFIG_USE_NOR)
 	PINMUX_ITEM(nor_pins),
 #endif
+	PINMUX_ITEM(gpio_pins),
 };
 
 static const struct lpsc_resource lpsc[] = {
diff --git a/board/davinci/da8xxevm/hawkboard_nand_spl.c b/board/davinci/da8xxevm/hawkboard_nand_spl.c
index fd130fa..fcc5f23 100644
--- a/board/davinci/da8xxevm/hawkboard_nand_spl.c
+++ b/board/davinci/da8xxevm/hawkboard_nand_spl.c
@@ -27,53 +27,14 @@ 
 #include <asm/arch/hardware.h>
 #include <asm/io.h>
 #include <asm/arch/davinci_misc.h>
+#include <asm/arch/da850_pinmux.h>
 #include <ns16550.h>
 #include <nand.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static const struct pinmux_config mii_pins[] = {
-	{ pinmux(2), 8, 1 },
-	{ pinmux(2), 8, 2 },
-	{ pinmux(2), 8, 3 },
-	{ pinmux(2), 8, 4 },
-	{ pinmux(2), 8, 5 },
-	{ pinmux(2), 8, 6 },
-	{ pinmux(2), 8, 7 }
-};
-
-static const struct pinmux_config mdio_pins[] = {
-	{ pinmux(4), 8, 0 },
-	{ pinmux(4), 8, 1 }
-};
-
-static const struct pinmux_config nand_pins[] = {
-	{ pinmux(7), 1, 1 },
-	{ pinmux(7), 1, 2 },
-	{ pinmux(7), 1, 4 },
-	{ pinmux(7), 1, 5 },
-	{ pinmux(9), 1, 0 },
-	{ pinmux(9), 1, 1 },
-	{ pinmux(9), 1, 2 },
-	{ pinmux(9), 1, 3 },
-	{ pinmux(9), 1, 4 },
-	{ pinmux(9), 1, 5 },
-	{ pinmux(9), 1, 6 },
-	{ pinmux(9), 1, 7 },
-	{ pinmux(12), 1, 5 },
-	{ pinmux(12), 1, 6 }
-};
-
-static const struct pinmux_config uart2_pins[] = {
-	{ pinmux(0), 4, 6 },
-	{ pinmux(0), 4, 7 },
-	{ pinmux(4), 2, 4 },
-	{ pinmux(4), 2, 5 }
-};
-
 static const struct pinmux_resource pinmuxes[] = {
-	PINMUX_ITEM(mii_pins),
-	PINMUX_ITEM(mdio_pins),
+	PINMUX_ITEM(emac_pins),
 	PINMUX_ITEM(nand_pins),
 	PINMUX_ITEM(uart2_pins),
 };