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

login
register
mail settings
Submitter Lucas Stach
Date Jan. 24, 2013, 4:48 p.m.
Message ID <1359046100-19385-10-git-send-email-dev@lynxeye.de>
Download mbox | patch
Permalink /patch/215453/
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/compulab/trimslice/trimslice.c | 146 +++++++++++++++++++++++++++--------
 include/configs/trimslice.h          |   3 +
 2 files changed, 118 insertions(+), 31 deletions(-)

Patch

diff --git a/board/compulab/trimslice/trimslice.c b/board/compulab/trimslice/trimslice.c
index 8f4dd09..9af7ca6 100644
--- a/board/compulab/trimslice/trimslice.c
+++ b/board/compulab/trimslice/trimslice.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,41 +35,11 @@ 
 #include <mmc.h>
 #endif
 
-void pin_mux_usb(void)
-{
-	/*
-	 * USB1 internal/external mux GPIO, which masquerades as a VBUS GPIO
-	 * in the current device tree.
-	 */
-	pinmux_tristate_disable(PINGRP_UAC);
-}
-
-void pin_mux_spi(void)
-{
-	funcmux_select(PERIPH_ID_SPI1, FUNCMUX_SPI1_GMC_GMD);
-}
-
-/*
- * 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_SDMMC1, FUNCMUX_SDMMC1_SDIO1_4BIT);
-	funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_4_BIT);
-
-	/* For CD GPIO PP1 */
-	pinmux_tristate_disable(PINGRP_DAP3);
-}
-
 /* this is a weak define that we are overriding */
 int board_mmc_init(bd_t *bd)
 {
 	debug("board_mmc_init called\n");
 
-	/* Enable muxes, etc. for SDMMC controllers */
-	pin_mux_mmc();
-
 	/* init dev 0 (SDMMC4), (micro-SD slot) with 4-bit bus */
 	tegra_mmc_init(0, 4, -1, GPIO_PP1);
 
@@ -77,3 +48,116 @@  int board_mmc_init(bd_t *bd)
 
 	return 0;
 }
+static struct pingroup_config trimslice_pinmux[] = {
+	PINMUX_ENTRY(ATA, IDE, NORMAL, TRISTATE),
+	PINMUX_ENTRY(ATB, SDIO4, NORMAL, NORMAL), /* SDMMC4 */
+	PINMUX_ENTRY(ATC, NAND, NORMAL, TRISTATE),
+	PINMUX_ENTRY(ATD, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(ATE, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(CDEV1, PLLA_OUT, NORMAL, TRISTATE),
+	PINMUX_ENTRY(CDEV2, PLLP_OUT4, 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, NORMAL), /* GPIO PP1 */
+	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, VI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(DTF, I2C3, NORMAL, TRISTATE),
+	PINMUX_ENTRY(GMA, SDIO4, NORMAL, NORMAL), /* SDMMC4 */
+	PINMUX_ENTRY(GMB, NAND, NORMAL, TRISTATE),
+	PINMUX_ENTRY(GMC, SFLASH, NORMAL, NORMAL), /* SPI1 */
+	PINMUX_ENTRY(GMD, SFLASH, NORMAL, NORMAL), /* SPI1 */
+	PINMUX_ENTRY(GME, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(GPU, UARTA, NORMAL, NORMAL), /* UART A */
+	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, TRISTATE),
+	PINMUX_ENTRY(IRRX, UARTB, NORMAL, TRISTATE),
+	PINMUX_ENTRY(IRTX, UARTB, NORMAL, TRISTATE),
+	PINMUX_ENTRY(KBCA, KBC, NORMAL, TRISTATE),
+	PINMUX_ENTRY(KBCB, KBC, NORMAL, TRISTATE),
+	PINMUX_ENTRY(KBCC, KBC, NORMAL, TRISTATE),
+	PINMUX_ENTRY(KBCD, KBC, NORMAL, TRISTATE),
+	PINMUX_ENTRY(KBCE, KBC, NORMAL, TRISTATE),
+	PINMUX_ENTRY(KBCF, KBC, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LCSN, DISPA, 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, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LSDA, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LSDI, DISPA, 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, RSVD2, NORMAL, TRISTATE),
+	PINMUX_ENTRY(PTA, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(RM, I2C, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SDB, PWM, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SDC, PWM, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SDD, PWM, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SDIO1, SDIO1, NORMAL, NORMAL), /* SDMMC1 */
+	PINMUX_ENTRY(SLXA, PCIE, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SLXC, SDIO3, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SLXD, SDIO3, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SLXK, PCIE, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPDI, SPDIF, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPDO, SPDIF, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPIA, SPI2, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPIB, SPI2, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPIC, SPI2, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPID, SPI1, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPIE, SPI1, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPIF, SPI1, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPIG, SPI2_ALT, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPIH, SPI2_ALT, NORMAL, TRISTATE),
+	PINMUX_ENTRY(UAA, ULPI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(UAB, ULPI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(UAC, RSVD2, NORMAL, NORMAL), /* GPIO PV2 */
+	PINMUX_ENTRY(UAD, UARTB, NORMAL, TRISTATE),
+	PINMUX_ENTRY(UCA, UARTC, NORMAL, TRISTATE),
+	PINMUX_ENTRY(UCB, UARTC, NORMAL, TRISTATE),
+	PINMUX_ENTRY(UDA, ULPI, NORMAL, TRISTATE),
+};
+
+void pinmux_init(void)
+{
+	pinmux_config_table(trimslice_pinmux, ARRAY_SIZE(trimslice_pinmux));
+}
diff --git a/include/configs/trimslice.h b/include/configs/trimslice.h
index 334d3a3..c581717 100644
--- a/include/configs/trimslice.h
+++ b/include/configs/trimslice.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 TrimSlice. Flash the image in u-boot-dtb.bin */
 #define CONFIG_DEFAULT_DEVICE_TREE	tegra20-trimslice
 #define CONFIG_OF_CONTROL