[PATCH 3/5] usb: dwc3-generic: Add dependency on SIMPLE_BUS

Kunihiko Hayashi hayashi.kunihiko at socionext.com
Mon Jan 23 06:01:08 CET 2023


Hi Marek,

On 2023/01/23 12:37, Marek Vasut wrote:
> On 1/23/23 04:08, Kunihiko Hayashi wrote:
> 
> Hello Hayashi-san,
> 
>>>> diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
>>>> index f010291d02..dadaa083e7 100644
>>>> --- a/drivers/usb/dwc3/Kconfig
>>>> +++ b/drivers/usb/dwc3/Kconfig
>>>> @@ -25,14 +25,14 @@ config USB_DWC3_OMAP
>>>>     config USB_DWC3_GENERIC
>>>>         bool "Generic implementation of a DWC3 wrapper (aka dwc3 glue)"
>>>> -    depends on DM_USB && USB_DWC3 && MISC
>>>> +    depends on DM_USB && USB_DWC3 && (MISC || SIMPLE_BUS)
>>>
>>> I'm afraid I don't understand why this change is needed for all variants
>>> of DWC3.
>>
>> Although dwc3-generic is declared as UCLASS_NOP, the similar glue driver
>> dwc3-meson-glx is declared as UCLASS_SIMPLE_BUS.
> 
> I think here it makes sense, because "amlogic,meson-axg-usb-ctrl"
> behaves like a bus with subnodes:
> 
> arch/arm/dts/meson-axg.dtsi:
>    227 usb: usb at ffe09080 {
>    228     compatible = "amlogic,meson-axg-usb-ctrl";
>    229     reg = <0x0 0xffe09080 0x0 0x20>;
> ...
>    244     dwc2: usb at ff400000 {
>    245         compatible = "amlogic,meson-g12a-usb", "snps,dwc2";
>    246         reg = <0x0 0xff400000 0x0 0x40000>;
> ...
>    255     };
>    256
>    257     dwc3: usb at ff500000 {
>    258         compatible = "snps,dwc3";
>    259         reg = <0x0 0xff500000 0x0 0x100000>;
> ...
>    264     };
>    265 };
> 
> arch/arm/dts/meson-gxl.dtsi
>    17 usb: usb at d0078080 {
>    18     compatible = "amlogic,meson-gxl-usb-ctrl";
>    19     reg = <0x0 0xd0078080 0x0 0x20>;
> ...
>    34     dwc2: usb at c9100000 {
>    35         compatible = "amlogic,meson-g12a-usb", "snps,dwc2";
>    36         reg = <0x0 0xc9100000 0x0 0x40000>;
> ...
>    45     };
>    46
>    47     dwc3: usb at c9000000 {
>    48         compatible = "snps,dwc3";
>    49         reg = <0x0 0xc9000000 0x0 0x100000>;
> ...
>    54     };
>    55 };
> 
> On the other hand, the PXS2 controller for example is not a bus:
> 
> arch/arm/dts/uniphier-pxs2.dtsi:
> 596 _usb0: usb at 65a00000 {
> 597     compatible = "socionext,uniphier-dwc3", "snps,dwc3";
> 598     status = "disabled";
> 599     reg = <0x65a00000 0xcd00>;
> ...
> 610 };

I understand. However, this node isn't used in u-boot.
(see below for details)

>>> Is this needed for socionext dwc3 variant to handle the simple-mfd in
>>> e.g. arch/arm/dts/uniphier-pxs3.dtsi :
>>>
>>> 614 usb-glue at 65b00000 {
>>> 615     compatible = "socionext,uniphier-pxs3-dwc3-glue",
>>> 616              "simple-mfd";
>>>
>>> ?
>>
>> In case of U-Boot, the glue driver is probed by:
>>
>>       /* FIXME: U-Boot own node */
>>       usb at 65b00000 {
>>               compatible = "socionext,uniphier-pxs3-dwc3";
>>
>> And dwc3-uniphier is also declared as UCLASS_SIMPLE_BUS.
>> Even if using "simple-mfd", this is included in drivers/core/simple-bus.c
>> which is declared as UCLASS_SIMPLE_BUS.
> 
> If I understand this correctly, node compatible with
> "socionext,uniphier-pxs3-dwc3-glue" is not used at all , right ?

Yes.
Original uniphier devicetree has the following usb nodes.

     usb at 65a00000 {
         compatible = "snps,dwc3";
     };
     usb-glue at 65b00000 {
         compatible = "socionext,uniphier-pxs3-dwc3-glue", "simple-mfd";
     };

However, U-Boot dwc3-generic needs to put dwc3 node under the glue node.
Due to this restriction, there is another usb node dedicated to u-boot.

     /* FIXME: U-Boot own node */
     usb at 65b00000 { /* glue */
         compatible = "socionext,uniphier-pxs3-dwc3";

         dwc3 at 65a00000 {
             compatible = "snps,dwc3";
         };
     };

So instead of "socionext,uniphier-pxs3-dwc3-glue", the glue driver
uses "socionext,uniphier-pxs3-dwc3" in U-Boot.

> The generic driver binds to node compatible with
> "socionext,uniphier-dwc3" , right ?

No, the generic driver binds "socionext,uniphier-pxs3-dwc3".

> That means, there is nothing which would be a bus, and so the
> dwc3-uniphier.c can be switched from UCLASS_SIMPLE_BUS to UCLASS_NOP ,
> is that correct ?

There is still the issue of different usb node between Original and u-boot,
however, the glue driver can be switched to UCLASS_NOP.

Thank you,

---
Best Regards
Kunihiko Hayashi


More information about the U-Boot mailing list