summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/sa1100.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2016-09-13 18:51:55 +0100
committerRussell King <rmk+kernel@armlinux.org.uk>2020-10-12 21:56:04 +0100
commit4de3dd472d2dc434c0aed5e57fc8a27c44debe1f (patch)
tree9f08f70c597dbf2fd232d0423a1b1141fb2a9558 /drivers/tty/serial/sa1100.c
parentf3683bc6dd0c13bf0faaedbec4cfee157d985c2b (diff)
add sa11x0 uart clocks
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'drivers/tty/serial/sa1100.c')
-rw-r--r--drivers/tty/serial/sa1100.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/tty/serial/sa1100.c b/drivers/tty/serial/sa1100.c
index d02be025263b..a812fae00feb 100644
--- a/drivers/tty/serial/sa1100.c
+++ b/drivers/tty/serial/sa1100.c
@@ -8,6 +8,7 @@
*/
#include <linux/module.h>
+#include <linux/clk.h>
#include <linux/gpio/consumer.h>
#include <linux/ioport.h>
#include <linux/init.h>
@@ -76,6 +77,7 @@ struct sa1100_port {
struct uart_port port;
struct timer_list timer;
unsigned int old_status;
+ struct clk *clk;
struct mctrl_gpios *gpios;
struct gpio_desc *xcvr_enable;
unsigned wake;
@@ -367,13 +369,19 @@ static int sa1100_startup(struct uart_port *port)
container_of(port, struct sa1100_port, port);
int retval;
+ retval = clk_prepare_enable(sport->clk);
+ if (retval)
+ return retval;
+
/*
* Allocate the IRQ
*/
retval = request_irq(sport->port.irq, sa1100_int, 0,
"sa11x0-uart", sport);
- if (retval)
+ if (retval) {
+ clk_disable_unprepare(sport->clk);
return retval;
+ }
/*
* Finally, clear and enable interrupts
@@ -410,6 +418,8 @@ static void sa1100_shutdown(struct uart_port *port)
* Disable all interrupts, port and break condition.
*/
UART_PUT_UTCR3(sport, 0);
+
+ clk_disable_unprepare(sport->clk);
}
static void
@@ -965,6 +975,10 @@ static int sa1100_serial_add_one_port(struct sa1100_port *sport, struct platform
sport->xcvr_enable = NULL;
}
+ sport->clk = devm_clk_get(sport->port.dev, NULL);
+ if (IS_ERR(sport->clk))
+ return PTR_ERR(sport->clk);
+
device_init_wakeup(sport->port.dev, !!sport->wake);
platform_set_drvdata(dev, sport);