arm/tegra: Various pinmux-related cleanups
Subsystems (3)
cover arm/tegra: Various pinmux-related cleanups
While working on switching Tegra to a new pinctrl-based pin mux driver, I made a bunch of small pinmux-related fixes; this patch series.
This patch series will have a few small context conflicts with Peter De Schrijver's Tegra30 support. Peter's patch series should have priority over this one (i.e. be the one merged if it's difficult to merge both).
In particular:
* My patch 3 "arm/tegra: Harmony PCIe: Don't touch pinmux" and Peter's patch "arm/tegra: prepare pinmux code for multiple tegra variants" will have context conflicts; I've described the best way to resolve this in my patch's commit description.
* This series edits board-dt.c whereas Peter's series renames that to board-dt-tegra20.c. I assume git will handle this without any issue.
* There may be other obvious context conflicts that should be trivial to resolve.
This series is based on next-20111215, but I don't think has any dependencies on anything in any of the Tegra for-3.3 branches.
Following this series, I have 3 patches in my local tree:
arm/tegra: Select PINMUX Kconfig variables arm/tegra: Switch to new pinctrl driver arm/tegra: Remove pre-pinctrl pinmux driver
(all work in DT and non-DT on all supported Tegra20 boards)
I need to rebase those on top of Peter's patches (the first patch needs updates for Tegra30 support, the last patch needs to delete the new Tegra30 pinmux driver that Peter's series adds). It will also depend on the pinctrl subsystem, which is being merged for the first time in 3.3, and probably also patches to pinctrl that may only show up in 3.4. So, I'll probably hold off posting those patches for merge until after 3.3 is out, but will probably send them out as a preview before that.
Stephen Warren (9):
arm/tegra: Split Seaboard GPIO table to allow for Ventana arm/tegra: Add AUXDATA for tegra-pinmux and tegra-gpio arm/tegra: Harmony PCIe: Don't touch pinmux arm/tegra: PCIe: Remove include of mach/pinmux.h arm/tegra: Remove useless entries from ventana_pinmux[] arm/tegra: Rework Seaboard-vs-Ventana pinmux table arm/tegra: Fix mistake in Trimslice's pinmux arm/tegra: Refactor board-*-pinmux.c to share code arm/tegra: Use bus notifiers to trigger pinmux setup
arch/arm/mach-tegra/Makefile | 1 + arch/arm/mach-tegra/board-dt.c | 16 ++-- arch/arm/mach-tegra/board-harmony-pcie.c | 9 -- arch/arm/mach-tegra/board-harmony-pinmux.c | 22 ++--- arch/arm/mach-tegra/board-paz00-pinmux.c | 22 ++--- arch/arm/mach-tegra/board-pinmux.c | 104 +++++++++++++++++++++++ arch/arm/mach-tegra/board-pinmux.h | 38 +++++++++ arch/arm/mach-tegra/board-seaboard-pinmux.c | 116 ++++++++++++-------------- arch/arm/mach-tegra/board-trimslice-pinmux.c | 24 +++--- arch/arm/mach-tegra/pcie.c | 1 - 10 files changed, 235 insertions(+), 118 deletions(-) create mode 100644 arch/arm/mach-tegra/board-pinmux.c create mode 100644 arch/arm/mach-tegra/board-pinmux.h
PATCH 1/9 arm/tegra: Split Seaboard GPIO table to allow for Ventana
Seaboard and Ventana share some GPIOs, but others are different. Split the GPIO table into common, seaboard-specific, and ventana-specific tables, so that only the correct ones are enabled for each board. Add a few missing audio-related GPIOs for Ventana.
--- arch/arm/mach-tegra/board-seaboard-pinmux.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-)
arch/arm/mach-tegra/board-seaboard-pinmux.c +15 -1
@@ -190,14 +190,26 @@ static struct tegra_gpio_table common_gpio_table[] = { { .gpio = TEGRA_GPIO_SD2_CD, .enable = true }, { .gpio = TEGRA_GPIO_SD2_WP, .enable = true }, { .gpio = TEGRA_GPIO_SD2_POWER, .enable = true }, + { .gpio = TEGRA_GPIO_CDC_IRQ, .enable = true }, +}; + +static struct tegra_gpio_table seaboard_gpio_table[] = { { .gpio =TEGRA_GPIO_LIDSWITCH , .enable = true }, { .gpio =TEGRA_GPIO_POWERKEY , .enable = true }, { .gpio =TEGRA_GPIO_HP_DET , .enable = true }, { .gpio =TEGRA_GPIO_ISL29018_IRQ , .enable = true }, - { .gpio = TEGRA_GPIO_CDC_IRQ, .enable = true }, { .gpio =TEGRA_GPIO_USB1 , .enable = true }, }; +static struct tegra_gpio_table ventana_gpio_table[] = { +/* hp_det */ + { .gpio =TEGRA_GPIO_PW2 , .enable = true }, +/* int_mic_en */ + { .gpio =TEGRA_GPIO_PX0 , .enable = true }, +/* ext_mic_en */ + { .gpio =TEGRA_GPIO_PX1 , .enable = true }, +}; +static void __init update_pinmux (struct tegra_pingroup_config *newtbl,int size) {int i, j;
@@ -235,11 +247,13 @@ void __init seaboard_common_pinmux_init(void)void __init seaboard_pinmux_init (void ) {seaboard_common_pinmux_init (); +tegra_gpio_config (seaboard_gpio_table,ARRAY_SIZE (seaboard_gpio_table)); }void __init ventana_pinmux_init (void ) {update_pinmux (ventana_pinmux,ARRAY_SIZE (ventana_pinmux));seaboard_common_pinmux_init (); +tegra_gpio_config (ventana_gpio_table,ARRAY_SIZE (ventana_gpio_table)); }
Signature · 1 line
1.7.0.4
PATCH 2/9 arm/tegra: Add AUXDATA for tegra-pinmux and tegra-gpio
In reply to Stephen WarrenThe pinctrl device name is included in the pinctrl map table, and used as a parameter to pin_config_*() functions. Hence, it must be the same for non-DT and DT kernels. Add AUXDATA to cause this.
The GPIO device name will be used by the pinmux/GPIO initialization code in a later patch, and needs to stay constant.
--- arch/arm/mach-tegra/board-dt.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/mach-tegra/board-dt.c +2 -0
@@ -65,6 +65,8 @@ void __init tegra_dt_init_irq(void) }struct of_dev_auxdata tegra20_auxdata_lookup[]__initdata = { +OF_DEV_AUXDATA ("nvidia,tegra20-pinmux" ,TEGRA_APB_MISC_BASE +0x14 ,"tegra-pinmux" ,NULL ), +OF_DEV_AUXDATA ("nvidia,tegra20-gpio" ,TEGRA_GPIO_BASE ,"tegra-gpio" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-sdhci" ,TEGRA_SDMMC1_BASE ,"sdhci-tegra.0" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-sdhci" ,TEGRA_SDMMC2_BASE ,"sdhci-tegra.1" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-sdhci" ,TEGRA_SDMMC3_BASE ,"sdhci-tegra.2" ,NULL ),
Signature · 1 line
1.7.0.4
PATCH 3/9 arm/tegra: Harmony PCIe: Don't touch pinmux
In reply to Stephen WarrenThe Harmony pinmux table is already set up to mux the PCIe signals onto the appropriate pin groups. Don't manually fiddle with the pinmux in the Harmony PCIe setup code.
Merge note: This will have a merge conflict with Peter De Schrijver's "arm/tegra: prepare pinmux code for multiple tegra variants" due to context. When merging the two, make sure to also remove the include of <mach/pinmux-tegra20.h> that his patch added, since it's no longer needed after this patch.
--- arch/arm/mach-tegra/board-harmony-pcie.c | 9 --------- 1 files changed, 0 insertions(+), 9 deletions(-)
arch/arm/mach-tegra/board-harmony-pcie.c +0 -9
@@ -22,7 +22,6 @@#include <asm/mach-types.h> -#include <mach/pinmux.h> #include "board.h" #include "board-harmony.h"
@@ -48,10 +47,6 @@ static int __init harmony_pcie_init(void)regulator_enable (regulator); -tegra_pinmux_set_tristate (TEGRA_PINGROUP_GPV ,TEGRA_TRI_NORMAL ); -tegra_pinmux_set_tristate (TEGRA_PINGROUP_SLXA ,TEGRA_TRI_NORMAL ); -tegra_pinmux_set_tristate (TEGRA_PINGROUP_SLXK ,TEGRA_TRI_NORMAL ); - err =tegra_pcie_init (true, true);if (err) goto err_pcie;
@@ -59,10 +54,6 @@ static int __init harmony_pcie_init(void)return 0 ; err_pcie: -tegra_pinmux_set_tristate (TEGRA_PINGROUP_GPV ,TEGRA_TRI_TRISTATE ); -tegra_pinmux_set_tristate (TEGRA_PINGROUP_SLXA ,TEGRA_TRI_TRISTATE ); -tegra_pinmux_set_tristate (TEGRA_PINGROUP_SLXK ,TEGRA_TRI_TRISTATE ); -regulator_disable (regulator);regulator_put (regulator); err_reg:
Signature · 1 line
1.7.0.4
PATCH 4/9 arm/tegra: PCIe: Remove include of mach/pinmux.h
In reply to Stephen WarrenNothing in this file needs this header.
--- arch/arm/mach-tegra/pcie.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
arch/arm/mach-tegra/pcie.c +0 -1
@@ -37,7 +37,6 @@#include <asm/sizes.h> #include <asm/mach/pci.h> -#include <mach/pinmux.h> #include <mach/iomap.h> #include <mach/clk.h> #include <mach/powergate.h>
Signature · 1 line
1.7.0.4
PATCH 5/9 arm/tegra: Remove useless entries from ventana_pinmux[]
In reply to Stephen WarrenSome of the entries in ventana_pinmux[] are identical to what's already in seaboard_pinmux[]. Remove the overrides from the Ventana table.
--- arch/arm/mach-tegra/board-seaboard-pinmux.c | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-)
arch/arm/mach-tegra/board-seaboard-pinmux.c +0 -5
@@ -161,12 +161,7 @@ static __initdata struct tegra_pingroup_config seaboard_pinmux[] = { };static __initdata struct tegra_pingroup_config ventana_pinmux[] = { - {TEGRA_PINGROUP_DAP3 ,TEGRA_MUX_DAP3 ,TEGRA_PUPD_NORMAL ,TEGRA_TRI_TRISTATE }, {TEGRA_PINGROUP_DDC ,TEGRA_MUX_RSVD2 ,TEGRA_PUPD_NORMAL ,TEGRA_TRI_NORMAL }, - {TEGRA_PINGROUP_DTA ,TEGRA_MUX_VI ,TEGRA_PUPD_PULL_DOWN ,TEGRA_TRI_NORMAL }, - {TEGRA_PINGROUP_DTB ,TEGRA_MUX_VI ,TEGRA_PUPD_PULL_DOWN ,TEGRA_TRI_NORMAL }, - {TEGRA_PINGROUP_DTC ,TEGRA_MUX_VI ,TEGRA_PUPD_PULL_DOWN ,TEGRA_TRI_NORMAL }, - {TEGRA_PINGROUP_DTD ,TEGRA_MUX_VI ,TEGRA_PUPD_PULL_DOWN ,TEGRA_TRI_NORMAL }, {TEGRA_PINGROUP_GMD ,TEGRA_MUX_SFLASH ,TEGRA_PUPD_NORMAL ,TEGRA_TRI_TRISTATE }, {TEGRA_PINGROUP_LPW0 ,TEGRA_MUX_RSVD4 ,TEGRA_PUPD_NORMAL ,TEGRA_TRI_NORMAL }, {TEGRA_PINGROUP_LPW2 ,TEGRA_MUX_RSVD4 ,TEGRA_PUPD_NORMAL ,TEGRA_TRI_NORMAL },
Signature · 1 line
1.7.0.4
PATCH 6/9 arm/tegra: Rework Seaboard-vs-Ventana pinmux table
In reply to Stephen WarrenRather than modifying seaboard_pinmux[] using ventana_pinmux[], split seaboard_pinmux[] into common_pinmux[] and seaboard_pinmux[], and then actually apply common_pinmux[] always, followed by the appopriate one of seaboard_pinmux[] or ventana_pinmux[].
--- arch/arm/mach-tegra/board-seaboard-pinmux.c | 56 +++++++++----------------- 1 files changed, 20 insertions(+), 36 deletions(-)
arch/arm/mach-tegra/board-seaboard-pinmux.c +20 -36
@@ -41,7 +41,7 @@ static __initdata struct tegra_drive_pingroup_config seaboard_drive_pinmux[] = { DEFAULT_DRIVE(SDIO1), }; -static __initdata struct tegra_pingroup_config seaboard_pinmux[] = { +static __initdata struct tegra_pingroup_config common_pinmux[] = { {TEGRA_PINGROUP_ATA ,TEGRA_MUX_IDE ,TEGRA_PUPD_NORMAL ,TEGRA_TRI_NORMAL }, {TEGRA_PINGROUP_ATB ,TEGRA_MUX_SDIO4 ,TEGRA_PUPD_NORMAL ,TEGRA_TRI_NORMAL }, {TEGRA_PINGROUP_ATC ,TEGRA_MUX_NAND ,TEGRA_PUPD_NORMAL ,TEGRA_TRI_NORMAL },
@@ -55,7 +55,6 @@ static __initdata struct tegra_pingroup_config seaboard_pinmux[] = { {TEGRA_PINGROUP_DAP2, TEGRA_MUX_DAP2, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_DAP3, TEGRA_MUX_DAP3, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_DAP4, TEGRA_MUX_DAP4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, - {TEGRA_PINGROUP_DDC, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_DTA, TEGRA_MUX_VI, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_DTB, TEGRA_MUX_VI, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_DTC, TEGRA_MUX_VI, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL},
@@ -65,7 +64,6 @@ static __initdata struct tegra_pingroup_config seaboard_pinmux[] = { {TEGRA_PINGROUP_GMA, TEGRA_MUX_SDIO4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_GMB, TEGRA_MUX_GMI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_GMC, TEGRA_MUX_UARTD, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, - {TEGRA_PINGROUP_GMD, TEGRA_MUX_SFLASH, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_GME, TEGRA_MUX_SDIO4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_GPU, TEGRA_MUX_PWM, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_GPU7, TEGRA_MUX_RTCK, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
@@ -108,13 +106,8 @@ static __initdata struct tegra_pingroup_config seaboard_pinmux[] = { {TEGRA_PINGROUP_LM0, TEGRA_MUX_RSVD4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_LM1, TEGRA_MUX_CRT, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_LPP, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, - {TEGRA_PINGROUP_LPW0, TEGRA_MUX_HDMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_LPW1, TEGRA_MUX_RSVD4, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, - {TEGRA_PINGROUP_LPW2, TEGRA_MUX_HDMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_LSC0, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, - {TEGRA_PINGROUP_LSC1, TEGRA_MUX_HDMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, - {TEGRA_PINGROUP_LSCK, TEGRA_MUX_HDMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, - {TEGRA_PINGROUP_LSDA, TEGRA_MUX_HDMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_LSDI, TEGRA_MUX_RSVD4, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_LSPI, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_LVP0, TEGRA_MUX_RSVD4, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
@@ -122,25 +115,19 @@ static __initdata struct tegra_pingroup_config seaboard_pinmux[] = { {TEGRA_PINGROUP_LVS, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_OWC, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_PMC, TEGRA_MUX_PWR_ON, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, - {TEGRA_PINGROUP_PTA, TEGRA_MUX_HDMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_RM, TEGRA_MUX_I2C, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_SDB, TEGRA_MUX_SDIO3, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_SDC, TEGRA_MUX_SDIO3, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_SDD, TEGRA_MUX_SDIO3, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_SDIO1, TEGRA_MUX_SDIO1, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_SLXA, TEGRA_MUX_PCIE, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, - {TEGRA_PINGROUP_SLXC, TEGRA_MUX_SPDIF, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_SLXD, TEGRA_MUX_SPDIF, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, - {TEGRA_PINGROUP_SLXK, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_SPDI, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_SPDO, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, - {TEGRA_PINGROUP_SPIA, TEGRA_MUX_GMI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_SPIB, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, - {TEGRA_PINGROUP_SPIC, TEGRA_MUX_GMI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_SPID, TEGRA_MUX_SPI1, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_SPIE, TEGRA_MUX_SPI1, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_SPIF, TEGRA_MUX_SPI1, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, - {TEGRA_PINGROUP_SPIG, TEGRA_MUX_SPI2_ALT, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_SPIH, TEGRA_MUX_SPI2_ALT, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_UAA, TEGRA_MUX_ULPI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_UAB, TEGRA_MUX_ULPI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL},
@@ -160,6 +147,22 @@ static __initdata struct tegra_pingroup_config seaboard_pinmux[] = { {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, }; +static __initdata struct tegra_pingroup_config seaboard_pinmux[] = { + {TEGRA_PINGROUP_DDC ,TEGRA_MUX_RSVD2 ,TEGRA_PUPD_NORMAL ,TEGRA_TRI_TRISTATE }, + {TEGRA_PINGROUP_GMD ,TEGRA_MUX_SFLASH ,TEGRA_PUPD_NORMAL ,TEGRA_TRI_NORMAL }, + {TEGRA_PINGROUP_LPW0 ,TEGRA_MUX_HDMI ,TEGRA_PUPD_NORMAL ,TEGRA_TRI_NORMAL }, + {TEGRA_PINGROUP_LPW2 ,TEGRA_MUX_HDMI ,TEGRA_PUPD_NORMAL ,TEGRA_TRI_NORMAL }, + {TEGRA_PINGROUP_LSC1 ,TEGRA_MUX_HDMI ,TEGRA_PUPD_NORMAL ,TEGRA_TRI_TRISTATE }, + {TEGRA_PINGROUP_LSCK ,TEGRA_MUX_HDMI ,TEGRA_PUPD_NORMAL ,TEGRA_TRI_TRISTATE }, + {TEGRA_PINGROUP_LSDA ,TEGRA_MUX_HDMI ,TEGRA_PUPD_NORMAL ,TEGRA_TRI_TRISTATE }, + {TEGRA_PINGROUP_PTA ,TEGRA_MUX_HDMI ,TEGRA_PUPD_NORMAL ,TEGRA_TRI_NORMAL }, + {TEGRA_PINGROUP_SLXC ,TEGRA_MUX_SPDIF ,TEGRA_PUPD_NORMAL ,TEGRA_TRI_TRISTATE }, + {TEGRA_PINGROUP_SLXK ,TEGRA_MUX_PCIE ,TEGRA_PUPD_NORMAL ,TEGRA_TRI_NORMAL }, + {TEGRA_PINGROUP_SPIA ,TEGRA_MUX_GMI ,TEGRA_PUPD_PULL_UP ,TEGRA_TRI_TRISTATE }, + {TEGRA_PINGROUP_SPIC ,TEGRA_MUX_GMI ,TEGRA_PUPD_PULL_UP ,TEGRA_TRI_NORMAL }, + {TEGRA_PINGROUP_SPIG ,TEGRA_MUX_SPI2_ALT ,TEGRA_PUPD_PULL_UP ,TEGRA_TRI_TRISTATE }, +}; +static __initdata struct tegra_pingroup_config ventana_pinmux[] = { {TEGRA_PINGROUP_DDC ,TEGRA_MUX_RSVD2 ,TEGRA_PUPD_NORMAL ,TEGRA_TRI_NORMAL }, {TEGRA_PINGROUP_GMD, TEGRA_MUX_SFLASH, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
@@ -205,33 +208,13 @@ static struct tegra_gpio_table ventana_gpio_table[] = { { .gpio = TEGRA_GPIO_PX1, .enable = true }, }; -static void __init update_pinmux (struct tegra_pingroup_config *newtbl,int size) -{ -int i, j; -struct tegra_pingroup_config *new_pingroup, *base_pingroup; - -/* Update base seaboard pinmux table with secondary board -* specific pinmux table table. -*/ -for (i =0 ; i < size; i++) { - new_pingroup = &newtbl[i]; -for (j =0 ; j <ARRAY_SIZE (seaboard_pinmux); j++) { - base_pingroup = &seaboard_pinmux[j]; -if (new_pingroup->pingroup == base_pingroup->pingroup) { - *base_pingroup = *new_pingroup; -break ; - } - } - } -} -void __init seaboard_common_pinmux_init (void ) {if (!of_machine_is_compatible ("nvidia,tegra20" ))platform_add_devices (pinmux_devices,ARRAY_SIZE (pinmux_devices)); -tegra_pinmux_config_table (seaboard_pinmux,ARRAY_SIZE (seaboard_pinmux)); +tegra_pinmux_config_table (common_pinmux,ARRAY_SIZE (common_pinmux));tegra_drive_pinmux_config_table (seaboard_drive_pinmux,ARRAY_SIZE (seaboard_drive_pinmux));
@@ -242,13 +225,14 @@ void __init seaboard_common_pinmux_init(void)void __init seaboard_pinmux_init (void ) {seaboard_common_pinmux_init (); +tegra_pinmux_config_table (seaboard_pinmux,ARRAY_SIZE (seaboard_pinmux));tegra_gpio_config (seaboard_gpio_table,ARRAY_SIZE (seaboard_gpio_table)); }void __init ventana_pinmux_init (void ) { -update_pinmux (ventana_pinmux,ARRAY_SIZE (ventana_pinmux));seaboard_common_pinmux_init (); +tegra_pinmux_config_table (ventana_pinmux,ARRAY_SIZE (ventana_pinmux));tegra_gpio_config (ventana_gpio_table,ARRAY_SIZE (ventana_gpio_table)); }
Signature · 1 line
1.7.0.4
PATCH 7/9 arm/tegra: Fix mistake in Trimslice's pinmux
In reply to Stephen WarrenPin group PTA does not support function RSVD3. However, the current pinmux driver doesn't check this when setting RSVD functions, and ends up writing 3 to the HW register. 3 is actually represented by function GMI, so update the pinmux table to request that instead in order to obtain the same register programming without requesting invalid configurations.
--- arch/arm/mach-tegra/board-trimslice-pinmux.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-tegra/board-trimslice-pinmux.c +1 -1
@@ -105,7 +105,7 @@ static __initdata struct tegra_pingroup_config trimslice_pinmux[] = { {TEGRA_PINGROUP_LVS, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_OWC, TEGRA_MUX_RSVD2, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_PMC, TEGRA_MUX_PWR_ON, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, - {TEGRA_PINGROUP_PTA, TEGRA_MUX_RSVD3, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, + {TEGRA_PINGROUP_PTA, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_RM, TEGRA_MUX_I2C, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_SDB, TEGRA_MUX_PWM, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_SDC, TEGRA_MUX_PWM, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL},
Signature · 1 line
1.7.0.4
PATCH 8/9 arm/tegra: Refactor board-*-pinmux.c to share code
In reply to Stephen WarrenThis moves the implementation of *_pinmux_init() into a single location. The board-specific pinmux data is left in each board's own file. This will allow future changes that set up the pinmux in a more complex fashion to do so without duplicating that code in each board's pinmux file.
--- arch/arm/mach-tegra/Makefile | 1 + arch/arm/mach-tegra/board-harmony-pinmux.c | 22 ++++------ arch/arm/mach-tegra/board-paz00-pinmux.c | 22 ++++------ arch/arm/mach-tegra/board-pinmux.c | 52 ++++++++++++++++++++++++++ arch/arm/mach-tegra/board-pinmux.h | 38 +++++++++++++++++++ arch/arm/mach-tegra/board-seaboard-pinmux.c | 51 ++++++++++++------------- arch/arm/mach-tegra/board-trimslice-pinmux.c | 22 +++++------ 7 files changed, 144 insertions(+), 64 deletions(-) create mode 100644 arch/arm/mach-tegra/board-pinmux.c create mode 100644 arch/arm/mach-tegra/board-pinmux.h
arch/arm/mach-tegra/Makefile +1 -0
@@ -1,3 +1,4 @@ +obj-y += board-pinmux.o obj-y += common.o obj-y += devices.o obj-y += io.o
arch/arm/mach-tegra/board-harmony-pinmux.c +9 -13
@@ -22,7 +22,7 @@#include "gpio-names.h" #include "board-harmony.h" -#include "devices.h" +#include "board-pinmux.h" static struct tegra_pingroup_config harmony_pinmux[] = { {TEGRA_PINGROUP_ATA ,TEGRA_MUX_IDE ,TEGRA_PUPD_NORMAL ,TEGRA_TRI_NORMAL },
@@ -143,11 +143,6 @@ static struct tegra_pingroup_config harmony_pinmux[] = { {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, }; -static struct platform_device *pinmux_devices[] = { - &tegra_gpio_device, - &tegra_pinmux_device, -}; -static struct tegra_gpio_table gpio_table[] = { { .gpio =TEGRA_GPIO_SD2_CD , .enable = true }, { .gpio = TEGRA_GPIO_SD2_WP, .enable = true },
@@ -161,13 +156,14 @@ static struct tegra_gpio_table gpio_table[] = { { .gpio = TEGRA_GPIO_EXT_MIC_EN, .enable = true }, }; +static struct tegra_board_pinmux_conf conf = { + .pgs = harmony_pinmux, + .pg_count =ARRAY_SIZE (harmony_pinmux), + .gpios = gpio_table, + .gpio_count =ARRAY_SIZE (gpio_table), +}; +void harmony_pinmux_init (void ) { -if (!of_machine_is_compatible ("nvidia,tegra20" )) -platform_add_devices (pinmux_devices, -ARRAY_SIZE (pinmux_devices)); - -tegra_pinmux_config_table (harmony_pinmux,ARRAY_SIZE (harmony_pinmux)); - -tegra_gpio_config (gpio_table,ARRAY_SIZE (gpio_table)); +tegra_board_pinmux_init (&conf,NULL ); }
arch/arm/mach-tegra/board-paz00-pinmux.c +9 -13
@@ -22,7 +22,7 @@#include "gpio-names.h" #include "board-paz00.h" -#include "devices.h" +#include "board-pinmux.h" static struct tegra_pingroup_config paz00_pinmux[] = { {TEGRA_PINGROUP_ATA ,TEGRA_MUX_GMI ,TEGRA_PUPD_NORMAL ,TEGRA_TRI_NORMAL },
@@ -143,11 +143,6 @@ static struct tegra_pingroup_config paz00_pinmux[] = { {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, }; -static struct platform_device *pinmux_devices[] = { - &tegra_gpio_device, - &tegra_pinmux_device, -}; -static struct tegra_gpio_table gpio_table[] = { { .gpio =TEGRA_GPIO_SD1_CD , .enable = true }, { .gpio = TEGRA_GPIO_SD1_WP, .enable = true },
@@ -158,13 +153,14 @@ static struct tegra_gpio_table gpio_table[] = { { .gpio = TEGRA_WIFI_LED, .enable = true }, }; +static struct tegra_board_pinmux_conf conf = { + .pgs = paz00_pinmux, + .pg_count =ARRAY_SIZE (paz00_pinmux), + .gpios = gpio_table, + .gpio_count =ARRAY_SIZE (gpio_table), +}; +void paz00_pinmux_init (void ) { -if (!of_machine_is_compatible ("nvidia,tegra20" )) -platform_add_devices (pinmux_devices, -ARRAY_SIZE (pinmux_devices)); - -tegra_pinmux_config_table (paz00_pinmux,ARRAY_SIZE (paz00_pinmux)); - -tegra_gpio_config (gpio_table,ARRAY_SIZE (gpio_table)); +tegra_board_pinmux_init (&conf,NULL ); }
arch/arm/mach-tegra/board-pinmux.c new file +52 -0
52 lines not on this page · raw message
arch/arm/mach-tegra/board-pinmux.h new file +38 -0
@@ -0,0 +1,38 @@ +/* +* Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved. +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* 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. +* +*/ + +#ifndef __MACH_TEGRA_BOARD_PINMUX_H +#define __MACH_TEGRA_BOARD_PINMUX_H + +#define GPIO_DEV "tegra-gpio" +#define PINMUX_DEV "tegra-pinmux" + +struct tegra_pingroup_config ; +struct tegra_gpio_table ; + +struct tegra_board_pinmux_conf { +struct tegra_pingroup_config *pgs; +int pg_count; + +struct tegra_drive_pingroup_config *drives; +int drive_count; + +struct tegra_gpio_table *gpios; +int gpio_count; +}; + +void tegra_board_pinmux_init (struct tegra_board_pinmux_conf *conf_a, +struct tegra_board_pinmux_conf *conf_b); + +#endif
arch/arm/mach-tegra/board-seaboard-pinmux.c +25 -26
75 lines not on this page · raw message
arch/arm/mach-tegra/board-trimslice-pinmux.c +10 -12
@@ -21,8 +21,8 @@#include <mach/pinmux.h> #include "gpio-names.h" +#include "board-pinmux.h" #include "board-trimslice.h" -#include "devices.h" static __initdata struct tegra_pingroup_config trimslice_pinmux[] = { {TEGRA_PINGROUP_ATA ,TEGRA_MUX_IDE ,TEGRA_PUPD_NORMAL ,TEGRA_TRI_TRISTATE },
@@ -143,11 +143,6 @@ static __initdata struct tegra_pingroup_config trimslice_pinmux[] = { {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, }; -static struct platform_device *pinmux_devices[] = { - &tegra_gpio_device, - &tegra_pinmux_device, -}; -static struct tegra_gpio_table gpio_table[] = { { .gpio =TRIMSLICE_GPIO_SD4_CD , .enable = true },/* mmc4 cd */ { .gpio = TRIMSLICE_GPIO_SD4_WP, .enable = true }, /* mmc4 wp */
@@ -156,11 +151,14 @@ static struct tegra_gpio_table gpio_table[] = { { .gpio = TRIMSLICE_GPIO_USB2_RST, .enable = true }, /* USB2 PHY rst */ }; -void __init trimslice_pinmux_init (void ) +static struct tegra_board_pinmux_conf conf = { + .pgs = trimslice_pinmux, + .pg_count =ARRAY_SIZE (trimslice_pinmux), + .gpios = gpio_table, + .gpio_count =ARRAY_SIZE (gpio_table), +}; + +void trimslice_pinmux_init (void ) { -if (!of_machine_is_compatible ("nvidia,tegra20" )) -platform_add_devices (pinmux_devices, -ARRAY_SIZE (pinmux_devices)); -tegra_pinmux_config_table (trimslice_pinmux,ARRAY_SIZE (trimslice_pinmux)); -tegra_gpio_config (gpio_table,ARRAY_SIZE (gpio_table)); +tegra_board_pinmux_init (&conf,NULL ); }
Signature · 1 line
1.7.0.4
PATCH 9/9 arm/tegra: Use bus notifiers to trigger pinmux setup
In reply to Stephen WarrenCurrently, the Tegra pinmux is initialized at different times when booting with and without device tree:
Without device tree:
1) Pinmux and GPIO drivers are registered.
2) Pinmux is configured.
3) All other drivers are registered.
With device tree:
1) All drivers are registered and probed, including pinmux and GPIO.
2) Pinmux is configured.
This change modifies board-pinmux.c to detect pinmux and GPIO driver registration using bus notifiers. This allows pinmux configuration to happen immediately after the pinmux driver is probed, irrespective of whether the pinmux driver is manually registered by board-pinmux.c, or if it's instantiated during device tree parsing.
To support this with device tree, the pinmux init functions must be called prior to instantiating devices from device tree, so that the notifiers are set up before-hand.
--- arch/arm/mach-tegra/board-dt.c | 14 +++--- arch/arm/mach-tegra/board-pinmux.c | 72 +++++++++++++++++++++++++++++++----- 2 files changed, 69 insertions(+), 17 deletions(-)
arch/arm/mach-tegra/board-dt.c +7 -7
@@ -123,13 +123,6 @@ static void __init tegra_dt_init(void)tegra_clk_init_from_table (tegra_dt_clk_init_table); -/* -* Finished with the static registrations now; fill in the missing -* devices -*/ -of_platform_populate (NULL , tegra_dt_match_table, - tegra20_auxdata_lookup,NULL ); -for (i =0 ; i <ARRAY_SIZE (pinmux_configs); i++) {if (of_machine_is_compatible (pinmux_configs[i].machine)) { pinmux_configs[i].init ();
@@ -139,6 +132,13 @@ static void __init tegra_dt_init(void)WARN (i ==ARRAY_SIZE (pinmux_configs),"Unknown platform! Pinmuxing not initialized\n" ); + +/* +* Finished with the static registrations now; fill in the missing +* devices +*/ +of_platform_populate (NULL , tegra_dt_match_table, + tegra20_auxdata_lookup,NULL ); }static const char * tegra_dt_board_compat[] = {
arch/arm/mach-tegra/board-pinmux.c +62 -10
98 lines not on this page · raw message
Signature · 1 line
1.7.0.4
cover arm/tegra: Various pinmux-related cleanups
In reply to Stephen WarrenQuoted 7 lines · Stephen Warren
While working on switching Tegra to a new pinctrl-based pin mux driver, I made a bunch of small pinmux-related fixes; this patch series.
This patch series will have a few small context conflicts with Peter De Schrijver's Tegra30 support. Peter's patch series should have priority over this one (i.e. be the one merged if it's difficult to merge both).
Contents of the series as a whole looks good to me, but I did notice a bunch of section mismatches. Instead of commenting on the specific ones, just compile with CONFIG_DEBUG_SECTION_MISMATCH=y and fix up the new ones and repost, please. :)
Quoted 9 lines
In particular:
* My patch 3 "arm/tegra: Harmony PCIe: Don't touch pinmux" and Peter's patch "arm/tegra: prepare pinmux code for multiple tegra variants" will have context conflicts; I've described the best way to resolve this in my patch's commit description.
* This series editsboard-dt.cwhereas Peter's series renames that toboard-dt-tegra20.c. I assume git will handle this without any issue.
* There may be other obvious context conflicts that should be trivial to resolve.
The fixups were indeed trivial and no big deal, thanks for providing the preferred resolutions and heads-up though.
Quoted 7 lines
Following this series, I have 3 patches in my local tree:
arm/tegra: Select PINMUXKconfigvariables arm/tegra: Switch to new pinctrl driver arm/tegra: Remove pre-pinctrl pinmux driver(all work in DT and non-DT on all supported Tegra20 boards)
Quoted 7 lines
I need to rebase those on top of Peter's patches (the first patch needs updates for Tegra30 support, the last patch needs to delete the new Tegra30 pinmux driver that Peter's series adds). It will also depend on the pinctrl subsystem, which is being merged for the first time in 3.3, and probably also patches to pinctrl that may only show up in 3.4. So, I'll probably hold off posting those patches for merge until after 3.3 is out, but will probably send them out as a preview before that.
It's no problem to add a topic branch that has dependencies and make sure it gets merged upstream with said dependencies resolved, as long as they are on stable branches by then (i.e. that they won't be rebased). So either way works, it's up to you.
-Olof
cover arm/tegra: Various pinmux-related cleanups
Olof Johansson wrote at Saturday, December 17, 2011 5:57 PM:
Quoted 9 lines · Stephen Warren
Quoted 7 lines
While working on switching Tegra to a new pinctrl-based pin mux driver, I made a bunch of small pinmux-related fixes; this patch series.
This patch series will have a few small context conflicts with Peter De Schrijver's Tegra30 support. Peter's patch series should have priority over this one (i.e. be the one merged if it's difficult to merge both).
Quoted 4 lines
Contents of the series as a whole looks good to me, but I did notice a bunch of section mismatches. Instead of commenting on the specific ones, just compile with
CONFIG_DEBUG_SECTION_MISMATCH=yand fix up the new ones and repost, please. :)
Just to close the loop on our IRC conversation, I believe those problems were introduced by the pinmux rework in Peter's T30 patches rather than my patch series. In particular, some in:
6996e08 arm/tegra: prepare pinmux code for multiple tegra variants
And some in:
241682c arm/tegra: pinmux tables and definitions for tegra30
Although the latter don't show up until:
44107d8 arm/tegra: implement support for tegra30
Since that actually creates the Kconfig option that allows the T30 pinmux code to be built.
I'll take a look and come up with a patch for this that can be applied to Tegra's for-3.3/soc branch.
Signature · 1 line
nvpublic
cover arm/tegra: Various pinmux-related cleanups
Quoted 27 lines · Stephen Warren
Olof Johansson wrote at Saturday, December 17, 2011 5:57 PM:
Quoted 9 lines · Stephen Warren
Quoted 7 lines
While working on switching Tegra to a new pinctrl-based pin mux driver, I made a bunch of small pinmux-related fixes; this patch series.
This patch series will have a few small context conflicts with Peter De Schrijver's Tegra30 support. Peter's patch series should have priority over this one (i.e. be the one merged if it's difficult to merge both).
Quoted 4 lines
Contents of the series as a whole looks good to me, but I did notice a bunch of section mismatches. Instead of commenting on the specific ones, just compile with
CONFIG_DEBUG_SECTION_MISMATCH=yand fix up the new ones and repost, please. :)Just to close the loop on our IRC conversation, I believe those problems were introduced by the pinmux rework in Peter's T30 patches rather than my patch series. In particular, some in:
6996e08 arm/tegra: prepare pinmux code for multiple tegra variants
And some in:
241682c arm/tegra: pinmux tables and definitions for tegra30
Although the latter don't show up until:
Quoted 7 lines
44107d8 arm/tegra: implement support for tegra30
Since that actually creates the
Kconfigoption that allows the T30 pinmux code to be built.I'll take a look and come up with a patch for this that can be applied to Tegra's for-3.3/soc branch.
Yep, sounds good. Applied this series to for-3.3/boards -- thanks!
-Olof