Skip to contentSkip to conversation

arm/tegra: Prep boards for gpio/pinmux conversion to pdevs

PATCH New Stephen Warren 3 participants 14 messages Oct 11, 2011 – Oct 13, 2011

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

PATCH v4 1/4 arm/tegra: Prep boards for gpio/pinmux conversion to pdevs

The Tegra GPIO driver will be converted from static registration via postcore_initcall() to be a platform device later in this patch series. A new Tegra pinmux platform device will also be added.

Prepare for this by modifying all boards to register the appropriate platform devices before-hand, so that when the drivers are converted, those devices will be probed, and git bisectability will be maintained.

v2: Add resource definitions for GPIO and pinmux

---
 arch/arm/mach-tegra/board-harmony-pinmux.c   |    8 +++
 arch/arm/mach-tegra/board-paz00-pinmux.c     |    8 +++
 arch/arm/mach-tegra/board-seaboard-pinmux.c  |    9 ++-
 arch/arm/mach-tegra/board-trimslice-pinmux.c |    7 ++
 arch/arm/mach-tegra/devices.c                |   84 ++++++++++++++++++++++++++
 arch/arm/mach-tegra/devices.h                |    2 +
 6 files changed, 116 insertions(+), 2 deletions(-)
arch/arm/mach-tegra/board-harmony-pinmux.c +8 -0
index 4d63e2e..e99b456 100644
@@ -20,6 +20,7 @@
 
 #include "gpio-names.h"
 #include "board-harmony.h"
+#include "devices.h"
 
 static struct tegra_pingroup_config harmony_pinmux[] = {
 	{TEGRA_PINGROUP_ATA,   TEGRA_MUX_IDE,           TEGRA_PUPD_NORMAL,    TEGRA_TRI_NORMAL},
@@ -140,6 +141,11 @@ 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	},
@@ -155,6 +161,8 @@ static struct tegra_gpio_table gpio_table[] = {
 
 void harmony_pinmux_init(void)
 {
+	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));
arch/arm/mach-tegra/board-paz00-pinmux.c +8 -0
index 2225769..fb20894 100644
@@ -20,6 +20,7 @@
 
 #include "gpio-names.h"
 #include "board-paz00.h"
+#include "devices.h"
 
 static struct tegra_pingroup_config paz00_pinmux[] = {
 	{TEGRA_PINGROUP_ATA,   TEGRA_MUX_GMI,           TEGRA_PUPD_NORMAL,    TEGRA_TRI_NORMAL},
@@ -140,6 +141,11 @@ 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 },
@@ -152,6 +158,8 @@ static struct tegra_gpio_table gpio_table[] = {
 
 void paz00_pinmux_init(void)
 {
+	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));
arch/arm/mach-tegra/board-seaboard-pinmux.c +7 -2
index 74f78b7..f092298 100644
@@ -21,6 +21,7 @@
 
 #include "gpio-names.h"
 #include "board-seaboard.h"
+#include "devices.h"
 
 #define DEFAULT_DRIVE(_name)					\
 	{							\
@@ -157,8 +158,10 @@ static __initdata struct tegra_pingroup_config seaboard_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 },
@@ -173,6 +176,8 @@ static struct tegra_gpio_table gpio_table[] = {
 
 void __init seaboard_pinmux_init(void)
 {
+	platform_add_devices(pinmux_devices, ARRAY_SIZE(pinmux_devices));
+
 	tegra_pinmux_config_table(seaboard_pinmux, ARRAY_SIZE(seaboard_pinmux));
 
 	tegra_drive_pinmux_config_table(seaboard_drive_pinmux,
arch/arm/mach-tegra/board-trimslice-pinmux.c +7 -0
index bcb1916..4969dd2 100644
@@ -21,6 +21,7 @@
 
 #include "gpio-names.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},
@@ -141,6 +142,11 @@ 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 */
@@ -151,6 +157,7 @@ static struct tegra_gpio_table gpio_table[] = {
 
 void __init trimslice_pinmux_init(void)
 {
+	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));
 }
arch/arm/mach-tegra/devices.c +84 -0

90 lines not on this page · raw message

arch/arm/mach-tegra/devices.h +2 -0
index 4a7dc0a..873ecb2 100644
@@ -21,6 +21,8 @@
 
 #include <linux/platform_device.h>
 
+extern struct platform_device tegra_gpio_device;
+extern struct platform_device tegra_pinmux_device;
 extern struct platform_device tegra_sdhci_device1;
 extern struct platform_device tegra_sdhci_device2;
 extern struct platform_device tegra_sdhci_device3;
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH v4 2/4 arm/dt: Tegra: Add pinmux node to tegra20.dtsi

Add a pinmux node to tegra20.dtsi in order to instantiate the future pinmux device.

v2: Specify reg property precisely; don't just point at the whole APB_MISC register range.

---
 .../devicetree/bindings/pinmux/pinmux_nvidia.txt   |    5 +++++
 arch/arm/boot/dts/tegra20.dtsi                     |    8 ++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/pinmux/pinmux_nvidia.txt
Documentation/devicetree/bindings/pinmux/pinmux_nvidia.txt new file +5 -0
new file mode 100644
index 0000000..36f82db
@@ -0,0 +1,5 @@
+NVIDIA Tegra 2 pinmux controller
+
+Required properties:
+- compatible : "nvidia,tegra20-pinmux"
+
arch/arm/boot/dts/tegra20.dtsi +8 -0
index 5727595..65d7e6a 100644
@@ -77,6 +77,14 @@
 		gpio-controller;
 	};
 
+	pinmux: pinmux at 70000000 {
+		compatible = "nvidia,tegra20-pinmux";
+		reg = < 0x70000014 0x10    /* Tri-state registers */
+			0x70000080 0x20    /* Mux registers */
+			0x700000a0 0x14    /* Pull-up/down registers */
+			0x70000868 0xa8 >; /* Pad control registers */
+	};
+
 	serial at 70006000 {
 		compatible = "nvidia,tegra20-uart";
 		reg = <0x70006000 0x40>;
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH v4 2/4 arm/dt: Tegra: Add pinmux node to tegra20.dtsi

Quoted 7 lines · Stephen Warren

Add a pinmux node to tegra20.dtsi in order to instantiate the future pinmux device.

v2: Specify reg property precisely; don't just point at the whole APB_MISC register range.

Thanks, applied to for-3.2/features.

-Olof

#3 lore raw

PATCH v4 3/4 gpio/tegra: Convert to a platform device

In reply to Stephen Warren

v3: Make regs variable static. Remove empty init of tegra_gpio_banks.

v2: Retrieve IRQ and memory addresses from resources instead of hard- coding them. Add back initialization of tegra_gpio_chip.of_node.

gpio fixup

---
 drivers/gpio/gpio-tegra.c |  143 ++++++++++++++++++++++++++++++---------------
 1 files changed, 95 insertions(+), 48 deletions(-)
drivers/gpio/gpio-tegra.c +95 -48
index 6b65207..4cb59ed 100644
@@ -20,10 +20,11 @@
 #include <linux/init.h>
 #include <linux/irq.h>
 #include <linux/interrupt.h>
-
 #include <linux/io.h>
 #include <linux/gpio.h>
 #include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/module.h>
 
 #include <asm/mach/irq.h>
 
@@ -35,9 +36,7 @@
 #define GPIO_PORT(x)		(((x) >> 3) & 0x3)
 #define GPIO_BIT(x)		((x) & 0x7)
 
-#define GPIO_REG(x)		(IO_TO_VIRT(TEGRA_GPIO_BASE) +	\
-				 GPIO_BANK(x) * 0x80 +		\
-				 GPIO_PORT(x) * 4)
+#define GPIO_REG(x)		(GPIO_BANK(x) * 0x80 + GPIO_PORT(x) * 4)
 
 #define GPIO_CNF(x)		(GPIO_REG(x) + 0x00)
 #define GPIO_OE(x)		(GPIO_REG(x) + 0x10)
@@ -76,15 +75,18 @@ struct tegra_gpio_bank {
 };
 
 
-static struct tegra_gpio_bank tegra_gpio_banks[] = {
-	{.bank = 0, .irq = INT_GPIO1},
-	{.bank = 1, .irq = INT_GPIO2},
-	{.bank = 2, .irq = INT_GPIO3},
-	{.bank = 3, .irq = INT_GPIO4},
-	{.bank = 4, .irq = INT_GPIO5},
-	{.bank = 5, .irq = INT_GPIO6},
-	{.bank = 6, .irq = INT_GPIO7},
-};
+static void __iomem *regs;
+static struct tegra_gpio_bank tegra_gpio_banks[7];
+
+static inline void tegra_gpio_writel(u32 val, u32 reg)
+{
+	__raw_writel(val, regs + reg);
+}
+
+static inline u32 tegra_gpio_readl(u32 reg)
+{
+	return __raw_readl(regs + reg);
+}
 
 static int tegra_gpio_compose(int bank, int port, int bit)
 {
@@ -98,7 +100,7 @@ static void tegra_gpio_mask_write(u32 reg, int gpio, int value)
 	val = 0x100 << GPIO_BIT(gpio);
 	if (value)
 		val |= 1 << GPIO_BIT(gpio);
-	__raw_writel(val, reg);
+	tegra_gpio_writel(val, reg);
 }
 
 void tegra_gpio_enable(int gpio)
@@ -118,7 +120,7 @@ static void tegra_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 
 static int tegra_gpio_get(struct gpio_chip *chip, unsigned offset)
 {
-	return (__raw_readl(GPIO_IN(offset)) >> GPIO_BIT(offset)) & 0x1;
+	return (tegra_gpio_readl(GPIO_IN(offset)) >> GPIO_BIT(offset)) & 0x1;
 }
 
 static int tegra_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
@@ -155,7 +157,7 @@ static void tegra_gpio_irq_ack(struct irq_data *d)
 {
 	int gpio = d->irq - INT_GPIO_BASE;
 
-	__raw_writel(1 << GPIO_BIT(gpio), GPIO_INT_CLR(gpio));
+	tegra_gpio_writel(1 << GPIO_BIT(gpio), GPIO_INT_CLR(gpio));
 }
 
 static void tegra_gpio_irq_mask(struct irq_data *d)
@@ -208,10 +210,10 @@ static int tegra_gpio_irq_set_type(struct irq_data *d, unsigned int type)
 
 	spin_lock_irqsave(&bank->lvl_lock[port], flags);
 
-	val = __raw_readl(GPIO_INT_LVL(gpio));
+	val = tegra_gpio_readl(GPIO_INT_LVL(gpio));
 	val &= ~(GPIO_INT_LVL_MASK << GPIO_BIT(gpio));
 	val |= lvl_type << GPIO_BIT(gpio);
-	__raw_writel(val, GPIO_INT_LVL(gpio));
+	tegra_gpio_writel(val, GPIO_INT_LVL(gpio));
 
 	spin_unlock_irqrestore(&bank->lvl_lock[port], flags);
 
@@ -237,12 +239,12 @@ static void tegra_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
 
 	for (port = 0; port < 4; port++) {
 		int gpio = tegra_gpio_compose(bank->bank, port, 0);
-		unsigned long sta = __raw_readl(GPIO_INT_STA(gpio)) &
-			__raw_readl(GPIO_INT_ENB(gpio));
-		u32 lvl = __raw_readl(GPIO_INT_LVL(gpio));
+		unsigned long sta = tegra_gpio_readl(GPIO_INT_STA(gpio)) &
+			tegra_gpio_readl(GPIO_INT_ENB(gpio));
+		u32 lvl = tegra_gpio_readl(GPIO_INT_LVL(gpio));
 
 		for_each_set_bit(pin, &sta, 8) {
-			__raw_writel(1 << pin, GPIO_INT_CLR(gpio));
+			tegra_gpio_writel(1 << pin, GPIO_INT_CLR(gpio));
 
 			/* if gpio is edge triggered, clear condition
 			 * before executing the hander so that we don't
@@ -276,11 +278,11 @@ void tegra_gpio_resume(void)
 
 		for (p = 0; p < ARRAY_SIZE(bank->oe); p++) {
 			unsigned int gpio = (b<<5) | (p<<3);
-			__raw_writel(bank->cnf[p], GPIO_CNF(gpio));
-			__raw_writel(bank->out[p], GPIO_OUT(gpio));
-			__raw_writel(bank->oe[p], GPIO_OE(gpio));
-			__raw_writel(bank->int_lvl[p], GPIO_INT_LVL(gpio));
-			__raw_writel(bank->int_enb[p], GPIO_INT_ENB(gpio));
+			tegra_gpio_writel(bank->cnf[p], GPIO_CNF(gpio));
+			tegra_gpio_writel(bank->out[p], GPIO_OUT(gpio));
+			tegra_gpio_writel(bank->oe[p], GPIO_OE(gpio));
+			tegra_gpio_writel(bank->int_lvl[p], GPIO_INT_LVL(gpio));
+			tegra_gpio_writel(bank->int_enb[p], GPIO_INT_ENB(gpio));
 		}
 	}
 
@@ -299,11 +301,11 @@ void tegra_gpio_suspend(void)
 
 		for (p = 0; p < ARRAY_SIZE(bank->oe); p++) {
 			unsigned int gpio = (b<<5) | (p<<3);
-			bank->cnf[p] = __raw_readl(GPIO_CNF(gpio));
-			bank->out[p] = __raw_readl(GPIO_OUT(gpio));
-			bank->oe[p] = __raw_readl(GPIO_OE(gpio));
-			bank->int_enb[p] = __raw_readl(GPIO_INT_ENB(gpio));
-			bank->int_lvl[p] = __raw_readl(GPIO_INT_LVL(gpio));
+			bank->cnf[p] = tegra_gpio_readl(GPIO_CNF(gpio));
+			bank->out[p] = tegra_gpio_readl(GPIO_OUT(gpio));
+			bank->oe[p] = tegra_gpio_readl(GPIO_OE(gpio));
+			bank->int_enb[p] = tegra_gpio_readl(GPIO_INT_ENB(gpio));
+			bank->int_lvl[p] = tegra_gpio_readl(GPIO_INT_LVL(gpio));
 		}
 	}
 	local_irq_restore(flags);
@@ -333,28 +335,55 @@ static struct irq_chip tegra_gpio_irq_chip = {
  */
 static struct lock_class_key gpio_lock_class;
 
-static int __init tegra_gpio_init(void)
+static int __init tegra_gpio_probe(struct platform_device *pdev)
 {
+	struct resource *res;
 	struct tegra_gpio_bank *bank;
 	int gpio;
 	int i;
 	int j;
 
+	for (i = 0; i < ARRAY_SIZE(tegra_gpio_banks); i++) {
+		res = platform_get_resource(pdev, IORESOURCE_IRQ, i);
+		if (!res) {
+			dev_err(&pdev->dev, "Missing IRQ resource\n");
+			return -ENODEV;
+		}
+
+		bank = &tegra_gpio_banks[i];
+		bank->bank = i;
+		bank->irq = res->start;
+	}
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res) {
+		dev_err(&pdev->dev, "Missing MEM resource\n");
+		return -ENODEV;
+	}
+
+	if (!devm_request_mem_region(&pdev->dev, res->start,
+				     resource_size(res),
+				     dev_name(&pdev->dev))) {
+		dev_err(&pdev->dev, "Couldn't request MEM resource\n");
+		return -ENODEV;
+	}
+
+	regs = devm_ioremap(&pdev->dev, res->start, resource_size(res));
+	if (!regs) {
+		dev_err(&pdev->dev, "Couldn't ioremap regs\n");
+		return -ENODEV;
+	}
+
 	for (i = 0; i < 7; i++) {
 		for (j = 0; j < 4; j++) {
 			int gpio = tegra_gpio_compose(i, j, 0);
-			__raw_writel(0x00, GPIO_INT_ENB(gpio));
+			tegra_gpio_writel(0x00, GPIO_INT_ENB(gpio));
 		}
 	}
 
 #ifdef CONFIG_OF_GPIO
-	/*
-	 * This isn't ideal, but it gets things hooked up until this
-	 * driver is converted into a platform_device
-	 */
-	tegra_gpio_chip.of_node = of_find_compatible_node(NULL, NULL,
-						"nvidia,tegra20-gpio");
-#endif /* CONFIG_OF_GPIO */
+	tegra_gpio_chip.of_node = pdev->dev.of_node;
+#endif
 
 	gpiochip_add(&tegra_gpio_chip);
 
@@ -384,6 +413,24 @@ static int __init tegra_gpio_init(void)
 	return 0;
 }
 
+static struct of_device_id tegra_gpio_of_match[] __devinitdata = {
+	{ .compatible = "nvidia,tegra20-gpio", },
+	{ },
+};
+
+static struct platform_driver tegra_gpio_driver = {
+	.driver		= {
+		.name	= "tegra-gpio",
+		.owner	= THIS_MODULE,
+		.of_match_table = tegra_gpio_of_match,
+	},
+	.probe		= tegra_gpio_probe,
+};
+
+static int __init tegra_gpio_init(void)
+{
+	return platform_driver_register(&tegra_gpio_driver);
+}
 postcore_initcall(tegra_gpio_init);
 
 void __init tegra_gpio_config(struct tegra_gpio_table *table, int num)
@@ -416,13 +463,13 @@ static int dbg_gpio_show(struct seq_file *s, void *unused)
 			seq_printf(s,
 				"%d:%d %02x %02x %02x %02x %02x %02x %06x\n",
 				i, j,
-				__raw_readl(GPIO_CNF(gpio)),
-				__raw_readl(GPIO_OE(gpio)),
-				__raw_readl(GPIO_OUT(gpio)),
-				__raw_readl(GPIO_IN(gpio)),
-				__raw_readl(GPIO_INT_STA(gpio)),
-				__raw_readl(GPIO_INT_ENB(gpio)),
-				__raw_readl(GPIO_INT_LVL(gpio)));
+				tegra_gpio_readl(GPIO_CNF(gpio)),
+				tegra_gpio_readl(GPIO_OE(gpio)),
+				tegra_gpio_readl(GPIO_OUT(gpio)),
+				tegra_gpio_readl(GPIO_IN(gpio)),
+				tegra_gpio_readl(GPIO_INT_STA(gpio)),
+				tegra_gpio_readl(GPIO_INT_ENB(gpio)),
+				tegra_gpio_readl(GPIO_INT_LVL(gpio)));
 		}
 	}
 	return 0;
Signature · 1 line
1.7.0.4
#4 lore raw

PATCH v4 3/4 gpio/tegra: Convert to a platform device

Quoted 4 lines · Stephen Warren

v3: Make regs variable static. Remove empty init of tegra_gpio_banks.

v2: Retrieve IRQ and memory addresses from resources instead of hard- coding them. Add back initialization of tegra_gpio_chip.of_node.

In the future, please move the revision log to below the ---, and just have the main patch description above, since that is what goes into the git repo.

Quoted 1 line

Otherwise, patch looks good. Due to dependencies between this, the rest of this patch series and the pinmux changes, I'll hold off on it until the dependencies land (i.e. target it for 3.3). We're cutting it very close to the merge window as it is, I'll start for-3.3 branches shortly.

-Olof

#5 lore raw

PATCH v4 3/4 gpio/tegra: Convert to a platform device

Olof Johansson wrote at Wednesday, October 12, 2011 4:42 PM:

Quoted 8 lines · Stephen Warren
Quoted 4 lines

v3: Make regs variable static. Remove empty init of tegra_gpio_banks.

v2: Retrieve IRQ and memory addresses from resources instead of hard- coding them. Add back initialization of tegra_gpio_chip.of_node.

In the future, please move the revision log to below the ---, and just have the main patch description above, since that is what goes into the git repo.

