Skip to content

Commit 4e64cd7

Browse files
pgwipeoutgregkh
authored andcommitted
usb: dwc3: fix backwards compat with rockchip devices
Commit 33fb697 ("usb: dwc3: Get clocks individually") moved from the clk_bulk api to individual clocks, following the snps,dwc3.yaml dt-binding for clock names. Unfortunately the rk3328 (and upcoming rk356x support) use the rockchip,dwc3.yaml which has different clock names, which are common on devices using the glue layer. The rk3328 does not use a glue layer, but attaches directly to the dwc3 core driver. The offending patch series failed to account for this, thus dwc3 was broken on rk3328. To retain backwards compatibility with rk3328 device trees we must also check for the alternate clock names. Fixes: 33fb697 ("usb: dwc3: Get clocks individually") Reported-by: Frank Wunderlich <[email protected]> Tested-By: Frank Wunderlich <[email protected]> Reviewed-by: Heiko Stuebner <[email protected]> Acked-by: Sean Anderson <[email protected]> Signed-off-by: Peter Geis <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 0cade78 commit 4e64cd7

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/usb/dwc3/core.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,21 +1690,44 @@ static int dwc3_probe(struct platform_device *pdev)
16901690
/*
16911691
* Clocks are optional, but new DT platforms should support all
16921692
* clocks as required by the DT-binding.
1693+
* Some devices have different clock names in legacy device trees,
1694+
* check for them to retain backwards compatibility.
16931695
*/
16941696
dwc->bus_clk = devm_clk_get_optional(dev, "bus_early");
16951697
if (IS_ERR(dwc->bus_clk))
16961698
return dev_err_probe(dev, PTR_ERR(dwc->bus_clk),
16971699
"could not get bus clock\n");
16981700

1701+
if (dwc->bus_clk == NULL) {
1702+
dwc->bus_clk = devm_clk_get_optional(dev, "bus_clk");
1703+
if (IS_ERR(dwc->bus_clk))
1704+
return dev_err_probe(dev, PTR_ERR(dwc->bus_clk),
1705+
"could not get bus clock\n");
1706+
}
1707+
16991708
dwc->ref_clk = devm_clk_get_optional(dev, "ref");
17001709
if (IS_ERR(dwc->ref_clk))
17011710
return dev_err_probe(dev, PTR_ERR(dwc->ref_clk),
17021711
"could not get ref clock\n");
17031712

1713+
if (dwc->ref_clk == NULL) {
1714+
dwc->ref_clk = devm_clk_get_optional(dev, "ref_clk");
1715+
if (IS_ERR(dwc->ref_clk))
1716+
return dev_err_probe(dev, PTR_ERR(dwc->ref_clk),
1717+
"could not get ref clock\n");
1718+
}
1719+
17041720
dwc->susp_clk = devm_clk_get_optional(dev, "suspend");
17051721
if (IS_ERR(dwc->susp_clk))
17061722
return dev_err_probe(dev, PTR_ERR(dwc->susp_clk),
17071723
"could not get suspend clock\n");
1724+
1725+
if (dwc->susp_clk == NULL) {
1726+
dwc->susp_clk = devm_clk_get_optional(dev, "suspend_clk");
1727+
if (IS_ERR(dwc->susp_clk))
1728+
return dev_err_probe(dev, PTR_ERR(dwc->susp_clk),
1729+
"could not get suspend clock\n");
1730+
}
17081731
}
17091732

17101733
ret = reset_control_deassert(dwc->reset);

0 commit comments

Comments
 (0)