[PATCH 1/4] usb: dwc3: Cache ref_clk pointer in struct dwc3

Marek Vasut marex at denx.de
Sun Oct 30 22:43:05 CET 2022


On 10/30/22 22:25, Sean Anderson wrote:

[...]

>> @@ -59,12 +59,21 @@ static int dwc3_generic_probe(struct udevice *dev,
>>       struct dwc3_generic_plat *plat = dev_get_plat(dev);
>>       struct dwc3 *dwc3 = &priv->dwc3;
>>       struct dwc3_glue_data *glue = dev_get_plat(dev->parent);
>> +    int __maybe_unused index;
>> +    ofnode __maybe_unused node;
>>       dwc3->dev = dev;
>>       dwc3->maximum_speed = plat->maximum_speed;
>>       dwc3->dr_mode = plat->dr_mode;
>>   #if CONFIG_IS_ENABLED(OF_CONTROL)
>>       dwc3_of_parse(dwc3);
>> +
>> +    node = dev_ofnode(dev->parent);
>> +    index = ofnode_stringlist_search(node, "clock-names", "ref");
>> +    if (index < 0)
>> +        index = ofnode_stringlist_search(node, "clock-names", 
>> "ref_clk");
>> +    if (index >= 0)
>> +        dwc3->ref_clk = &glue->clks.clks[index];
> 
> clk_get_by_name_optional?
> 
> If you don't want to do that, document why please.

Because we already requested the clock via clk_get_bulk(), here we only 
look up the pointer to the already requested clock.


More information about the U-Boot mailing list