summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2016-09-13 18:51:55 +0100
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2024-03-26 12:09:16 +0000
commit17311f6665b8abae1d5fb8dbe862f3447b62706f (patch)
tree8a69ad3cbf5db6f47f486741a4fdf532a70b989d
parent6bfe07c2ed43a3d6f802124f6e2aa0ef19c0387c (diff)
add sa11x0 uart clocks
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r--arch/arm/mach-sa1100/clock.c3
-rw-r--r--drivers/tty/serial/sa1100.c16
2 files changed, 18 insertions, 1 deletions
diff --git a/arch/arm/mach-sa1100/clock.c b/arch/arm/mach-sa1100/clock.c
index a104cfa4b123..d40ce6b0ae05 100644
--- a/arch/arm/mach-sa1100/clock.c
+++ b/arch/arm/mach-sa1100/clock.c
@@ -107,6 +107,9 @@ int __init sa11xx_clk_init(void)
return PTR_ERR(hw);
clk_hw_register_clkdev(hw, "OSTIMER0", NULL);
+ clk_hw_register_clkdev(hw, NULL, "sa11x0-uart.1");
+ clk_hw_register_clkdev(hw, NULL, "sa11x0-uart.2");
+ clk_hw_register_clkdev(hw, NULL, "sa11x0-uart.3");
hw = kzalloc(sizeof(*hw), GFP_KERNEL);
if (!hw)
diff --git a/drivers/tty/serial/sa1100.c b/drivers/tty/serial/sa1100.c
index 6a88cd1e3607..77671d589f57 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;
@@ -340,13 +342,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
@@ -383,6 +391,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
@@ -938,6 +948,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);