Skip to contentSkip to conversation

ARM: tegra: Add pinmux board file for Cardhu

PATCH New Stephen Warren 2 participants 6 messages Feb 1, 2012 – Feb 27, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 ARM: tegra: Add pinmux board file for Cardhu

For now, this just sets up the pinmux and GPIOs required for the SD card slot.

---
v2:
* Set PULL_UP for CMD and DATA pins on SD interface
* Add power GPIO for SDMMC1
* Add pinmux configuration for SDMMC4

This will hopefully be replaced by the pinmux DT binding in the near future, but until that happens, Tegra30 pinmux functionality needs to be exposed somehow to unblock getting drivers tested on Tegra30.

---
 arch/arm/mach-tegra/Makefile              |    1 +
 arch/arm/mach-tegra/board-cardhu-pinmux.c |   82 +++++++++++++++++++++++++++++
 arch/arm/mach-tegra/board-cardhu.h        |   29 ++++++++++
 arch/arm/mach-tegra/board-dt-tegra30.c    |   25 ++++++++-
 arch/arm/mach-tegra/board-pinmux.c        |    2 +-
 5 files changed, 137 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-tegra/board-cardhu-pinmux.c
 create mode 100644 arch/arm/mach-tegra/board-cardhu.h
arch/arm/mach-tegra/Makefile +1 -0
index b78bda8..49ff80c 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_ARCH_TEGRA_2x_SOC)         += tegra2_clocks.o
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= tegra2_emc.o
 obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= board-dt-tegra30.o
 obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= tegra30_clocks.o
+obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= board-cardhu-pinmux.o
 obj-$(CONFIG_SMP)                       += platsmp.o localtimer.o headsmp.o
 obj-$(CONFIG_HOTPLUG_CPU)               += hotplug.o
 obj-$(CONFIG_TEGRA_SYSTEM_DMA)		+= dma.o apbio.o
arch/arm/mach-tegra/board-cardhu-pinmux.c new file +82 -0

82 lines not on this page · raw message

arch/arm/mach-tegra/board-cardhu.h new file +29 -0
new file mode 100644
index 0000000..0d8dd91
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef _MACH_TEGRA_BOARD_CARDHU_H
+#define _MACH_TEGRA_BOARD_CARDHU_H
+
+#include "gpio-names.h"
+
+#define TEGRA_GPIO_SD1_CD		TEGRA_GPIO_PI5 /* GMI_IORDY */
+#define TEGRA_GPIO_SD1_WP		TEGRA_GPIO_PT3 /* VI_D11 */
+#define TEGRA_GPIO_SD1_POWER		TEGRA_GPIO_PD7 /* VI_HSYNC */
+
+void cardhu_pinmux_init(void);
+
+#endif
arch/arm/mach-tegra/board-dt-tegra30.c +24 -1
index b4124b1..918cbbf 100644
@@ -3,7 +3,7 @@
  *
  * NVIDIA Tegra30 device tree board support
  *
- * Copyright (C) 2011 NVIDIA Corporation
+ * Copyright (C) 2011-2012 NVIDIA Corporation
  *
  * Derived from:
  *
@@ -36,12 +36,16 @@
 #include "board.h"
 #include "clock.h"
 
+void cardhu_pinmux_init(void);
+
 static struct of_device_id tegra_dt_match_table[] __initdata = {
 	{ .compatible = "simple-bus", },
 	{}
 };
 
 struct of_dev_auxdata tegra30_auxdata_lookup[] __initdata = {
+	OF_DEV_AUXDATA("nvidia,tegra30-pinmux", 0x70000868, "tegra-pinmux", NULL),
+	OF_DEV_AUXDATA("nvidia,tegra20-gpio", 0x6000d000, "tegra-gpio", NULL),
 	OF_DEV_AUXDATA("nvidia,tegra20-sdhci", 0x78000000, "sdhci-tegra.0", NULL),
 	OF_DEV_AUXDATA("nvidia,tegra20-sdhci", 0x78000200, "sdhci-tegra.1", NULL),
 	OF_DEV_AUXDATA("nvidia,tegra20-sdhci", 0x78000400, "sdhci-tegra.2", NULL),
@@ -60,10 +64,29 @@ static __initdata struct tegra_clk_init_table tegra_dt_clk_init_table[] = {
 	{ NULL,		NULL,		0,		0},
 };
 
+static struct {
+	char *machine;
+	void (*init)(void);
+} pinmux_configs[] = {
+	{ "nvidia,cardhu", cardhu_pinmux_init },
+};
+
 static void __init tegra30_dt_init(void)
 {
+	int i;
+
 	tegra_clk_init_from_table(tegra_dt_clk_init_table);
 
+	for (i = 0; i < ARRAY_SIZE(pinmux_configs); i++) {
+		if (of_machine_is_compatible(pinmux_configs[i].machine)) {
+			pinmux_configs[i].init();
+			break;
+		}
+	}
+
+	WARN(i == ARRAY_SIZE(pinmux_configs),
+		"Unknown platform! Pinmuxing not initialized\n");
+
 	of_platform_populate(NULL, tegra_dt_match_table,
 				tegra30_auxdata_lookup, NULL);
 }
arch/arm/mach-tegra/board-pinmux.c +1 -1
index 4e18e14..0e145b6 100644
@@ -147,6 +147,6 @@ void tegra_board_pinmux_init(struct tegra_board_pinmux_conf *conf_a,
 
 	bus_register_notifier(&platform_bus_type, &nb);
 
-	if (!of_machine_is_compatible("nvidia,tegra20"))
+	if (!of_have_populated_dt())
 		platform_add_devices(devices, ARRAY_SIZE(devices));
 }
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH v2 2/2 ARM: dt: Add SD controller configuration to Tegra Cardhu

Cardhu uses Tegra's SD ports as follows:
SDMMC1: User SD slot, with GPIOs for power, CD, and WP.
SDMMC2: Not used
SDMMC3: WiFi (currently disabled pending future investigation)
SDMMC4: Internal eMMC

---
 arch/arm/boot/dts/tegra-cardhu.dts |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
arch/arm/boot/dts/tegra-cardhu.dts +18 -0
index 70c41fc..7326350 100644
@@ -33,4 +33,22 @@
 	i2c at 7000d000 {
 		clock-frequency = <100000>;
 	};
+
+	sdhci at 78000000 {
+		cd-gpios = <&gpio 69 0>; /* gpio PI5 */
+		wp-gpios = <&gpio 155 0>; /* gpio PT3 */
+		power-gpios = <&gpio 31 0>; /* gpio PD7 */
+	};
+
+	sdhci at 78000200 {
+		status = "disable";
+	};
+
+	sdhci at 78000400 {
+		status = "disable";
+	};
+
+	sdhci at 78000400 {
+		support-8bit;
+	};
 };
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH v2 1/2 ARM: tegra: Add pinmux board file for Cardhu