I don't quite recall when or exactly which Linux-related mailing list I saw it on, but I saw a discussion on this topic, and people pointed out that having the revision log in the git commit message actually has some advantages; it documents some of the things that were though about during the review, and ends up documenting which version of the patch actually ended up in git.

Besides, it's a lot easier to maintain the changelog in the git commit description than in some out-of-band location:-) Although I guess I could edit the files after git format-patch.

So, I wonder if it might be a good idea to check the changelog in?

Signature · 1 line
nvpublic
#6 lore raw

PATCH v4 3/4 gpio/tegra: Convert to a platform device

In reply to Olof Johansson
Quoted 8 lines · Olof Johansson
Quoted 4 lines · Stephen Warren

v3: Make regs variable static. Remove empty init of tegra_gpio_banks.

v2: Retrieve IRQ and memory addresses from resources instead of hard- coding them. Add back initialization of tegra_gpio_chip.of_node.

In the future, please move the revision log to below the ---, and just have the main patch description above, since that is what goes into the git repo.

No! Keep it above the line so it shows up in the Linux commit log. It makes it easier to know which version of a patch actually got committed. :-)

Quoted 6 lines
Quoted 1 line

Otherwise, patch looks good. Due to dependencies between this, the rest of this patch series and the pinmux changes, I'll hold off on it until the dependencies land (i.e. target it for 3.3). We're cutting it very close to the merge window as it is, I'll start for-3.3 branches shortly.

Actually, see if you can get it in via the same tree as the pinmux changes. Dependencies is not a reason to hold off from getting it into linux-next.

g.

#7 lore raw

PATCH v4 3/4 gpio/tegra: Convert to a platform device

Quoted 7 lines · Grant Likely
Quoted 6 lines · Olof Johansson
Quoted 4 lines · Stephen Warren

v3: Make regs variable static. Remove empty init of tegra_gpio_banks.

v2: Retrieve IRQ and memory addresses from resources instead of hard- coding them. Add back initialization of tegra_gpio_chip.of_node.

Quoted 6 lines
Quoted 2 lines

In the future, please move the revision log to below the ---, and just have the main patch description above, since that is what goes into the git repo.

No! Keep it above the line so it shows up in the Linux commit log. It makes it easier to know which version of a patch actually got committed. :-)

Alright, I'm convinced.

Maybe it was the fact that the patch description was 100% revision log that made me notice it this time. :)

Quoted 10 lines
Quoted 6 lines
Quoted 1 line

Otherwise, patch looks good. Due to dependencies between this, the rest of this patch series and the pinmux changes, I'll hold off on it until the dependencies land (i.e. target it for 3.3). We're cutting it very close to the merge window as it is, I'll start for-3.3 branches shortly.

Actually, see if you can get it in via the same tree as the pinmux changes. Dependencies is not a reason to hold off from getting it into linux-next.

