diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2021-07-23 15:59:43 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-07-27 12:09:18 +0200 |
commit | 3d1fa055ea7298345795b982de7a5b9ec6ae238d (patch) | |
tree | 68757a295531e84bf69e903511955ab1f1a7e047 /drivers/tty | |
parent | 0a9410b981e961a24057dceee54bb5d36309a0c4 (diff) | |
download | linux-3d1fa055ea7298345795b982de7a5b9ec6ae238d.tar.gz linux-3d1fa055ea7298345795b982de7a5b9ec6ae238d.tar.bz2 linux-3d1fa055ea7298345795b982de7a5b9ec6ae238d.zip |
serial: max310x: Use clock-names property matching to recognize EXTCLK
Dennis reported that on ACPI-based systems the clock frequency
isn't enough to configure device properly. We have to respect
the clock source as well. To achieve this match the clock-names
property against "osc" to recognize external clock connection.
On DT-based system this doesn't change anything.
Reported-and-tested-by: Dennis Giaya <dgiaya@whoi.edu>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210723125943.22039-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/serial/max310x.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c index 0c1e4df52215..c2929fefce80 100644 --- a/drivers/tty/serial/max310x.c +++ b/drivers/tty/serial/max310x.c @@ -1271,18 +1271,13 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty /* Always ask for fixed clock rate from a property. */ device_property_read_u32(dev, "clock-frequency", &uartclk); - s->clk = devm_clk_get_optional(dev, "osc"); + xtal = device_property_match_string(dev, "clock-names", "osc") < 0; + if (xtal) + s->clk = devm_clk_get_optional(dev, "xtal"); + else + s->clk = devm_clk_get_optional(dev, "osc"); if (IS_ERR(s->clk)) return PTR_ERR(s->clk); - if (s->clk) { - xtal = false; - } else { - s->clk = devm_clk_get_optional(dev, "xtal"); - if (IS_ERR(s->clk)) - return PTR_ERR(s->clk); - - xtal = true; - } ret = clk_prepare_enable(s->clk); if (ret) |