Commit e2860e1f authored by Joel Stanley's avatar Joel Stanley Committed by Greg Kroah-Hartman

serial: 8250_of: Add reset support

This adds the hooks for an optional reset controller in the 8250 device
tree node.
Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
Reviewed-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 71e07791
...@@ -47,6 +47,7 @@ Optional properties: ...@@ -47,6 +47,7 @@ Optional properties:
property. property.
- tx-threshold: Specify the TX FIFO low water indication for parts with - tx-threshold: Specify the TX FIFO low water indication for parts with
programmable TX FIFO thresholds. programmable TX FIFO thresholds.
- resets : phandle + reset specifier pairs
Note: Note:
* fsl,ns16550: * fsl,ns16550:
......
...@@ -19,11 +19,13 @@ ...@@ -19,11 +19,13 @@
#include <linux/of_irq.h> #include <linux/of_irq.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/reset.h>
#include "8250.h" #include "8250.h"
struct of_serial_info { struct of_serial_info {
struct clk *clk; struct clk *clk;
struct reset_control *rst;
int type; int type;
int line; int line;
}; };
...@@ -132,6 +134,13 @@ static int of_platform_serial_setup(struct platform_device *ofdev, ...@@ -132,6 +134,13 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
} }
} }
info->rst = devm_reset_control_get_optional_shared(&ofdev->dev, NULL);
if (IS_ERR(info->rst))
goto out;
ret = reset_control_deassert(info->rst);
if (ret)
goto out;
port->type = type; port->type = type;
port->uartclk = clk; port->uartclk = clk;
port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP
...@@ -229,6 +238,7 @@ static int of_platform_serial_remove(struct platform_device *ofdev) ...@@ -229,6 +238,7 @@ static int of_platform_serial_remove(struct platform_device *ofdev)
serial8250_unregister_port(info->line); serial8250_unregister_port(info->line);
reset_control_assert(info->rst);
if (info->clk) if (info->clk)
clk_disable_unprepare(info->clk); clk_disable_unprepare(info->clk);
kfree(info); kfree(info);
......
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