Skip to contentSkip to conversation

Enable pinctrl-single for omap2/3/4

PATCH New Tony Lindgren 5 participants 15 messages Sep 6, 2012 – Sep 7, 2012

Subsystems (5)
lore
Share & tools
lore

Tony Lindgren

author maintainer
#0 lore raw

cover Enable pinctrl-single for omap2/3/4

Hi all,

Now that pinctrl-single driver is merged, this series enables pinctrl for omap2/3/4.

Regards,

Tony

---

AnilKumar Ch (1):
ARM: OMAP2+: select PINCTRL in Kconfig

Tony Lindgren (4):
arm/dts: Add omap36xx.dtsi file and rename omap3-beagle to omap3-beagle-xm arm/dts: Add pinctrl driver entries for omap2/3/4
arm/dts: Mux uart pins for omap4-sdp
omap-serial: Request pins using pinctrl framework

 arch/arm/boot/dts/omap2420-h4.dts             |    2 +
 arch/arm/boot/dts/omap2420.dtsi               |   22 +++++++++++++
 arch/arm/boot/dts/omap2430.dtsi               |   22 +++++++++++++
 arch/arm/boot/dts/omap3-beagle-xm.dts         |    6 ++--
 arch/arm/boot/dts/omap3.dtsi                  |   25 +++++++++++----
 arch/arm/boot/dts/omap36xx.dtsi               |   25 +++++++++++++++
 arch/arm/boot/dts/omap4-sdp.dts               |   42 +++++++++++++++++++++++++
 arch/arm/boot/dts/omap4.dtsi                  |   17 ++++++++++
 arch/arm/configs/omap2plus_defconfig          |    1 +
 arch/arm/mach-omap2/Kconfig                   |    1 +
 arch/arm/mach-omap2/Makefile.boot             |    2 +
 arch/arm/plat-omap/include/plat/omap-serial.h |    1 +
 drivers/tty/serial/omap-serial.c              |   10 ++++++
 13 files changed, 164 insertions(+), 12 deletions(-)
 create mode 100644 arch/arm/boot/dts/omap2420.dtsi
 create mode 100644 arch/arm/boot/dts/omap2430.dtsi
 rename arch/arm/boot/dts/{omap3-beagle.dts => omap3-beagle-xm.dts} (89%)
 create mode 100644 arch/arm/boot/dts/omap36xx.dtsi
Signature · 1 line
Signature
author maintainer
#1 lore raw

PATCH 1/5 arm/dts: Add omap36xx.dtsi file and rename omap3-beagle to omap3-beagle-xm

The extra serial port is not available on 34xx. And the current omap3-beagle.dts file is for omap3-beagle-xm.dts as it lists 512MB of memory.

Please somebody submit a new omap3-beagle.dts for the original 34xx BeagleBoard after testing it properly.

Cc Benoit Cousson <[email protected]>
Cc devicetree-discuss at lists.ozlabs.org
---
 arch/arm/boot/dts/omap3-beagle-xm.dts |    6 +++---
 arch/arm/boot/dts/omap3.dtsi          |    7 -------
 arch/arm/boot/dts/omap36xx.dtsi       |   25 +++++++++++++++++++++++++
 arch/arm/mach-omap2/Makefile.boot     |    2 +-
 4 files changed, 29 insertions(+), 11 deletions(-)
 rename arch/arm/boot/dts/{omap3-beagle.dts => omap3-beagle-xm.dts} (89%)
 create mode 100644 arch/arm/boot/dts/omap36xx.dtsi
arch/arm/boot/dts/omap3-beagle-xm.dts renamed from arch/arm/boot/dts/omap3-beagle.dts +3 -3
similarity index 89%
rename from arch/arm/boot/dts/omap3-beagle.dts
rename to arch/arm/boot/dts/omap3-beagle-xm.dts
index e60cba0..df6d485 100644
@@ -7,11 +7,11 @@
  */
 /dts-v1/;
 
-/include/ "omap3.dtsi"
+/include/ "omap36xx.dtsi"
 
 / {
-	model = "TI OMAP3 BeagleBoard";
-	compatible = "ti,omap3-beagle", "ti,omap3";
+	model = "TI OMAP3 BeagleBoard xM";
+	compatible = "ti,omap3-beagle-xm, ti,omap3-beagle", "ti,omap3";
 
 	memory {
 		device_type = "memory";
arch/arm/boot/dts/omap3.dtsi +0 -7
index 8109471..9965ed6 100644
@@ -17,7 +17,6 @@
 		serial0 = &uart1;
 		serial1 = &uart2;
 		serial2 = &uart3;
-		serial3 = &uart4;
 	};
 
 	cpus {
@@ -141,12 +140,6 @@
 			clock-frequency = <48000000>;
 		};
 
-		uart4: serial at 49042000 {
-			compatible = "ti,omap3-uart";
-			ti,hwmods = "uart4";
-			clock-frequency = <48000000>;
-		};
-
 		i2c1: i2c at 48070000 {
 			compatible = "ti,omap3-i2c";
 			#address-cells = <1>;
arch/arm/boot/dts/omap36xx.dtsi new file +25 -0
new file mode 100644
index 0000000..96bf028
@@ -0,0 +1,25 @@
+/*
+ * Device Tree Source for OMAP3 SoC
+ *
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+/include/ "omap3.dtsi"
+
+/ {
+	aliases {
+		serial3 = &uart4;
+	};
+
+	ocp {
+		uart4: serial at 49042000 {
+			compatible = "ti,omap3-uart";
+			ti,hwmods = "uart4";
+			clock-frequency = <48000000>;
+		};
+	};
+};
arch/arm/mach-omap2/Makefile.boot +1 -1
index 6cf1c2d..0e602b7 100644
@@ -3,7 +3,7 @@ params_phys-y		:= 0x80000100
 initrd_phys-y		:= 0x80800000
 
 dtb-$(CONFIG_SOC_OMAP2420)	+= omap2420-h4.dtb
-dtb-$(CONFIG_ARCH_OMAP3)	+= omap3-beagle.dtb omap3-evm.dtb
+dtb-$(CONFIG_ARCH_OMAP3)	+= omap3-beagle-xm.dtb omap3-evm.dtb
 dtb-$(CONFIG_ARCH_OMAP4)	+= omap4-panda.dtb omap4-pandaES.dtb
 dtb-$(CONFIG_ARCH_OMAP4)	+= omap4-var_som.dtb omap4-sdp.dtb
 dtb-$(CONFIG_SOC_OMAP5)		+= omap5-evm.dtb
#2 lore raw

PATCH 1/5 arm/dts: Add omap36xx.dtsi file and rename omap3-beagle to omap3-beagle-xm

Hi Tony,

Quoted 3 lines · Tony Lindgren

The extra serial port is not available on 34xx. And the current omap3-beagle.dts file is for omap3-beagle-xm.dts as it lists 512MB of memory.

Indeed, my Beagle is in fact a xM :-)

It is too bad that we do have to duplicate the DTS file for all the board variants. Peter already did that for pandaES and at that time I was wondering if this was needed or not.

That being said, I'm not sure we have any good way to handle two boards using the same DTS. It means that will we will have to rely on the bootloader now to select the proper DTB.

Please not that's I'm queuing a bunch of OMAP2/3/4/5/AM33XX for you, so you might have to rebase that one on top.

The branch is there.

git://git.kernel.org/pub/scm/linux/kernel/git/bcousson/linux-omap-dt.git for_3.7/dts

I'm still waiting for a couple of AM33xx pinmux patches from Anil that should re acked by some folks who know that (like you :-)).

I'll send you the pull request next week.

Regards,
Benoit

Quoted 107 lines

Please somebody submit a new omap3-beagle.dts for the original 34xx BeagleBoard after testing it properly.

Cc Benoit Cousson <[email protected]>
Cc devicetree-discuss at lists.ozlabs.org
---
 arch/arm/boot/dts/omap3-beagle-xm.dts |    6 +++---
 arch/arm/boot/dts/omap3.dtsi          |    7 -------
 arch/arm/boot/dts/omap36xx.dtsi       |   25 +++++++++++++++++++++++++
 arch/arm/mach-omap2/Makefile.boot     |    2 +-
 4 files changed, 29 insertions(+), 11 deletions(-)
 rename arch/arm/boot/dts/{omap3-beagle.dts => omap3-beagle-xm.dts} (89%)
 create mode 100644 arch/arm/boot/dts/omap36xx.dtsi
arch/arm/boot/dts/omap3-beagle-xm.dts renamed from arch/arm/boot/dts/omap3-beagle.dts +3 -3
similarity index 89%
rename from arch/arm/boot/dts/omap3-beagle.dts
rename to arch/arm/boot/dts/omap3-beagle-xm.dts
index e60cba0..df6d485 100644
@@ -7,11 +7,11 @@
  */
 /dts-v1/;
 
-/include/ "omap3.dtsi"
+/include/ "omap36xx.dtsi"
 
 / {
-	model = "TI OMAP3 BeagleBoard";
-	compatible = "ti,omap3-beagle", "ti,omap3";
+	model = "TI OMAP3 BeagleBoard xM";
+	compatible = "ti,omap3-beagle-xm, ti,omap3-beagle", "ti,omap3";
 
 	memory {
 		device_type = "memory";
arch/arm/boot/dts/omap3.dtsi +0 -7
index 8109471..9965ed6 100644
@@ -17,7 +17,6 @@
 		serial0 = &uart1;
 		serial1 = &uart2;
 		serial2 = &uart3;
-		serial3 = &uart4;
 	};
 
 	cpus {
@@ -141,12 +140,6 @@
 			clock-frequency = <48000000>;
 		};
 
-		uart4: serial at 49042000 {
-			compatible = "ti,omap3-uart";
-			ti,hwmods = "uart4";
-			clock-frequency = <48000000>;
-		};
-
 		i2c1: i2c at 48070000 {
 			compatible = "ti,omap3-i2c";
 			#address-cells = <1>;
arch/arm/boot/dts/omap36xx.dtsi new file +25 -0
new file mode 100644
index 0000000..96bf028
@@ -0,0 +1,25 @@
+/*
+ * Device Tree Source for OMAP3 SoC
+ *
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+/include/ "omap3.dtsi"
+
+/ {
+	aliases {
+		serial3 = &uart4;
+	};
+
+	ocp {
+		uart4: serial at 49042000 {
+			compatible = "ti,omap3-uart";
+			ti,hwmods = "uart4";
+			clock-frequency = <48000000>;
+		};
+	};
+};
arch/arm/mach-omap2/Makefile.boot +1 -1
index 6cf1c2d..0e602b7 100644
@@ -3,7 +3,7 @@ params_phys-y		:= 0x80000100
 initrd_phys-y		:= 0x80800000
 
 dtb-$(CONFIG_SOC_OMAP2420)	+= omap2420-h4.dtb
-dtb-$(CONFIG_ARCH_OMAP3)	+= omap3-beagle.dtb omap3-evm.dtb
+dtb-$(CONFIG_ARCH_OMAP3)	+= omap3-beagle-xm.dtb omap3-evm.dtb
 dtb-$(CONFIG_ARCH_OMAP4)	+= omap4-panda.dtb omap4-pandaES.dtb
 dtb-$(CONFIG_ARCH_OMAP4)	+= omap4-var_som.dtb omap4-sdp.dtb
 dtb-$(CONFIG_SOC_OMAP5)		+= omap5-evm.dtb
author maintainer
#3 lore raw

PATCH 2/5 arm/dts: Add pinctrl driver entries for omap2/3/4

In reply to Tony Lindgren

Add pinctrl driver entries for omap2+. These all use the generic pinctrl-single driver for the padconf registers.

Note that as 2420 and 2430 have different padmux registers, we now need to include omap2420.dtsi from omap2420-h4.dts.

Cc Linus Walleij <[email protected]>
Cc devicetree-discuss at lists.ozlabs.org
---
 arch/arm/boot/dts/omap2420-h4.dts |    2 +-
 arch/arm/boot/dts/omap2420.dtsi   |   22 ++++++++++++++++++++++
 arch/arm/boot/dts/omap2430.dtsi   |   22 ++++++++++++++++++++++
 arch/arm/boot/dts/omap3.dtsi      |   18 ++++++++++++++++++
 arch/arm/boot/dts/omap4.dtsi      |   17 +++++++++++++++++
 5 files changed, 80 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/omap2420.dtsi
 create mode 100644 arch/arm/boot/dts/omap2430.dtsi
arch/arm/boot/dts/omap2420-h4.dts +1 -1
index 25b50b7..77b84e1 100644
@@ -7,7 +7,7 @@
  */
 /dts-v1/;
 
-/include/ "omap2.dtsi"
+/include/ "omap2420.dtsi"
 
 / {
 	model = "TI OMAP2420 H4 board";
arch/arm/boot/dts/omap2420.dtsi new file +22 -0
new file mode 100644
index 0000000..8097d13
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/include/ "omap2.dtsi"
+
+/ {
+	ocp {
+		omap2420_pmx: pinmux at 48000030 {
+			compatible = "ti,omap2420-padconf", "pinctrl-single";
+			reg = <0x48000030 0x0113>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			pinctrl-single,register-width = <8>;
+			pinctrl-single,function-mask = <0x3f>;
+		};
+	};
+};
arch/arm/boot/dts/omap2430.dtsi new file +22 -0
new file mode 100644
index 0000000..d27b6f5
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/include/ "omap2.dtsi"
+
+/ {
+	ocp {
+		omap2430_pmx: pinmux at 49002030 {
+			compatible = "ti,omap2430-padconf", "pinctrl-single";
+			reg = <0x49002030 0x0154>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			pinctrl-single,register-width = <8>;
+			pinctrl-single,function-mask = <0x3f>;
+		};
+	};
+};
arch/arm/boot/dts/omap3.dtsi +18 -0
index 9965ed6..c3334bf 100644
@@ -68,6 +68,24 @@
 			reg = <0x48200000 0x1000>;
 		};
 
+		omap3_pmx_core: pinmux at 48002030 {
+			compatible = "ti,omap3-padconf", "pinctrl-single";
+			reg = <0x48002030 0x05cc>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			pinctrl-single,register-width = <16>;
+			pinctrl-single,function-mask = <0x7fff>;
+		};
+
+		omap3_pmx_wkup: pinmux at 0x48002a58 {
+			compatible = "ti,omap3-padconf", "pinctrl-single";
+			reg = <0x48002a58 0x5c>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			pinctrl-single,register-width = <16>;
+			pinctrl-single,function-mask = <0x7fff>;
+		};
+
 		gpio1: gpio at 48310000 {
 			compatible = "ti,omap3-gpio";
 			ti,hwmods = "gpio1";
arch/arm/boot/dts/omap4.dtsi +17 -0
index 04cbbcb..4aaab12 100644
@@ -104,6 +104,23 @@
 			      <0x48240100 0x0100>;
 		};
 
+		omap4_pmx_core: pinmux at 4a100040 {
+			compatible = "ti,omap4-padconf", "pinctrl-single";
+			reg = <0x4a100040 0x0196>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			pinctrl-single,register-width = <16>;
+			pinctrl-single,function-mask = <0x7fff>;
+		};
+		omap4_pmx_wkup: pinmux at 4a31e040 {
+			compatible = "ti,omap4-padconf", "pinctrl-single";
+			reg = <0x4a31e040 0x0038>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			pinctrl-single,register-width = <16>;
+			pinctrl-single,function-mask = <0x7fff>;
+		};
+
 		gpio1: gpio at 4a310000 {
 			compatible = "ti,omap4-gpio";
 			ti,hwmods = "gpio1";
#4 lore raw

PATCH 2/5 arm/dts: Add pinctrl driver entries for omap2/3/4

Quoted 11 lines · Tony Lindgren

Add pinctrl driver entries for omap2+. These all use the generic pinctrl-single driver for the padconf registers.

Note that as 2420 and 2430 have different padmux registers, we now need to include omap2420.dtsi from omap2420-h4.dts.

Cc Linus Walleij <[email protected]>
Cc devicetree-discuss at lists.ozlabs.org

FWIW:

Yours,
Linus Walleij

author maintainer
#5 lore raw

PATCH 3/5 ARM: OMAP2+: select PINCTRL in Kconfig

In reply to Tony Lindgren

From: AnilKumar Ch <[email protected]>

Select PINCTRL in Kconfig under Typical OMAP configuration, this is required to add pinctrl driver to omap2+ family of devices.

[tony at atomide.com: updated to select pinctrl-single in defconfig]
---
 arch/arm/configs/omap2plus_defconfig |    1 +
 arch/arm/mach-omap2/Kconfig          |    1 +
 2 files changed, 2 insertions(+)
arch/arm/configs/omap2plus_defconfig +1 -0
index e58edc3..6230304 100644
@@ -123,6 +123,7 @@ CONFIG_HW_RANDOM=y
 CONFIG_I2C_CHARDEV=y
 CONFIG_SPI=y
 CONFIG_SPI_OMAP24XX=y
+CONFIG_PINCTRL_SINGLE=y
 CONFIG_DEBUG_GPIO=y
 CONFIG_GPIO_SYSFS=y
 CONFIG_GPIO_TWL4030=y
arch/arm/mach-omap2/Kconfig +1 -0
index 4a4d058..e45bbff 100644
@@ -18,6 +18,7 @@ config ARCH_OMAP2PLUS_TYPICAL
 	select TWL4030_CORE if ARCH_OMAP3 || ARCH_OMAP4
 	select TWL4030_POWER if ARCH_OMAP3 || ARCH_OMAP4
 	select HIGHMEM
+	select PINCTRL
 	help
 	  Compile a kernel suitable for booting most boards
 
author maintainer
#6 lore raw

PATCH 4/5 arm/dts: Mux uart pins for omap4-sdp

In reply to Tony Lindgren

Mux uart pins for the serial ports.

---
 arch/arm/boot/dts/omap4-sdp.dts |   42 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
arch/arm/boot/dts/omap4-sdp.dts +42 -0
index dbcdc4a..00edbe6 100644
@@ -115,6 +115,33 @@
 	};
 };
 
+&omap4_pmx_core {
+	uart2_pins: pinmux_uart2_pins {
+		pinctrl-single,pins = <
+			0xd8 0x118	/* uart2_cts.uart2_cts INPUT_PULLUP | MODE0 */
+			0xda 0		/* uart2_rts.uart2_rts OUTPUT | MODE0 */
+			0xdc 0x118	/* uart2_rx.uart2_rx INPUT_PULLUP | MODE0 */
+			0xde 0		/* uart2_tx.uart2_tx OUTPUT | MODE0 */
+		>;
+	};
+
+	uart3_pins: pinmux_uart3_pins {
+		pinctrl-single,pins = <
+			0x100 0x118	/* uart3_cts_rctx.uart3_cts_rctx INPUT_PULLUP | MODE0 */
+			0x102 0		/* uart3_rts_sd.uart3_rts_sd OUTPUT | MODE0 */
+			0x104 0x100	/* uart3_rx_irrx.uart3_rx_irrx INPUT | MODE0 */
+			0x106 0		/* uart3_tx_irtx.uart3_tx_irtx OUTPUT | MODE0 */
+		>;
+	};
+
+	uart4_pins: pinmux_uart4_pins {
+		pinctrl-single,pins = <
+			0x11c 0x100	/* uart4_rx.uart4_rx INPUT | MODE0 */
+			0x11e 0		/* uart4_tx.uart4_tx OUTPUT | MODE0 */
+		>;
+	};
+};
+
 &i2c1 {
 	clock-frequency = <400000>;
 
@@ -226,3 +253,18 @@
 	bus-width = <4>;
 	ti,non-removable;
 };
+
+&uart2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart2_pins>;
+};
+
+&uart3 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart3_pins>;
+};
+
+&uart4 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart4_pins>;
+};
author maintainer
#7 lore raw

PATCH 5/5 omap-serial: Request pins using pinctrl framework

In reply to Tony Lindgren

Request pins using pinctrl framework. Only show a warning on error as some boards set the pins in the bootloader even if CONFIG_PINCTRL is enabled.

Cc linux-serial at vger.kernel.org
Cc Greg Kroah-Hartman <[email protected]>
---
 arch/arm/plat-omap/include/plat/omap-serial.h |    1 +
 drivers/tty/serial/omap-serial.c              |   10 ++++++++++
 2 files changed, 11 insertions(+)
arch/arm/plat-omap/include/plat/omap-serial.h +1 -0
index 1a52725..0f4de14 100644
@@ -106,6 +106,7 @@ struct uart_omap_port {
 	struct uart_port	port;
 	struct uart_omap_dma	uart_dma;
 	struct platform_device	*pdev;
+	struct pinctrl		*pins;
 
 	unsigned char		ier;
 	unsigned char		lcr;
drivers/tty/serial/omap-serial.c +10 -0
index d3cda0c..068e88c 100644
@@ -39,6 +39,7 @@
 #include <linux/irq.h>
 #include <linux/pm_runtime.h>
 #include <linux/of.h>
+#include <linux/pinctrl/consumer.h>
 
 #include <plat/dma.h>
 #include <plat/dmtimer.h>
@@ -1492,6 +1493,13 @@ static int serial_omap_probe(struct platform_device *pdev)
 		goto err_port_line;
 	}
 
+	up->pins = pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(up->pins)) {
+		dev_warn(&pdev->dev, "did not get pins for uart%i error: %li\n",
+			 up->port.line, PTR_ERR(up->pins));
+		up->pins = NULL;
+	}
+
 	sprintf(up->name, "OMAP UART%d", up->port.line);
 	up->port.mapbase = mem->start;
 	up->port.membase = devm_ioremap(&pdev->dev, mem->start,
@@ -1570,6 +1578,8 @@ static int serial_omap_remove(struct platform_device *dev)
 		pm_runtime_disable(&up->pdev->dev);
 		uart_remove_one_port(&serial_omap_reg, &up->port);
 		pm_qos_remove_request(&up->pm_qos_request);
+		if (up->pins)
+			pinctrl_put(up->pins);
 	}
 
 	platform_set_drvdata(dev, NULL);
author maintainer
#8 lore raw

PATCH 5/5 omap-serial: Request pins using pinctrl framework

Quoted 8 lines · Tony Lindgren

Request pins using pinctrl framework. Only show a warning on error as some boards set the pins in the bootloader even if CONFIG_PINCTRL is enabled.

Cc linux-serial at vger.kernel.org
Cc Greg Kroah-Hartman <[email protected]>

---

Greg, this patch should be OK for you to pick, it should not break anything even if pinctrl is not available yet. Let me know if it needs rebasing on top of other things you've queued for omap-serial.

Regards,

Tony

Quoted 56 lines
 arch/arm/plat-omap/include/plat/omap-serial.h |    1 +
 drivers/tty/serial/omap-serial.c              |   10 ++++++++++
 2 files changed, 11 insertions(+)
arch/arm/plat-omap/include/plat/omap-serial.h +1 -0
index 1a52725..0f4de14 100644
@@ -106,6 +106,7 @@ struct uart_omap_port {
 	struct uart_port	port;
 	struct uart_omap_dma	uart_dma;
 	struct platform_device	*pdev;
+	struct pinctrl		*pins;
 
 	unsigned char		ier;
 	unsigned char		lcr;
drivers/tty/serial/omap-serial.c +10 -1
index d3cda0c..068e88c 100644
@@ -39,6 +39,7 @@
 #include <linux/irq.h>
 #include <linux/pm_runtime.h>
 #include <linux/of.h>
+#include <linux/pinctrl/consumer.h>
 
 #include <plat/dma.h>
 #include <plat/dmtimer.h>
@@ -1492,6 +1493,13 @@ static int serial_omap_probe(struct platform_device *pdev)
 		goto err_port_line;
 	}
 
+	up->pins = pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(up->pins)) {
+		dev_warn(&pdev->dev, "did not get pins for uart%i error: %li\n",
+			 up->port.line, PTR_ERR(up->pins));
+		up->pins = NULL;
+	}
+
 	sprintf(up->name, "OMAP UART%d", up->port.line);
 	up->port.mapbase = mem->start;
 	up->port.membase = devm_ioremap(&pdev->dev, mem->start,
@@ -1570,6 +1578,8 @@ static int serial_omap_remove(struct platform_device *dev)
 		pm_runtime_disable(&up->pdev->dev);
 		uart_remove_one_port(&serial_omap_reg, &up->port);
 		pm_qos_remove_request(&up->pm_qos_request);
+		if (up->pins)
+			pinctrl_put(up->pins);
 	}
 
 	platform_set_drvdata(dev, NULL);
 