Ok, the fixup is minimal, should be trivial to spot at git merge time.

Stephen, do you want to respin yourself or should I do the __devinit change when I apply?

-Olof

#8 lore raw

PATCH v4 3/4 gpio/tegra: Convert to a platform device

Olof Johansson wrote at Wednesday, October 12, 2011 5:19 PM:

Quoted 3 lines · Grant Likely
Quoted 2 lines · Olof Johansson
Quoted 1 line · Stephen Warren

...

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

Otherwise, patch looks good. Due to dependencies between this, the rest of this patch series and the pinmux changes, I'll hold off on it until the dependencies land (i.e. target it for 3.3). We're cutting it very close to the merge window as it is, I'll start for-3.3 branches shortly.

Quoted 8 lines
Quoted 3 lines

Actually, see if you can get it in via the same tree as the pinmux changes. Dependencies is not a reason to hold off from getting it into linux-next.

Ok, the fixup is minimal, should be trivial to spot at git merge time.

Stephen, do you want to respin yourself or should I do the __devinit change when I apply?

I'm happy for you to fix that up when you apply if you're happy doing that.

The same fixup applies to the pinmux patches too.

Signature · 1 line
nvpublic
#9 lore raw

PATCH v4 3/4 gpio/tegra: Convert to a platform device

Quoted 14 lines · Stephen Warren

Olof Johansson wrote at Wednesday, October 12, 2011 5:19 PM:

Quoted 3 lines · Grant Likely
Quoted 2 lines · Olof Johansson
Quoted 1 line · Stephen Warren

...

Quoted 9 lines
Quoted 8 lines
Quoted 4 lines

