Re: [PATCH v4 1/3] phy: rockchip: inno-usb2: convert clock management to bulk

From: Frank Wang
Date: Wed Oct 09 2024 - 03:10:41 EST


Hi Krzysztof,

On 2024/10/8 22:35, Krzysztof Kozlowski wrote:
On 08/10/2024 05:07, Frank Wang wrote:
+ }
+
+ if (!IS_ERR(refclk)) {
+ clk_name = __clk_get_name(refclk);
init.parent_names = &clk_name;
init.num_parents = 1;
} else {
@@ -1406,18 +1424,29 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
if (IS_ERR(rphy->phy_reset))
return PTR_ERR(rphy->phy_reset);
- rphy->clk = devm_clk_get_optional_enabled(dev, "phyclk");
- if (IS_ERR(rphy->clk)) {
- return dev_err_probe(&pdev->dev, PTR_ERR(rphy->clk),
+ ret = devm_clk_bulk_get_all(dev, &rphy->clks);
+ if (ret == -EPROBE_DEFER) {
This does not make much sense. Why would you proceed on other critical
errors?

You want to use optional variant, I guess?
Yes, the clock properties are optional.
And? So are you going to use optional variant of clk get or not? Is it
appropriate? Are you going to improve it?

Using devm_clk_bulk_get_all() not only get clk_bulk_data, but also can get num_clks.
The clocks numbers (num_clks) are used for search the ref_clk in rockchip_usb2phy_clk480m_register().

However, right now, the optional variant of clk_*_optional functions can not get num_clks, or must know num_clks, then can get clk_bulk_data.


Best regards,
Frank

Best regards,
Krzysztof