diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2019-03-18 13:29:15 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-03-27 18:30:50 +0300 |
commit | 24bc6e68efa00f95034dbef0ba91661dd80bd37d (patch) | |
tree | 500ebe1623b364379d0b80249f7fe331ecde8a19 /drivers/tty/serial/sc16is7xx.c | |
parent | 8650e026c819f4b6dfc1bee078498a92a0f5a223 (diff) | |
download | linux-24bc6e68efa00f95034dbef0ba91661dd80bd37d.tar.xz |
serial: sc16is7xx: Respect clock-frequency property
If the property is provided and there are no other possibilities to detect
UART clock frequency, use it as a fallback.
Tested-By: Georgii Staroselskii <georgii.staroselskii@emlid.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/sc16is7xx.c')
-rw-r--r-- | drivers/tty/serial/sc16is7xx.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 635178cf3eed..7240c8608256 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -17,6 +17,7 @@ #include <linux/module.h> #include <linux/of.h> #include <linux/of_device.h> +#include <linux/property.h> #include <linux/regmap.h> #include <linux/serial_core.h> #include <linux/serial.h> @@ -1179,7 +1180,8 @@ static int sc16is7xx_probe(struct device *dev, struct regmap *regmap, int irq, unsigned long flags) { struct sched_param sched_param = { .sched_priority = MAX_RT_PRIO / 2 }; - unsigned long freq, *pfreq = dev_get_platdata(dev); + unsigned long freq = 0, *pfreq = dev_get_platdata(dev); + u32 uartclk = 0; int i, ret; struct sc16is7xx_port *s; @@ -1193,10 +1195,17 @@ static int sc16is7xx_probe(struct device *dev, return -ENOMEM; } + /* Always ask for fixed clock rate from a property. */ + device_property_read_u32(dev, "clock-frequency", &uartclk); + s->clk = devm_clk_get(dev, NULL); if (IS_ERR(s->clk)) { + if (uartclk) + freq = uartclk; if (pfreq) freq = *pfreq; + if (freq) + dev_dbg(dev, "Clock frequency: %luHz\n", freq); else return PTR_ERR(s->clk); } else { |