--

To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw

PATCH 5/5 omap-serial: Request pins using pinctrl framework

In reply to Tony Lindgren

Hi,

Quoted 17 lines · Tony Lindgren

Request pins using pinctrl framework. Only show a warning on error as some boards set the pins in the bootloader even if CONFIG_PINCTRL is enabled.

Cc linux-serial at vger.kernel.org
Cc Greg Kroah-Hartman <[email protected]>
---
 arch/arm/plat-omap/include/plat/omap-serial.h |    1 +
 drivers/tty/serial/omap-serial.c              |   10 ++++++++++
 2 files changed, 11 insertions(+)
arch/arm/plat-omap/include/plat/omap-serial.h +0 -0
index 1a52725..0f4de14 100644

arch/arm/plat-omap/include/plat/omap-serial.h struct uart_omap_port { · line 109

Quoted 4 lines
arch/arm/plat-omap/include/plat/omap-serial.h +1 -0
@@ -106,6 +106,7 @@ struct uart_omap_port {
 	struct uart_port	port;
 	struct uart_omap_dma	uart_dma;
 	struct platform_device	*pdev;
+	struct pinctrl		*pins;

this won't apply to Greg's tty-next as I moved this structure to the C file :-s

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120906/ee1a5573/attachment.sig>
author maintainer
#10 lore raw

PATCH 5/5 omap-serial: Request pins using pinctrl framework

Quoted 15 lines · Felipe Balbi

Hi,

Quoted 12 lines · Tony Lindgren

Request pins using pinctrl framework. Only show a warning on error as some boards set the pins in the bootloader even if CONFIG_PINCTRL is enabled.

Cc linux-serial at vger.kernel.org
Cc Greg Kroah-Hartman <[email protected]>
---
 arch/arm/plat-omap/include/plat/omap-serial.h |    1 +
 drivers/tty/serial/omap-serial.c              |   10 ++++++++++
 2 files changed, 11 insertions(+)
Quoted 12 lines

arch/arm/plat-omap/include/plat/omap-serial.h struct uart_omap_port { · line 109

Quoted 9 lines
arch/arm/plat-omap/include/plat/omap-serial.h +1 -0
index 1a52725..0f4de14 100644
@@ -106,6 +106,7 @@ struct uart_omap_port {
 	struct uart_port	port;
 	struct uart_omap_dma	uart_dma;
 	struct platform_device	*pdev;
+	struct pinctrl		*pins;

this won't apply to Greg's tty-next as I moved this structure to the C file :-s

Hmm the tty-next fails to build right now for omaps:

drivers/tty/serial/omap-serial.c: In function ?serial_omap_set_mctrl?:
drivers/tty/serial/omap-serial.c:514: error: ?struct uart_omap_port? has no member named ?DTR_gpio?

Maybe check how you want to fix that first? I can then update my patch for tty-next.

Regards,

Tony

#11 lore raw

PATCH 5/5 omap-serial: Request pins using pinctrl framework

Hi,

Quoted 29 lines · Tony Lindgren
Quoted 15 lines · Felipe Balbi

Hi,

Quoted 12 lines · Tony Lindgren

Request pins using pinctrl framework. Only show a warning on error as some boards set the pins in the bootloader even if CONFIG_PINCTRL is enabled.

Cc linux-serial at vger.kernel.org
Cc Greg Kroah-Hartman <[email protected]>
---
 arch/arm/plat-omap/include/plat/omap-serial.h |    1 +
 drivers/tty/serial/omap-serial.c              |   10 ++++++++++
 2 files changed, 11 insertions(+)
Quoted 12 lines

arch/arm/plat-omap/include/plat/omap-serial.h struct uart_omap_port { · line 109

Quoted 9 lines
arch/arm/plat-omap/include/plat/omap-serial.h +1 -0
index 1a52725..0f4de14 100644
@@ -106,6 +106,7 @@ struct uart_omap_port {
 	struct uart_port	port;
 	struct uart_omap_dma	uart_dma;
 	struct platform_device	*pdev;
+	struct pinctrl		*pins;

this won't apply to Greg's tty-next as I moved this structure to the C file :-s

Quoted 7 lines

Hmm the tty-next fails to build right now for omaps:

drivers/tty/serial/omap-serial.c: In function ?serial_omap_set_mctrl?:
drivers/tty/serial/omap-serial.c:514: error: ?struct uart_omap_port? has no member named ?DTR_gpio?

Maybe check how you want to fix that first? I can then update my patch for tty-next.

oops, my bad. Patch sent.

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120907/10cbd027/attachment.sig>
#12 lore raw

PATCH 5/5 omap-serial: Request pins using pinctrl framework

In reply to Tony Lindgren

Hi Tony,

Quoted 51 lines · Tony Lindgren

Request pins using pinctrl framework. Only show a warning on error as some boards set the pins in the bootloader even if CONFIG_PINCTRL is enabled.

Cc linux-serial at vger.kernel.org
Cc Greg Kroah-Hartman <[email protected]>
---
 arch/arm/plat-omap/include/plat/omap-serial.h |    1 +
 drivers/tty/serial/omap-serial.c              |   10 ++++++++++
 2 files changed, 11 insertions(+)
arch/arm/plat-omap/include/plat/omap-serial.h +1 -0
index 1a52725..0f4de14 100644
@@ -106,6 +106,7 @@ struct uart_omap_port {
 	struct uart_port	port;
 	struct uart_omap_dma	uart_dma;
 	struct platform_device	*pdev;
+	struct pinctrl		*pins;
 
 	unsigned char		ier;
 	unsigned char		lcr;
drivers/tty/serial/omap-serial.c +8 -0
index d3cda0c..068e88c 100644
@@ -39,6 +39,7 @@
 #include <linux/irq.h>
 #include <linux/pm_runtime.h>
 #include <linux/of.h>
+#include <linux/pinctrl/consumer.h>
 
 #include <plat/dma.h>
 #include <plat/dmtimer.h>
@@ -1492,6 +1493,13 @@ static int serial_omap_probe(struct platform_device *pdev)
 		goto err_port_line;
 	}
 
+	up->pins = pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(up->pins)) {
+		dev_warn(&pdev->dev, "did not get pins for uart%i error: %li\n",
+			 up->port.line, PTR_ERR(up->pins));
+		up->pins = NULL;
+	}
+
 	sprintf(up->name, "OMAP UART%d", up->port.line);
 	up->port.mapbase = mem->start;
 	up->port.membase = devm_ioremap(&pdev->dev, mem->start,

drivers/tty/serial/omap-serial.c static int serial_omap_remove(struct platform_device *dev) · line 1582

Quoted 5 lines
drivers/tty/serial/omap-serial.c +2 -0
@@ -1570,6 +1578,8 @@ static int serial_omap_remove(struct platform_device *dev)
 		pm_runtime_disable(&up->pdev->dev);
 		uart_remove_one_port(&serial_omap_reg, &up->port);
 		pm_qos_remove_request(&up->pm_qos_request);
+		if (up->pins)
+			pinctrl_put(up->pins);

I think this can be removed if we use devm_pinctrl_get_select_default() above.

Thanks
AnilKumar

author maintainer
#13 lore raw

PATCH 5/5 omap-serial: Request pins using pinctrl framework

Quoted 54 lines · AnilKumar, Chimata

Hi Tony,

Quoted 51 lines · Tony Lindgren

Request pins using pinctrl framework. Only show a warning on error as some boards set the pins in the bootloader even if CONFIG_PINCTRL is enabled.

Cc linux-serial at vger.kernel.org
Cc Greg Kroah-Hartman <[email protected]>
---
 arch/arm/plat-omap/include/plat/omap-serial.h |    1 +
 drivers/tty/serial/omap-serial.c              |   10 ++++++++++
 2 files changed, 11 insertions(+)
arch/arm/plat-omap/include/plat/omap-serial.h +1 -0
index 1a52725..0f4de14 100644
@@ -106,6 +106,7 @@ struct uart_omap_port {
 	struct uart_port	port;
 	struct uart_omap_dma	uart_dma;
 	struct platform_device	*pdev;
+	struct pinctrl		*pins;
 
 	unsigned char		ier;
 	unsigned char		lcr;
drivers/tty/serial/omap-serial.c +8 -0
index d3cda0c..068e88c 100644
@@ -39,6 +39,7 @@
 #include <linux/irq.h>
 #include <linux/pm_runtime.h>
 #include <linux/of.h>
+#include <linux/pinctrl/consumer.h>
 
 #include <plat/dma.h>
 #include <plat/dmtimer.h>
@@ -1492,6 +1493,13 @@ static int serial_omap_probe(struct platform_device *pdev)
 		goto err_port_line;
 	}
 
+	up->pins = pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(up->pins)) {
+		dev_warn(&pdev->dev, "did not get pins for uart%i error: %li\n",
+			 up->port.line, PTR_ERR(up->pins));
+		up->pins = NULL;
+	}
+
 	sprintf(up->name, "OMAP UART%d", up->port.line);
 	up->port.mapbase = mem->start;
 	up->port.membase = devm_ioremap(&pdev->dev, mem->start,
@@ -1570,6 +1578,8 @@ static int serial_omap_remove(struct platform_device *dev)
Quoted 8 lines

drivers/tty/serial/omap-serial.c static int serial_omap_remove(struct platform_device *dev) · line 1582

Quoted 5 lines
drivers/tty/serial/omap-serial.c +2 -0
 		pm_runtime_disable(&up->pdev->dev);
 		uart_remove_one_port(&serial_omap_reg, &up->port);
 		pm_qos_remove_request(&up->pm_qos_request);
+		if (up->pins)
+			pinctrl_put(up->pins);

I think this can be removed if we use devm_pinctrl_get_select_default() above.

Yeah will do, I was initially thinking that would cause issues remuxing pins back to safe mode on unload, but we can still do that in serial_omap_remove().

Regards,

Tony

author maintainer
#14 lore raw

PATCH 5/5 omap-serial: Request pins using pinctrl framework

Quoted 11 lines · Tony Lindgren
Quoted 9 lines · AnilKumar, Chimata

drivers/tty/serial/omap-serial.c static int serial_omap_remove(struct platform_device *dev) · line 1582

Quoted 6 lines
drivers/tty/serial/omap-serial.c +2 -0
@@ -1570,6 +1578,8 @@ static int serial_omap_remove(struct platform_device *dev)
 		pm_runtime_disable(&up->pdev->dev);
 		uart_remove_one_port(&serial_omap_reg, &up->port);
 		pm_qos_remove_request(&up->pm_qos_request);
+		if (up->pins)
+			pinctrl_put(up->pins);

I think this can be removed if we use devm_pinctrl_get_select_default() above.

Quoted 3 lines

Yeah will do, I was initially thinking that would cause issues remuxing pins back to safe mode on unload, but we can still do that in serial_omap_remove().

Sent now as a separate patch with subject "[PATCH] serial: omap: Request pins using pinctrl framework".

Regards,

Tony