serial: max310x: Use clock-names property matching to recognize EXTCLK
PATCH v2 1/1 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.
---
v2: added Tested-by tag (Dennis), inverted comparison to leave original flow
drivers/tty/serial/max310x.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/tty/serial/max310x.c +5 -10
@@ -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)
Signature · 1 line
2.30.2
Quoted 2 lines
v2: added Tested-by tag (Dennis), inverted comparison to leave original flow
I've tested v2 with the inverted comparison and it works under the same test conditions as v1.
Best,Dennis
Quoted 5 lines · Dennis Giaya
Quoted 2 lines
v2: added Tested-by tag (Dennis), inverted comparison to leave original flow
I've tested v2 with the inverted comparison and it works under the same test conditions as v1.
Thanks! It's pending for v5.15-rc1.
Signature · 2 lines
With Best Regards, Andy Shevchenko