serial: ns16550: small dt support improvements
cover serial: ns16550: small dt support improvements
[RFC 1/2] serial: ns16550: get clock-frequency from dt [RFC 2/2] serial: ns16550: fill cdev just-in-time
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
RFC 1/2 serial: ns16550: get clock-frequency from dt
This patch helps clk-less boards to use device
tree for clock frequency probing (taken fromlinux.git/drivers/tty/serial/of_serial.c).
--- drivers/serial/serial_ns16550.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/serial/serial_ns16550.c +6 -0
@@ -277,6 +277,12 @@ static int ns16550_probe(struct device_d *dev) priv->plat.clock =clk_get_rate (priv->clk); } +if (priv->plat.clock ==0 &&IS_ENABLED (CONFIG_OFDEVICE )) { +struct device_node *np = dev->device_node; + +of_property_read_u32 (np,"clock-frequency" , &priv->plat.clock); + } +if (priv->plat.clock ==0 ) {dev_err (dev,"no valid clockrate\n" ); ret = -EINVAL ;
Signature · 7 lines
1.8.3.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
RFC 2/2 serial: ns16550: fill cdev just-in-time
In reply to Antony Pavlov--- drivers/serial/serial_ns16550.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/serial/serial_ns16550.c +1 -2
@@ -266,8 +266,6 @@ static int ns16550_probe(struct device_d *dev)else ns16550_probe_dt (dev, priv); - cdev = &priv->cdev; -if (!plat || !plat->clock) { priv->clk =clk_get (dev,NULL );if (IS_ERR (priv->clk)) {
@@ -291,6 +289,7 @@ static int ns16550_probe(struct device_d *dev) priv->access_width = dev->resource[0 ].flags &IORESOURCE_MEM_TYPE_MASK ; + cdev = &priv->cdev; cdev->dev = dev; cdev->f_caps =CONSOLE_STDIN |CONSOLE_STDOUT |CONSOLE_STDERR ; cdev->tstc = ns16550_tstc;
Signature · 7 lines
1.8.3.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 2 lines · Antony Pavlov
[RFC 1/2] serial: ns16550: get clock-frequency from dt [RFC 2/2] serial: ns16550: fill cdev just-in-time
Applied, thanks.
I assume the second one is only cosmetic, right?
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 7 lines · On Wed, 24 Jul 2013 18:54:21 +0200 Sascha Hauer <[email protected]> wrote:
Quoted 2 lines · Antony Pavlov
[RFC 1/2] serial: ns16550: get clock-frequency from dt [RFC 2/2] serial: ns16550: fill cdev just-in-time
Applied, thanks.
I assume the second one is only cosmetic, right?
Yes, it's mostly cosmetic: the main goal of the second patch is making code more "easy-to-understand".
As a bonus you get a tiny insignificant optimisation: if there is any error during probe then there is no need in cdev and cdev can
be keeped unitialized (tut IMHO a smart compiler can make itself a reposition like this :).
--
Best regards,
Antony Pavlov
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox