Skip to contentSkip to conversation

ARM: tegra: Add pinmux board file for Cardhu

PATCH Superseded Stephen Warren 2 participants 3 messages Jan 25, 2012 – Feb 1, 2012

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

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

---
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.

This of course depends on my recently posted patches that implement a pinctrl subsystem driver for Tegra.

(Peter said: Boot tested on Cardhu, MMC still doesn't work but that might have another rootcause...)

 arch/arm/mach-tegra/Makefile              |    1 +
 arch/arm/mach-tegra/board-cardhu-pinmux.c |   60 +++++++++++++++++++++++++++++
 arch/arm/mach-tegra/board-cardhu.h        |   28 +++++++++++++
 arch/arm/mach-tegra/board-dt-tegra30.c    |   25 +++++++++++-
 arch/arm/mach-tegra/board-pinmux.c        |    2 +-
 5 files changed, 114 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 +60 -0

60 lines not on this page · raw message

arch/arm/mach-tegra/board-cardhu.h new file +28 -0
new file mode 100644
index 0000000..184410e
@@ -0,0 +1,28 @@
+/*
+ * 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
+#define TEGRA_GPIO_SD1_WP		TEGRA_GPIO_PT3
+
+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 1/1 ARM: tegra: Add pinmux board file for Cardhu

Quoted 10 lines · Stephen Warren

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

---
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 5 lines

This of course depends on my recently posted patches that implement a pinctrl subsystem driver for Tegra.

(Peter said: Boot tested on Cardhu, MMC still doesn't work but that might have another rootcause...)

Thanks, applied.

-Olof

#2 lore raw

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

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.

---
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 7 lines
Quoted 5 lines

This of course depends on my recently posted patches that implement a pinctrl subsystem driver for Tegra.

(Peter said: Boot tested on Cardhu, MMC still doesn't work but that might have another rootcause...)

Thanks, applied.

Actually, dropped again until the pinctrl stuff lands for the obvious reason. I'll revisit shortly.

-Olof