Otherwise, patch looks good. Due to dependencies between this, the rest of this patch series and the pinmux changes, I'll hold off on it until the dependencies land (i.e. target it for 3.3). We're cutting it very close to the merge window as it is, I'll start for-3.3 branches shortly.

Actually, see if you can get it in via the same tree as the pinmux changes. ?Dependencies is not a reason to hold off from getting it into linux-next.

Quoted 8 lines
Quoted 4 lines

Ok, the fixup is minimal, should be trivial to spot at git merge time.

Stephen, do you want to respin yourself or should I do the __devinit change when I apply?

I'm happy for you to fix that up when you apply if you're happy doing that.

The same fixup applies to the pinmux patches too.

Thanks, applied (and pinmux patch fixed up). for-3.2/features was rebased to roll in the pinmux change.

-Olof

#10 lore raw

PATCH v4 3/4 gpio/tegra: Convert to a platform device

In reply to Stephen Warren
Quoted 6 lines · Stephen Warren

v3: Make regs variable static. Remove empty init of tegra_gpio_banks.

v2: Retrieve IRQ and memory addresses from resources instead of hard- coding them. Add back initialization of tegra_gpio_chip.of_node.

One comment below however.

drivers/gpio/gpio-tegra.c static struct irq_chip tegra_gpio_irq_chip = { · line 338

Quoted 6 lines
(quoted diff) +0 -0
@@ -333,28 +335,55 @@ static struct irq_chip tegra_gpio_irq_chip = {

?*/
?static struct lock_class_key gpio_lock_class;

drivers/gpio/gpio-tegra.c +1 -1
-static int __init tegra_gpio_init(void)
+static int __init tegra_gpio_probe(struct platform_device *pdev)

__devinit because this is put in the .probe hook of the driver.

g.

#11 lore raw

PATCH v4 4/4 arm/tegra: Convert pinmux driver to a platform device

In reply to Stephen Warren
---
 arch/arm/mach-tegra/pinmux.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
arch/arm/mach-tegra/pinmux.c +26 -0
index f80d507..46b9d87 100644
@@ -20,6 +20,7 @@
 #include <linux/errno.h>
 #include <linux/spinlock.h>
 #include <linux/io.h>
+#include <linux/platform_device.h>
 
 #include <mach/iomap.h>
 #include <mach/pinmux.h>
@@ -665,6 +666,31 @@ void tegra_pinmux_config_pullupdown_table(const struct tegra_pingroup_config *co
 	}
 }
 
+static int __init tegra_pinmux_probe(struct platform_device *pdev)
+{
+	return 0;
+}
+
+static struct of_device_id tegra_pinmux_of_match[] __devinitdata = {
+	{ .compatible = "nvidia,tegra20-pinmux", },
+	{ },
+};
+
+static struct platform_driver tegra_pinmux_driver = {
+	.driver		= {
+		.name	= "tegra-pinmux",
+		.owner	= THIS_MODULE,
+		.of_match_table = tegra_pinmux_of_match,
+	},
+	.probe		= tegra_pinmux_probe,
+};
+
+static int __init tegra_pinmux_init(void)
+{
+	return platform_driver_register(&tegra_pinmux_driver);
+}
+postcore_initcall(tegra_pinmux_init);
+
 #ifdef	CONFIG_DEBUG_FS
 
 #include <linux/debugfs.h>
Signature · 1 line
1.7.0.4
#12 lore raw

PATCH v4 4/4 arm/tegra: Convert pinmux driver to a platform device

Quoted 1 line · Stephen Warren

Thanks, applied to for-3.2/features.

(In the future, please give at least a one-sentence patch description in the body).

-Olof

#13 lore raw

PATCH v4 1/4 arm/tegra: Prep boards for gpio/pinmux conversion to pdevs

In reply to Stephen Warren
Quoted 11 lines · Stephen Warren

The Tegra GPIO driver will be converted from static registration via postcore_initcall() to be a platform device later in this patch series. A new Tegra pinmux platform device will also be added.

Prepare for this by modifying all boards to register the appropriate platform devices before-hand, so that when the drivers are converted, those devices will be probed, and git bisectability will be maintained.

v2: Add resource definitions for GPIO and pinmux

Thanks, applied to for-3.2/features.

-Olof