Patchwork [U-Boot,07/11] tegra20: switch over whistler board to use tablebased pinmux

login
register
mail settings
Submitter Lucas Stach
Date Jan. 24, 2013, 4:48 p.m.
Message ID <1359046100-19385-8-git-send-email-dev@lynxeye.de>
Download mbox | patch
Permalink /patch/215450/
State Deferred
Delegated to: Tom Warren
Headers show

Comments

Lucas Stach - Jan. 24, 2013, 4:48 p.m.
Init pinmux in one shot, in order to avoid any conflicts.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 board/nvidia/whistler/whistler.c | 131 ++++++++++++++++++++++++++++++++++-----
 include/configs/whistler.h       |   3 +
 2 files changed, 119 insertions(+), 15 deletions(-)

Patch

diff --git a/board/nvidia/whistler/whistler.c b/board/nvidia/whistler/whistler.c
index 592cd6b..56f066e 100644
--- a/board/nvidia/whistler/whistler.c
+++ b/board/nvidia/whistler/whistler.c
@@ -1,6 +1,8 @@ 
 /*
  *  (C) Copyright 2010-2012
  *  NVIDIA Corporation <www.nvidia.com>
+ *  (C) Copyright 2013
+ *  Lucas Stach
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -25,7 +27,6 @@ 
 #include <asm/io.h>
 #include <asm/arch/tegra.h>
 #include <asm/arch/clock.h>
-#include <asm/arch/funcmux.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch-tegra/mmc.h>
 #include <asm/gpio.h>
@@ -34,17 +35,6 @@ 
 #include <mmc.h>
 #endif
 
-
-/*
- * Routine: pin_mux_mmc
- * Description: setup the pin muxes/tristate values for the SDMMC(s)
- */
-static void pin_mux_mmc(void)
-{
-	funcmux_select(PERIPH_ID_SDMMC3, FUNCMUX_SDMMC3_SDB_SLXA_8BIT);
-	funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATC_ATD_8BIT);
-}
-
 /* this is a weak define that we are overriding */
 int board_mmc_init(bd_t *bd)
 {
@@ -70,9 +60,6 @@  int board_mmc_init(bd_t *bd)
 	if (ret)
 		printf("i2c_write 0 0x3c 0x44 failed: %d\n", ret);
 
-	/* Enable muxes, etc. for SDMMC controllers */
-	pin_mux_mmc();
-
 	/* init dev 0 (SDMMC4), (J29 "HSMMC") with 8-bit bus */
 	tegra_mmc_init(0, 8, -1, -1);
 
@@ -107,3 +94,117 @@  void pin_mux_usb(void)
 	if (ret)
 		printf("i2c_write 0 0x20 6 failed: %d\n", ret);
 }