In reply to Stephen Warren
Quoted 10 lines · Stephen Warren

For now, this just sets up the pinmux and GPIOs required for the SD card slot.

---
v2:
* Set PULL_UP for CMD and DATA pins on SD interface
* Add power GPIO for SDMMC1
* Add pinmux configuration for SDMMC4

Quoted 3 lines

This will hopefully be replaced by the pinmux DT binding in the near future, but until that happens, Tegra30 pinmux functionality needs to be exposed somehow to unblock getting drivers tested on Tegra30.

Thanks, applied to for-3.4/boards.

-Olof

#2 lore raw

PATCH v2 2/2 ARM: dt: Add SD controller configuration to Tegra Cardhu

In reply to Stephen Warren
Quoted 7 lines · Stephen Warren

Cardhu uses Tegra's SD ports as follows:
SDMMC1: User SD slot, with GPIOs for power, CD, and WP.
SDMMC2: Not used
SDMMC3: WiFi (currently disabled pending future investigation)
SDMMC4: Internal eMMC

Thanks, applied to for-3.4/dt

-Olof

#4 lore raw

PATCH v2 1/2 ARM: tegra: Add pinmux board file for Cardhu

In reply to Olof Johansson
Quoted 11 lines · Olof Johansson
Quoted 10 lines · Stephen Warren

For now, this just sets up the pinmux and GPIOs required for the SD card slot.

---
v2:
* Set PULL_UP for CMD and DATA pins on SD interface
* Add power GPIO for SDMMC1
* Add pinmux configuration for SDMMC4

Quoted 5 lines
Quoted 3 lines

This will hopefully be replaced by the pinmux DT binding in the near future, but until that happens, Tegra30 pinmux functionality needs to be exposed somehow to unblock getting drivers tested on Tegra30.

Thanks, applied to for-3.4/boards.

...and I'm two for two on sending the apply email before I have checked dependencies.

This doesn't build, so I dropped it again. Probably a missing dependency on pinctrl changes but please revisit on top of just the tegra code and let me know.

-Olof

#5 lore raw

PATCH v2 1/2 ARM: tegra: Add pinmux board file for Cardhu

Olof Johansson wrote at Sunday, February 26, 2012 3:14 PM:

Quoted 16 lines · Olof Johansson
Quoted 15 lines · Stephen Warren
Quoted 13 lines

For now, this just sets up the pinmux and GPIOs required for the SD card slot.

---
v2:
* Set PULL_UP for CMD and DATA pins on SD interface
* Add power GPIO for SDMMC1
* Add pinmux configuration for SDMMC4

This will hopefully be replaced by the pinmux DT binding in the near future, but until that happens, Tegra30 pinmux functionality needs to be exposed somehow to unblock getting drivers tested on Tegra30.

Quoted 8 lines
Quoted 1 line

Thanks, applied to for-3.4/boards.

...and I'm two for two on sending the apply email before I have checked dependencies.

This doesn't build, so I dropped it again. Probably a missing dependency on pinctrl changes but please revisit on top of just the tegra code and let me know.

Yes, that's expected. I should have mentioned that this patch depends on changes in the new series that added the new Tegra pinctrl driver, but that hasn't been applied to the Tegra branches since I need to rework the Tegra board files for changes in the pinctrl API etc. I'll repost patches once all the pinctrl rework is finalized.

Signature · 1 line
nvpublic