[RFC 1/2] serial: ns16550: get clock-frequency from dt
Antony Pavlov
antonynpavlov at gmail.com
Tue Jul 23 11:28:01 EDT 2013
This patch helps clk-less boards to use device
tree for clock frequency probing (taken from
linux.git/drivers/tty/serial/of_serial.c).
Signed-off-by: Antony Pavlov <antonynpavlov at gmail.com>
---
drivers/serial/serial_ns16550.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index ad3125a..6a3c865 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -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;
--
1.8.3.1
More information about the barebox
mailing list