All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-omap@vger.kernel.org, linux-serial@vger.kernel.org
Subject: [PATCH 5/5] omap-serial: Request pins using pinctrl framework
Date: Thu, 06 Sep 2012 11:58:32 -0700	[thread overview]
Message-ID: <20120906185832.1172.31013.stgit@muffinssi.local> (raw)
In-Reply-To: <20120906185615.1172.23588.stgit@muffinssi.local>

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@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/plat-omap/include/plat/omap-serial.h |    1 +
 drivers/tty/serial/omap-serial.c              |   10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h
index 1a52725..0f4de14 100644
--- a/arch/arm/plat-omap/include/plat/omap-serial.h
+++ b/arch/arm/plat-omap/include/plat/omap-serial.h
@@ -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;
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index d3cda0c..068e88c 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -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);


WARNING: multiple messages have this Message-ID (diff)
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/5] omap-serial: Request pins using pinctrl framework
Date: Thu, 06 Sep 2012 11:58:32 -0700	[thread overview]
Message-ID: <20120906185832.1172.31013.stgit@muffinssi.local> (raw)
In-Reply-To: <20120906185615.1172.23588.stgit@muffinssi.local>

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 <gregkh@linuxfoundation.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/plat-omap/include/plat/omap-serial.h |    1 +
 drivers/tty/serial/omap-serial.c              |   10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h
index 1a52725..0f4de14 100644
--- a/arch/arm/plat-omap/include/plat/omap-serial.h
+++ b/arch/arm/plat-omap/include/plat/omap-serial.h
@@ -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;
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index d3cda0c..068e88c 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -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);

  parent reply	other threads:[~2012-09-06 18:58 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-06 18:58 [PATCH 0/5] Enable pinctrl-single for omap2/3/4 Tony Lindgren
2012-09-06 18:58 ` Tony Lindgren
2012-09-06 18:58 ` [PATCH 1/5] arm/dts: Add omap36xx.dtsi file and rename omap3-beagle to omap3-beagle-xm Tony Lindgren
2012-09-06 18:58   ` Tony Lindgren
2012-09-07 15:49   ` Benoit Cousson
2012-09-07 15:49     ` Benoit Cousson
2012-09-06 18:58 ` [PATCH 2/5] arm/dts: Add pinctrl driver entries for omap2/3/4 Tony Lindgren
2012-09-06 18:58   ` Tony Lindgren
2012-09-07  8:10   ` Linus Walleij
2012-09-07  8:10     ` Linus Walleij
2012-09-06 18:58 ` [PATCH 3/5] ARM: OMAP2+: select PINCTRL in Kconfig Tony Lindgren
2012-09-06 18:58   ` Tony Lindgren
2012-09-06 18:58 ` [PATCH 4/5] arm/dts: Mux uart pins for omap4-sdp Tony Lindgren
2012-09-06 18:58   ` Tony Lindgren
2012-09-06 18:58 ` Tony Lindgren [this message]
2012-09-06 18:58   ` [PATCH 5/5] omap-serial: Request pins using pinctrl framework Tony Lindgren
2012-09-06 19:12   ` Tony Lindgren
2012-09-06 19:12     ` Tony Lindgren
2012-09-06 19:56   ` Felipe Balbi
2012-09-06 19:56     ` Felipe Balbi
2012-09-06 21:17     ` Tony Lindgren
2012-09-06 21:17       ` Tony Lindgren
2012-09-07  5:26       ` Felipe Balbi
2012-09-07  5:26         ` Felipe Balbi
2012-09-07  3:27   ` AnilKumar, Chimata
2012-09-07  3:27     ` AnilKumar, Chimata
2012-09-07 17:28     ` Tony Lindgren
2012-09-07 17:28       ` Tony Lindgren
2012-09-07 18:03       ` Tony Lindgren
2012-09-07 18:03         ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120906185832.1172.31013.stgit@muffinssi.local \
    --to=tony@atomide.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.