Commit 2b996fc5 authored by Linus Walleij's avatar Linus Walleij

tty: serial: modify PL011 driver to use pinctrl PM helpers

This augments the PL011 UART driver to utilize the new pinctrl
core PM helpers to transition the driver to default and sleep
states, cutting away some boilerplate code.

Cc: Hebbar Gururaja <gururaja.hebbar@ti.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Kevin Hilman <khilman@linaro.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Acked-by: default avatarWolfram Sang <wsa@the-dreams.de>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 14005ee2
...@@ -151,10 +151,6 @@ struct pl011_dmatx_data { ...@@ -151,10 +151,6 @@ struct pl011_dmatx_data {
struct uart_amba_port { struct uart_amba_port {
struct uart_port port; struct uart_port port;
struct clk *clk; struct clk *clk;
/* Two optional pin states - default & sleep */
struct pinctrl *pinctrl;
struct pinctrl_state *pins_default;
struct pinctrl_state *pins_sleep;
const struct vendor_data *vendor; const struct vendor_data *vendor;
unsigned int dmacr; /* dma control reg */ unsigned int dmacr; /* dma control reg */
unsigned int im; /* interrupt mask */ unsigned int im; /* interrupt mask */
...@@ -1480,12 +1476,7 @@ static int pl011_hwinit(struct uart_port *port) ...@@ -1480,12 +1476,7 @@ static int pl011_hwinit(struct uart_port *port)
int retval; int retval;
/* Optionaly enable pins to be muxed in and configured */ /* Optionaly enable pins to be muxed in and configured */
if (!IS_ERR(uap->pins_default)) { pinctrl_pm_select_default_state(port->dev);
retval = pinctrl_select_state(uap->pinctrl, uap->pins_default);
if (retval)
dev_err(port->dev,
"could not set default pins\n");
}
/* /*
* Try to enable the clock producer. * Try to enable the clock producer.
...@@ -1611,7 +1602,6 @@ static void pl011_shutdown(struct uart_port *port) ...@@ -1611,7 +1602,6 @@ static void pl011_shutdown(struct uart_port *port)
{ {
struct uart_amba_port *uap = (struct uart_amba_port *)port; struct uart_amba_port *uap = (struct uart_amba_port *)port;
unsigned int cr; unsigned int cr;
int retval;
/* /*
* disable all interrupts * disable all interrupts
...@@ -1654,13 +1644,7 @@ static void pl011_shutdown(struct uart_port *port) ...@@ -1654,13 +1644,7 @@ static void pl011_shutdown(struct uart_port *port)
*/ */
clk_disable_unprepare(uap->clk); clk_disable_unprepare(uap->clk);
/* Optionally let pins go into sleep states */ /* Optionally let pins go into sleep states */
if (!IS_ERR(uap->pins_sleep)) { pinctrl_pm_select_sleep_state(port->dev);
retval = pinctrl_select_state(uap->pinctrl, uap->pins_sleep);
if (retval)
dev_err(port->dev,
"could not set pins to sleep state\n");
}
if (uap->port.dev->platform_data) { if (uap->port.dev->platform_data) {
struct amba_pl011_data *plat; struct amba_pl011_data *plat;
...@@ -2013,12 +1997,7 @@ static int __init pl011_console_setup(struct console *co, char *options) ...@@ -2013,12 +1997,7 @@ static int __init pl011_console_setup(struct console *co, char *options)
return -ENODEV; return -ENODEV;
/* Allow pins to be muxed in and configured */ /* Allow pins to be muxed in and configured */
if (!IS_ERR(uap->pins_default)) { pinctrl_pm_select_default_state(uap->port.dev);
ret = pinctrl_select_state(uap->pinctrl, uap->pins_default);
if (ret)
dev_err(uap->port.dev,
"could not set default pins\n");
}
ret = clk_prepare(uap->clk); ret = clk_prepare(uap->clk);
if (ret) if (ret)
...@@ -2132,21 +2111,6 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) ...@@ -2132,21 +2111,6 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
goto out; goto out;
} }
uap->pinctrl = devm_pinctrl_get(&dev->dev);
if (IS_ERR(uap->pinctrl)) {
ret = PTR_ERR(uap->pinctrl);
goto out;
}
uap->pins_default = pinctrl_lookup_state(uap->pinctrl,
PINCTRL_STATE_DEFAULT);
if (IS_ERR(uap->pins_default))
dev_err(&dev->dev, "could not get default pinstate\n");
uap->pins_sleep = pinctrl_lookup_state(uap->pinctrl,
PINCTRL_STATE_SLEEP);
if (IS_ERR(uap->pins_sleep))
dev_dbg(&dev->dev, "could not get sleep pinstate\n");
uap->clk = devm_clk_get(&dev->dev, NULL); uap->clk = devm_clk_get(&dev->dev, NULL);
if (IS_ERR(uap->clk)) { if (IS_ERR(uap->clk)) {
ret = PTR_ERR(uap->clk); ret = PTR_ERR(uap->clk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment