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

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

Comments

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

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 .../colibri_t20-common/colibri_t20-common.c        | 132 +++++++++++++++++----
 board/toradex/colibri_t20_iris/colibri_t20_iris.c  |  16 +--
 include/configs/colibri_t20_iris.h                 |   3 +
 3 files changed, 115 insertions(+), 36 deletions(-)

Patch

diff --git a/board/toradex/colibri_t20-common/colibri_t20-common.c b/board/toradex/colibri_t20-common/colibri_t20-common.c
index 6d5e47d..e5163f3 100644
--- a/board/toradex/colibri_t20-common/colibri_t20-common.c
+++ b/board/toradex/colibri_t20-common/colibri_t20-common.c
@@ -1,5 +1,5 @@ 
 /*
- *  Copyright (C) 2012 Lucas Stach
+ *  Copyright (C) 2012-2013 Lucas Stach
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -14,31 +14,121 @@ 
  */
 
 #include <common.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/funcmux.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch-tegra/board.h>
 
 #include "colibri_t20-common.h"
 
-#ifdef CONFIG_USB_EHCI_TEGRA
-void colibri_t20_common_pin_mux_usb(void)
-{
-	/* module internal USB bus to connect ethernet chipset */
-	funcmux_select(PERIPH_ID_USB2, FUNCMUX_USB2_ULPI);
-	/* ULPI reference clock output */
-	pinmux_set_func(PINGRP_CDEV2, PMUX_FUNC_PLLP_OUT4);
-	pinmux_tristate_disable(PINGRP_CDEV2);
-	/* PHY reset GPIO */
-	pinmux_tristate_disable(PINGRP_UAC);
-	/* VBus GPIO */
-	pinmux_tristate_disable(PINGRP_DTE);
-}
-#endif
+static struct pingroup_config colibri_t20_pinmux[] = {
+	PINMUX_ENTRY(ATA, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(ATB, SDIO4, NORMAL, NORMAL), /* MMC */
+	PINMUX_ENTRY(ATC, GMI, 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, NORMAL), /* ULPI REFCLK */
+	PINMUX_ENTRY(CRTP, CRT, NORMAL, TRISTATE),
+	PINMUX_ENTRY(CSUS, VI_SENSOR_CLK, NORMAL, TRISTATE),
+	PINMUX_ENTRY(DAP1, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(DAP2, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(DAP3, DAP3, NORMAL, TRISTATE),
+	PINMUX_ENTRY(DAP4, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(DDC, I2C2, NORMAL, TRISTATE),
+	PINMUX_ENTRY(DTA, RSVD4, NORMAL, TRISTATE),
+	PINMUX_ENTRY(DTB, RSVD1, NORMAL, TRISTATE),
+	PINMUX_ENTRY(DTC, RSVD1, NORMAL, TRISTATE),
+	PINMUX_ENTRY(DTD, RSVD1, NORMAL, TRISTATE),
+	PINMUX_ENTRY(DTE, RSVD1, NORMAL, NORMAL), /* GPIO */
+	PINMUX_ENTRY(DTF, RSVD4, NORMAL, TRISTATE),
+	PINMUX_ENTRY(GMA, SDIO4, NORMAL, NORMAL), /* MMC */
+	PINMUX_ENTRY(GMB, IDE, NORMAL, NORMAL), /* GPIO */
+	PINMUX_ENTRY(GMC, UARTD, NORMAL, NORMAL), /* UART D */
+	PINMUX_ENTRY(GMD, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(GME, SDIO4, NORMAL, NORMAL), /* MMC 8bit */
+	PINMUX_ENTRY(GPU, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(GPU7, RTCK, NORMAL, NORMAL), /* JTAG RTCK */
+	PINMUX_ENTRY(GPV, RSVD4, NORMAL, TRISTATE),
+	PINMUX_ENTRY(HDINT, HDMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(I2CP, I2C, NORMAL, NORMAL),
+	PINMUX_ENTRY(IRRX, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(IRTX, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(KBCA, NAND, NORMAL, NORMAL), /* NAND */
+	PINMUX_ENTRY(KBCB, NAND, NORMAL, NORMAL), /* NAND */
+	PINMUX_ENTRY(KBCC, NAND, NORMAL, NORMAL), /* NAND */
+	PINMUX_ENTRY(KBCD, NAND, NORMAL, NORMAL), /* NAND */
+	PINMUX_ENTRY(KBCE, NAND, NORMAL, NORMAL), /* NAND */
+	PINMUX_ENTRY(KBCF, NAND, NORMAL, NORMAL), /* NAND */
+	PINMUX_ENTRY(LCSN,RSVD4, 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, RSVD4, 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, RSVD4, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LM1, RSVD3, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LPP, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LPW0, DISPB, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LPW1, RSVD4, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LPW2, DISPB, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LSC0, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LSC1, DISPB, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LSCK, DISPB, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LSDA, DISPB, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LSDI, RSVD4, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LSPI, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LVP0, RSVD4, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LVP1, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(LVS, DISPA, NORMAL, TRISTATE),
+	PINMUX_ENTRY(OWC, OWR, NORMAL, TRISTATE),
+	PINMUX_ENTRY(PTA, RSVD4, 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, UARTA, NORMAL, NORMAL), /* UART A */
+	PINMUX_ENTRY(SLXA, SPI4, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SLXC, SPI4, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SLXD, SPI4, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SLXK, SPI4, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPDI, RSVD2, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPDO, RSVD2, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPIA, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPIB, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPIC, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPID, SPI1, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPIE, SPI1, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPIF, RSVD4, NORMAL, TRISTATE),
+	PINMUX_ENTRY(SPIG, SPI2_ALT, NORMAL, NORMAL), /* GPIO */
+	PINMUX_ENTRY(SPIH, SPI2_ALT, NORMAL, NORMAL), /* GPIO */
+	PINMUX_ENTRY(UAA, ULPI, NORMAL, NORMAL), /* ULPI */
+	PINMUX_ENTRY(UAB, ULPI, NORMAL, NORMAL), /* ULPI */
+	PINMUX_ENTRY(UAC, RSVD4, NORMAL, NORMAL), /* GPIO */
+	PINMUX_ENTRY(UAD, UARTB, NORMAL, TRISTATE),
+	PINMUX_ENTRY(UCA, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(UCB, GMI, NORMAL, TRISTATE),
+	PINMUX_ENTRY(UDA, ULPI, NORMAL, NORMAL), /* ULPI */
+};
 
-#ifdef CONFIG_TEGRA_NAND
-void pin_mux_nand(void)
+void pinmux_init(void)
 {
-	funcmux_select(PERIPH_ID_NDFLASH, FUNCMUX_NDFLASH_KBC_8_BIT);
+	pinmux_config_table(colibri_t20_pinmux, ARRAY_SIZE(colibri_t20_pinmux));
 }
-#endif
diff --git a/board/toradex/colibri_t20_iris/colibri_t20_iris.c b/board/toradex/colibri_t20_iris/colibri_t20_iris.c
index e40a986..8e099bf 100644
--- a/board/toradex/colibri_t20_iris/colibri_t20_iris.c
+++ b/board/toradex/colibri_t20_iris/colibri_t20_iris.c
@@ -1,5 +1,5 @@ 
 /*
- *  Copyright (C) 2012 Lucas Stach
+ *  Copyright (C) 2012-2013 Lucas Stach
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -16,29 +16,15 @@ 
 #include <common.h>
 #include <asm/gpio.h>
 #include <asm/arch/clock.h>
-#include <asm/arch/funcmux.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch-tegra/board.h>
 #include <asm/arch-tegra/mmc.h>
 
 #include "../colibri_t20-common/colibri_t20-common.h"
 
-#ifdef CONFIG_USB_EHCI_TEGRA
-void pin_mux_usb(void)
-{
-	colibri_t20_common_pin_mux_usb();
-
-	/* USB 1 aka Tegra USB port 3 VBus*/
-	pinmux_tristate_disable(PINGRP_SPIG);
-}
-#endif
-
 #ifdef CONFIG_TEGRA_MMC
 int board_mmc_init(bd_t *bd)
 {
-	funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_4_BIT);
-	pinmux_tristate_disable(PINGRP_GMB);
-
 	tegra_mmc_init(0, 4, -1, GPIO_PC7);
 
 	return 0;
diff --git a/include/configs/colibri_t20_iris.h b/include/configs/colibri_t20_iris.h
index 0e5f281..513a5ba 100644
--- a/include/configs/colibri_t20_iris.h
+++ b/include/configs/colibri_t20_iris.h
@@ -18,6 +18,9 @@ 
 
 #include "tegra20-common.h"
 
+/* Enable tablebased pinmux */
+#define CONFIG_TEGRA_TABLEBASED_PINMUX
+
 /* Enable FDT support */
 #define CONFIG_DEFAULT_DEVICE_TREE	tegra20-colibri_t20_iris
 #define CONFIG_OF_CONTROL