Re: [RFC 2/2] usb: dwc3: Refactor PHY logic to support Multiport Controller

Harsh Agarwal
2022-05-27T10:56:28Z

On 5/23/2022 9:40 PM, Brian Masney wrote:
> On Thu, May 19, 2022 at 06:04:55PM +0530, Harsh Agarwal wrote:
>> - dwc->usb3_generic_phy = devm_phy_get(dev, "usb3-phy");
>> - if (IS_ERR(dwc->usb3_generic_phy)) {
>> - ret = PTR_ERR(dwc->usb3_generic_phy);
>> - if (ret == -ENOSYS || ret == -ENODEV)
>> - dwc->usb3_generic_phy = NULL;
>> - else
>> - return dev_err_probe(dev, ret, "no usb3 phy configured\n");
>> + if (IS_ERR(dwc->usb2_phy[0])) {
>> + ret = PTR_ERR(dwc->usb2_phy[0]);
>> + if (ret == -ENXIO || ret == -ENODEV)
>> + dwc->usb2_phy[0] = NULL;
>> + else
>> + return dev_err_probe(dev, ret, "no usb2 phy configured\n");
>> + }
>> +
>> + if (IS_ERR(dwc->usb3_phy[0])) {
>> + ret = PTR_ERR(dwc->usb3_phy[0]);
>> + if (ret == -ENXIO || ret == -ENODEV)
>> + dwc->usb3_phy[0] = NULL;
>> + else
>> + return dev_err_probe(dev, ret, "no usb3 phy configured\n");
>> + }
>> +
>> + dwc->usb2_generic_phy = devm_phy_get(dev, "usb2-phy");
>> + if (IS_ERR(dwc->usb2_generic_phy)) {
>> + ret = PTR_ERR(dwc->usb2_generic_phy);
>> + if (ret == -ENOSYS || ret == -ENODEV)
>> + dwc->usb2_generic_phy = NULL;
>> + else
>> + return dev_err_probe(dev, ret, "no usb2 phy configured\n");
>> + }
> I know that this block is a copy and paste move from above, but is the
> ENOSYS check really needed? It looks like the phy_get() only returns
> -ENODEV.
sure I got ENOSYS removed in my RFC V2 patch. This was present by
default, so I did not change it earlier.
>> @@ -1147,8 +1149,10 @@ struct dwc3 {
>>
>> struct reset_control *reset;
>>
>> - struct usb_phy *usb2_phy;
>> - struct usb_phy *usb3_phy;
>> + struct usb_phy **usb2_phy;
>> + struct usb_phy **usb3_phy;
>> + u32 num_hsphy;
>> + u32 num_ssphy;
> Rename num_hsphy / num_ssphy to num_usb2_phy and num_usb3_phy so this is
> easier to audit.
Okay will change this in my next Patch.
>
> Brian
>