+
+static struct pingroup_config whistler_pinmux[] = {
+	PINMUX_ENTRY(ATA, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(ATB, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(ATC, SDIO4, NORMAL, NORMAL), /* SDMMC4 */
+	PINMUX_ENTRY(ATD, SDIO4, NORMAL, NORMAL), /* SDMMC4 */
+	PINMUX_ENTRY(ATE, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(CDEV1, PLLA_OUT, NORMAL, TRISTATE),
+	PINMUX_ENTRY(CDEV2, OSC, NORMAL, TRISTATE),
+	PINMUX_ENTRY(CRTP, CRT, NORMAL, TRISTATE),
+	PINMUX_ENTRY(CSUS, VI_SENSOR_CLK, NORMAL, TRISTATE),
+	PINMUX_ENTRY(DAP1, DAP1, NORMAL, TRISTATE),
+	PINMUX_ENTRY(DAP2, DAP2, NORMAL, TRISTATE),
+	PINMUX_ENTRY(DAP3, DAP3, NORMAL, TRISTATE),
+	PINMUX_ENTRY(DAP4, DAP4, NORMAL, TRISTATE),
+	PINMUX_ENTRY(DDC, I2C2, NORMAL, TRISTATE),
+	PINMUX_ENTRY(DTA, VI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(DTB, VI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(DTC, VI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(DTD, VI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(DTE, RSVD1, NORMAL, TRISTATE),
+	PINMUX_ENTRY(DTF, I2C3, NORMAL, TRISTATE),
+	PINMUX_ENTRY(GMA, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(GMB, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(GMC, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(GMD, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(GME, DAP5, NORMAL, TRISTATE),
+	PINMUX_ENTRY(GPU, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(GPU7, RTCK, NORMAL, NORMAL), /* JTAG RTCK */
+	PINMUX_ENTRY(GPV, PCIE, NORMAL, TRISTATE),
+	PINMUX_ENTRY(HDINT, HDMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(I2CP, I2C, NORMAL, NORMAL), /* DVC */
+	PINMUX_ENTRY(IRRX, UARTB, NORMAL, TRISTATE),
+	PINMUX_ENTRY(IRTX, UARTB, NORMAL, TRISTATE),
+	PINMUX_ENTRY(KBCA, KBC, NORMAL, TRISTATE),
+	PINMUX_ENTRY(KBCB, SDIO2, NORMAL, TRISTATE),
+	PINMUX_ENTRY(KBCC, KBC, NORMAL, TRISTATE),
+	PINMUX_ENTRY(KBCD, SDIO2, NORMAL, TRISTATE),
+	PINMUX_ENTRY(KBCE, KBC, NORMAL, TRISTATE),
+	PINMUX_ENTRY(KBCF, KBC, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LCSN, SPI3, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LD0, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LD1, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LD2, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LD3, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LD4, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LD5, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LD6, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LD7, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LD8, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LD9, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LD10, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LD11, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LD12, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LD13, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LD14, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LD15, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LD16, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LD17, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LDC, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LDI, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LHP0, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LHP1, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LHP2, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LHS, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LM0, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LM1, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LPP, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LPW0, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LPW1, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LPW2, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LSC0, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LSC1, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LSCK, SPI3, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LSDA, SPI3, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LSDI, SPI3, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LSPI, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LVP0, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LVP1, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LVS, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(OWC, OWR, NORMAL, TRISTATE),
+	PINMUX_ENTRY(PTA, HDMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(RM, I2C, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SDB, SDIO3, NORMAL, NORMAL), /* SDMMC3 */
+	PINMUX_ENTRY(SDC, SDIO3, NORMAL, NORMAL), /* SDMMC4 */
+	PINMUX_ENTRY(SDD, SDIO3, NORMAL, NORMAL), /* SDMMC4 */
+	PINMUX_ENTRY(SDIO1, SDIO1, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SLXA, SDIO3, NORMAL, NORMAL), /* SDMMC4 */
+	PINMUX_ENTRY(SLXC, SDIO3, NORMAL, NORMAL), /* SDMMC4 */
+	PINMUX_ENTRY(SLXD, SDIO3, NORMAL, NORMAL), /* SDMMC4 */
+	PINMUX_ENTRY(SLXK, SDIO3, NORMAL, NORMAL), /* SDMMC4 */
+	PINMUX_ENTRY(SPDI, RSVD2, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPDO, RSVD2, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPIA, SPI3, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPIB, SPI3, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPIC, SPI3, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPID, SPI2_ALT, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPIE, SPI2_ALT, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPIF, SPI2, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPIG, SPI2_ALT, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPIH, SPI2_ALT, NORMAL, TRISTATE),
+	PINMUX_ENTRY(UAA, UARTA, NORMAL, NORMAL), /* UART A */
+	PINMUX_ENTRY(UAB, UARTA, NORMAL, NORMAL), /* UART A */
+	PINMUX_ENTRY(UAC, OWR, NORMAL, TRISTATE),
+	PINMUX_ENTRY(UAD, UARTB, NORMAL, TRISTATE),
+	PINMUX_ENTRY(UCA, UARTC, NORMAL, TRISTATE),
+	PINMUX_ENTRY(UCB, UARTC, NORMAL, TRISTATE),
+	PINMUX_ENTRY(UDA, SPI1, NORMAL, TRISTATE),
+};
+
+void pinmux_init(void)
+{
+	pinmux_config_table(whistler_pinmux, ARRAY_SIZE(whistler_pinmux));
+}
diff --git a/include/configs/whistler.h b/include/configs/whistler.h
index 1e554d8..d45fa44 100644
--- a/include/configs/whistler.h
+++ b/include/configs/whistler.h
@@ -27,6 +27,9 @@ 
 #include <asm/sizes.h>
 #include "tegra20-common.h"
 
+/* Enable tablebased pinmux */
+#define CONFIG_TEGRA_TABLEBASED_PINMUX
+
 /* Enable fdt support for Whistler. Flash the image in u-boot-dtb.bin */
 #define CONFIG_DEFAULT_DEVICE_TREE	tegra20-whistler
 #define CONFIG_OF_CONTROL