mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] serial: ns16550: Fix reading clock-frequency property
@ 2015-06-22  8:48 Sascha Hauer
  2015-06-22  9:33 ` Antony Pavlov
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2015-06-22  8:48 UTC (permalink / raw)
  To: Barebox List

The clock-frequency property is never read because the driver
bails out earlier when it is unable to clk_get the clk. Move
the clock-frequency read out to the dt setup code which is
executed before the driver bails out due to the missing clk.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/serial/serial_ns16550.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index 4d636c1..c186ad4 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -291,6 +291,7 @@ static void ns16550_probe_dt(struct device_d *dev, struct ns16550_priv *priv)
 	if (!IS_ENABLED(CONFIG_OFDEVICE))
 		return;
 
+	of_property_read_u32(np, "clock-frequency", &priv->plat.clock);
 	of_property_read_u32(np, "reg-shift", &priv->plat.shift);
 }
 
@@ -417,7 +418,7 @@ static int ns16550_probe(struct device_d *dev)
 	else
 		ns16550_probe_dt(dev, priv);
 
-	if (!plat || !plat->clock) {
+	if (!priv->plat.clock) {
 		priv->clk = clk_get(dev, NULL);
 		if (IS_ERR(priv->clk)) {
 			ret = PTR_ERR(priv->clk);
@@ -427,12 +428,6 @@ 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;
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-22  9:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-22  8:48 [PATCH] serial: ns16550: Fix reading clock-frequency property Sascha Hauer
2015-06-22  9:33 ` Antony Pavlov
2015-06-22  9:53   ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox