* [PATCH v2] serial: 8250_of: Add reset support
@ 2017-05-26 1:55 Joel Stanley
[not found] ` <20170526015519.11865-1-joel-U3u1mxZcP9KHXe+LvDLADg@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Joel Stanley @ 2017-05-26 1:55 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rob Herring, Mark Rutland, Philipp Zabel
Cc: linux-serial-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
This adds the hooks for an optional reset controller in the 8250 device
tree node.
Signed-off-by: Joel Stanley <joel-U3u1mxZcP9KHXe+LvDLADg@public.gmane.org>
---
v2:
Address Philipp's comments. Thanks for the review!
- use _shared variant
- remove unnecessary error handling
Documentation/devicetree/bindings/serial/8250.txt | 1 +
drivers/tty/serial/8250/8250_of.c | 10 ++++++++++
2 files changed, 11 insertions(+)
diff --git a/Documentation/devicetree/bindings/serial/8250.txt b/Documentation/devicetree/bindings/serial/8250.txt
index 10276a46ecef..63e32393f82b 100644
--- a/Documentation/devicetree/bindings/serial/8250.txt
+++ b/Documentation/devicetree/bindings/serial/8250.txt
@@ -45,6 +45,7 @@ Optional properties:
property.
- tx-threshold: Specify the TX FIFO low water indication for parts with
programmable TX FIFO thresholds.
+- resets : phandle + reset specifier pairs
Note:
* fsl,ns16550:
diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c
index 1cbadafc6889..e95cc9698c32 100644
--- a/drivers/tty/serial/8250/8250_of.c
+++ b/drivers/tty/serial/8250/8250_of.c
@@ -19,11 +19,13 @@
#include <linux/of_irq.h>
#include <linux/of_platform.h>
#include <linux/clk.h>
+#include <linux/reset.h>
#include "8250.h"
struct of_serial_info {
struct clk *clk;
+ struct reset_control *rst;
int type;
int line;
};
@@ -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->uartclk = clk;
port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP
@@ -231,6 +240,7 @@ static int of_platform_serial_remove(struct platform_device *ofdev)
if (info->clk)
clk_disable_unprepare(info->clk);
+ reset_control_assert(info->rst);
kfree(info);
return 0;
}
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <20170526015519.11865-1-joel-U3u1mxZcP9KHXe+LvDLADg@public.gmane.org>]
* Re: [PATCH v2] serial: 8250_of: Add reset support [not found] ` <20170526015519.11865-1-joel-U3u1mxZcP9KHXe+LvDLADg@public.gmane.org> @ 2017-05-29 9:43 ` Philipp Zabel [not found] ` <1496051002.17695.34.camel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Philipp Zabel @ 2017-05-29 9:43 UTC (permalink / raw) To: Joel Stanley Cc: Greg Kroah-Hartman, Rob Herring, Mark Rutland, linux-serial-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA Hi Joel, On Fri, 2017-05-26 at 11:55 +1000, Joel Stanley wrote: > This adds the hooks for an optional reset controller in the 8250 device > tree node. > > Signed-off-by: Joel Stanley <joel-U3u1mxZcP9KHXe+LvDLADg@public.gmane.org> > > --- > v2: > Address Philipp's comments. Thanks for the review! > - use _shared variant > - remove unnecessary error handling > > Documentation/devicetree/bindings/serial/8250.txt | 1 + > drivers/tty/serial/8250/8250_of.c | 10 ++++++++++ > 2 files changed, 11 insertions(+) > > diff --git a/Documentation/devicetree/bindings/serial/8250.txt b/Documentation/devicetree/bindings/serial/8250.txt > index 10276a46ecef..63e32393f82b 100644 > --- a/Documentation/devicetree/bindings/serial/8250.txt > +++ b/Documentation/devicetree/bindings/serial/8250.txt > @@ -45,6 +45,7 @@ Optional properties: > property. > - tx-threshold: Specify the TX FIFO low water indication for parts with > programmable TX FIFO thresholds. > +- resets : phandle + reset specifier pairs > > Note: > * fsl,ns16550: > diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c > index 1cbadafc6889..e95cc9698c32 100644 > --- a/drivers/tty/serial/8250/8250_of.c > +++ b/drivers/tty/serial/8250/8250_of.c > @@ -19,11 +19,13 @@ > #include <linux/of_irq.h> > #include <linux/of_platform.h> > #include <linux/clk.h> > +#include <linux/reset.h> > > #include "8250.h" > > struct of_serial_info { > struct clk *clk; > + struct reset_control *rst; > int type; > int line; > }; > @@ -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->uartclk = clk; > port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP > @@ -231,6 +240,7 @@ static int of_platform_serial_remove(struct platform_device *ofdev) > > if (info->clk) > clk_disable_unprepare(info->clk); > + reset_control_assert(info->rst); The clock is enabled before the reset is deasserted in of_platform_serial_setup, I'd disable it after asserting the reset in of_platform_serial_remove. Other than that, Reviewed-by: Philipp Zabel <p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> regards Philipp -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <1496051002.17695.34.camel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>]
* Re: [PATCH v2] serial: 8250_of: Add reset support [not found] ` <1496051002.17695.34.camel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> @ 2017-05-29 9:57 ` Joel Stanley 0 siblings, 0 replies; 3+ messages in thread From: Joel Stanley @ 2017-05-29 9:57 UTC (permalink / raw) To: Philipp Zabel Cc: Greg Kroah-Hartman, Rob Herring, Mark Rutland, linux-serial-u79uwXL29TY76Z2rM5mHXA, devicetree, Linux Kernel Mailing List On Mon, May 29, 2017 at 7:13 PM, Philipp Zabel <p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> wrote: > Hi Joel, > > On Fri, 2017-05-26 at 11:55 +1000, Joel Stanley wrote: >> This adds the hooks for an optional reset controller in the 8250 device >> tree node. >> >> Signed-off-by: Joel Stanley <joel-U3u1mxZcP9KHXe+LvDLADg@public.gmane.org> >> >> --- >> v2: >> Address Philipp's comments. Thanks for the review! >> - use _shared variant >> - remove unnecessary error handling >> >> Documentation/devicetree/bindings/serial/8250.txt | 1 + >> drivers/tty/serial/8250/8250_of.c | 10 ++++++++++ >> 2 files changed, 11 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/serial/8250.txt b/Documentation/devicetree/bindings/serial/8250.txt >> index 10276a46ecef..63e32393f82b 100644 >> --- a/Documentation/devicetree/bindings/serial/8250.txt >> +++ b/Documentation/devicetree/bindings/serial/8250.txt >> @@ -45,6 +45,7 @@ Optional properties: >> property. >> - tx-threshold: Specify the TX FIFO low water indication for parts with >> programmable TX FIFO thresholds. >> +- resets : phandle + reset specifier pairs >> >> Note: >> * fsl,ns16550: >> diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c >> index 1cbadafc6889..e95cc9698c32 100644 >> --- a/drivers/tty/serial/8250/8250_of.c >> +++ b/drivers/tty/serial/8250/8250_of.c >> @@ -19,11 +19,13 @@ >> #include <linux/of_irq.h> >> #include <linux/of_platform.h> >> #include <linux/clk.h> >> +#include <linux/reset.h> >> >> #include "8250.h" >> >> struct of_serial_info { >> struct clk *clk; >> + struct reset_control *rst; >> int type; >> int line; >> }; >> @@ -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->uartclk = clk; >> port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP >> @@ -231,6 +240,7 @@ static int of_platform_serial_remove(struct platform_device *ofdev) >> >> if (info->clk) >> clk_disable_unprepare(info->clk); >> + reset_control_assert(info->rst); > > The clock is enabled before the reset is deasserted in > of_platform_serial_setup, I'd disable it after asserting the reset in > of_platform_serial_remove. Other than that, > > Reviewed-by: Philipp Zabel <p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> Doh, I'll send a v3 with your reviewed-by attached. Thanks! Joel -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-29 9:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-26 1:55 [PATCH v2] serial: 8250_of: Add reset support Joel Stanley
[not found] ` <20170526015519.11865-1-joel-U3u1mxZcP9KHXe+LvDLADg@public.gmane.org>
2017-05-29 9:43 ` Philipp Zabel
[not found] ` <1496051002.17695.34.camel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2017-05-29 9:57 ` Joel Stanley
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox