mbox series

[00/13] usb: dwc3: meson: add OTG support for GXL/GXM

Message ID 20200324102030.31000-1-narmstrong@baylibre.com (mailing list archive)
Headers show
Series usb: dwc3: meson: add OTG support for GXL/GXM | expand

Message

Neil Armstrong March 24, 2020, 10:20 a.m. UTC
The USB support was initialy done with a set of PHYs and dwc3-of-simple
because the architecture of the USB complex was not understood correctly
at the time (and proper documentation was missing...).

But with the G12A family, the USB complex was correctly understood and
implemented correctly.
But seems the G12A architecture was derived for the GXL USB architecture,
with minor differences and looks we can share most of the USB DWC3 glue
driver.

This patchset refactors and adds callbacks to handle the architecture
difference while keeping the main code shared.

The main difference is that on GXL/GXM the USB2 PHY control registers
are mixed with the PHY registers (we already handle correctly), and
the GLUE registers are allmost (99%) the same as G12A.

But, the GXL/GXM HW is buggy, here are the quirks :
- for the DWC2 controller to reset correctly, the GLUE mux must be switched
  to peripheral when the DWC2 controlle probes. For now it's handled by simply
  switching to device when probing the subnodes, but it may be not enough
- when manually switching from Host to Device when the USB port is not
  populated (should not happen with proper Micro-USB/USB-C OTG switch), it
  makes the DWC3 to crash. The only way to avoid that is to use the Host
  Disconnect bit to disconnect the DWC3 controller from the port, but we can't
  recover the Host functionnality unless resetting the DWC3 controller.
  This bit is set when only manual switch is done, and a warning is printed
  on manual switching.

The patches 1-8 should be applied first, then either waiting the next release
or if the usb maintainer can provide us a stable tag, we can use it to merge
the DT and bindings.

Martin Blumenstingl (4):
  arm64: dts: amlogic: use the new USB control driver for GXL and GXM
  phy: amlogic: meson-gxl-usb3: remove code for non-existing PHY
  usb: dwc3: of-simple: remove Amlogic GXL and AXG compatibles
  dt-bindings: usb: dwc3: remove old DWC3 wrapper

Neil Armstrong (9):
  dt-bindings: usb: amlogic,meson-g12a-usb-ctrl: add the Amlogic GXL and
    GXM Families USB Glue Bindings
  usb: dwc3: meson-g12a: specify phy names in soc data
  usb: dwc3: meson-g12a: handle the phy and glue registers separately
  usb: dwc3: meson-g12a: get the reset as shared
  usb: dwc3: meson-g12a: refactor usb2 phy init
  usb: dwc3: meson-g12a: refactor usb init
  usb: dwc3: meson-g12a: support the GXL/GXM DWC3 host phy disconnect
  usb: dwc3: meson-g12a: add support for GXL and GXM SoCs
  doc: dt: bindings: usb: dwc3: remove amlogic compatible entries

 .../bindings/phy/meson-gxl-usb3-phy.txt       |  31 --
 .../devicetree/bindings/usb/amlogic,dwc3.txt  |  42 --
 .../usb/amlogic,meson-g12a-usb-ctrl.yaml      |  21 +
 .../devicetree/bindings/usb/dwc3.txt          |   2 -
 .../dts/amlogic/meson-gx-libretech-pc.dtsi    |   2 +-
 .../boot/dts/amlogic/meson-gx-p23x-q20x.dtsi  |   2 +-
 .../amlogic/meson-gxl-s805x-libretech-ac.dts  |   3 +-
 .../boot/dts/amlogic/meson-gxl-s805x-p241.dts |   3 +-
 .../amlogic/meson-gxl-s905d-phicomm-n1.dts    |   4 +
 .../boot/dts/amlogic/meson-gxl-s905w-p281.dts |   4 +
 .../dts/amlogic/meson-gxl-s905w-tx3-mini.dts  |   4 +
 .../amlogic/meson-gxl-s905x-khadas-vim.dts    |   4 +
 .../amlogic/meson-gxl-s905x-libretech-cc.dts  |   7 +-
 .../amlogic/meson-gxl-s905x-nexbox-a95x.dts   |   3 +-
 .../dts/amlogic/meson-gxl-s905x-p212.dtsi     |   7 +-
 arch/arm64/boot/dts/amlogic/meson-gxl.dtsi    |  45 +-
 .../dts/amlogic/meson-gxm-khadas-vim2.dts     |   3 +-
 .../boot/dts/amlogic/meson-gxm-nexbox-a1.dts  |   3 +-
 .../boot/dts/amlogic/meson-gxm-vega-s96.dts   |   4 +
 arch/arm64/boot/dts/amlogic/meson-gxm.dtsi    |   7 +-
 drivers/phy/amlogic/Kconfig                   |  12 -
 drivers/phy/amlogic/Makefile                  |   1 -
 drivers/phy/amlogic/phy-meson-gxl-usb3.c      | 283 ------------
 drivers/usb/dwc3/dwc3-meson-g12a.c            | 407 ++++++++++++++----
 drivers/usb/dwc3/dwc3-of-simple.c             |  30 +-
 25 files changed, 421 insertions(+), 513 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/phy/meson-gxl-usb3-phy.txt
 delete mode 100644 Documentation/devicetree/bindings/usb/amlogic,dwc3.txt
 delete mode 100644 drivers/phy/amlogic/phy-meson-gxl-usb3.c

Comments

Felipe Balbi March 29, 2020, 10:30 a.m. UTC | #1
Neil Armstrong <narmstrong@baylibre.com> writes:

> The USB support was initialy done with a set of PHYs and dwc3-of-simple
> because the architecture of the USB complex was not understood correctly
> at the time (and proper documentation was missing...).
>
> But with the G12A family, the USB complex was correctly understood and
> implemented correctly.
> But seems the G12A architecture was derived for the GXL USB architecture,
> with minor differences and looks we can share most of the USB DWC3 glue
> driver.
>
> This patchset refactors and adds callbacks to handle the architecture
> difference while keeping the main code shared.
>
> The main difference is that on GXL/GXM the USB2 PHY control registers
> are mixed with the PHY registers (we already handle correctly), and
> the GLUE registers are allmost (99%) the same as G12A.
>
> But, the GXL/GXM HW is buggy, here are the quirks :
> - for the DWC2 controller to reset correctly, the GLUE mux must be switched
>   to peripheral when the DWC2 controlle probes. For now it's handled by simply
>   switching to device when probing the subnodes, but it may be not enough
> - when manually switching from Host to Device when the USB port is not
>   populated (should not happen with proper Micro-USB/USB-C OTG switch), it
>   makes the DWC3 to crash. The only way to avoid that is to use the Host
>   Disconnect bit to disconnect the DWC3 controller from the port, but we can't
>   recover the Host functionnality unless resetting the DWC3 controller.
>   This bit is set when only manual switch is done, and a warning is printed
>   on manual switching.
>
> The patches 1-8 should be applied first, then either waiting the next release
> or if the usb maintainer can provide us a stable tag, we can use it to merge
> the DT and bindings.

it's unclear to me if this series is ready to be merged. Can someone
confirm? If it is, can you resend with all reviewed by tags in place?

Thanks
Felipe Balbi May 14, 2020, 10:23 a.m. UTC | #2
Felipe Balbi <balbi@kernel.org> writes:

> Neil Armstrong <narmstrong@baylibre.com> writes:
>
>> The USB support was initialy done with a set of PHYs and dwc3-of-simple
>> because the architecture of the USB complex was not understood correctly
>> at the time (and proper documentation was missing...).
>>
>> But with the G12A family, the USB complex was correctly understood and
>> implemented correctly.
>> But seems the G12A architecture was derived for the GXL USB architecture,
>> with minor differences and looks we can share most of the USB DWC3 glue
>> driver.
>>
>> This patchset refactors and adds callbacks to handle the architecture
>> difference while keeping the main code shared.
>>
>> The main difference is that on GXL/GXM the USB2 PHY control registers
>> are mixed with the PHY registers (we already handle correctly), and
>> the GLUE registers are allmost (99%) the same as G12A.
>>
>> But, the GXL/GXM HW is buggy, here are the quirks :
>> - for the DWC2 controller to reset correctly, the GLUE mux must be switched
>>   to peripheral when the DWC2 controlle probes. For now it's handled by simply
>>   switching to device when probing the subnodes, but it may be not enough
>> - when manually switching from Host to Device when the USB port is not
>>   populated (should not happen with proper Micro-USB/USB-C OTG switch), it
>>   makes the DWC3 to crash. The only way to avoid that is to use the Host
>>   Disconnect bit to disconnect the DWC3 controller from the port, but we can't
>>   recover the Host functionnality unless resetting the DWC3 controller.
>>   This bit is set when only manual switch is done, and a warning is printed
>>   on manual switching.
>>
>> The patches 1-8 should be applied first, then either waiting the next release
>> or if the usb maintainer can provide us a stable tag, we can use it to merge
>> the DT and bindings.
>
> it's unclear to me if this series is ready to be merged. Can someone
> confirm? If it is, can you resend with all reviewed by tags in place?

Are we getting a v2 for this?
Neil Armstrong May 14, 2020, 12:42 p.m. UTC | #3
Hi,

On 14/05/2020 12:23, Felipe Balbi wrote:
> Felipe Balbi <balbi@kernel.org> writes:
> 
>> Neil Armstrong <narmstrong@baylibre.com> writes:
>>
>>> The USB support was initialy done with a set of PHYs and dwc3-of-simple
>>> because the architecture of the USB complex was not understood correctly
>>> at the time (and proper documentation was missing...).
>>>
>>> But with the G12A family, the USB complex was correctly understood and
>>> implemented correctly.
>>> But seems the G12A architecture was derived for the GXL USB architecture,
>>> with minor differences and looks we can share most of the USB DWC3 glue
>>> driver.
>>>
>>> This patchset refactors and adds callbacks to handle the architecture
>>> difference while keeping the main code shared.
>>>
>>> The main difference is that on GXL/GXM the USB2 PHY control registers
>>> are mixed with the PHY registers (we already handle correctly), and
>>> the GLUE registers are allmost (99%) the same as G12A.
>>>
>>> But, the GXL/GXM HW is buggy, here are the quirks :
>>> - for the DWC2 controller to reset correctly, the GLUE mux must be switched
>>>   to peripheral when the DWC2 controlle probes. For now it's handled by simply
>>>   switching to device when probing the subnodes, but it may be not enough
>>> - when manually switching from Host to Device when the USB port is not
>>>   populated (should not happen with proper Micro-USB/USB-C OTG switch), it
>>>   makes the DWC3 to crash. The only way to avoid that is to use the Host
>>>   Disconnect bit to disconnect the DWC3 controller from the port, but we can't
>>>   recover the Host functionnality unless resetting the DWC3 controller.
>>>   This bit is set when only manual switch is done, and a warning is printed
>>>   on manual switching.
>>>
>>> The patches 1-8 should be applied first, then either waiting the next release
>>> or if the usb maintainer can provide us a stable tag, we can use it to merge
>>> the DT and bindings.
>>
>> it's unclear to me if this series is ready to be merged. Can someone
>> confirm? If it is, can you resend with all reviewed by tags in place?
> 
> Are we getting a v2 for this?
> 

Yes, even a v3 with reviews on all patches:
http://lkml.kernel.org/r/20200416121910.12723-1-narmstrong@baylibre.com

Neil
Felipe Balbi May 14, 2020, 12:59 p.m. UTC | #4
Neil Armstrong <narmstrong@baylibre.com> writes:

> Hi,
>
> On 14/05/2020 12:23, Felipe Balbi wrote:
>> Felipe Balbi <balbi@kernel.org> writes:
>> 
>>> Neil Armstrong <narmstrong@baylibre.com> writes:
>>>
>>>> The USB support was initialy done with a set of PHYs and dwc3-of-simple
>>>> because the architecture of the USB complex was not understood correctly
>>>> at the time (and proper documentation was missing...).
>>>>
>>>> But with the G12A family, the USB complex was correctly understood and
>>>> implemented correctly.
>>>> But seems the G12A architecture was derived for the GXL USB architecture,
>>>> with minor differences and looks we can share most of the USB DWC3 glue
>>>> driver.
>>>>
>>>> This patchset refactors and adds callbacks to handle the architecture
>>>> difference while keeping the main code shared.
>>>>
>>>> The main difference is that on GXL/GXM the USB2 PHY control registers
>>>> are mixed with the PHY registers (we already handle correctly), and
>>>> the GLUE registers are allmost (99%) the same as G12A.
>>>>
>>>> But, the GXL/GXM HW is buggy, here are the quirks :
>>>> - for the DWC2 controller to reset correctly, the GLUE mux must be switched
>>>>   to peripheral when the DWC2 controlle probes. For now it's handled by simply
>>>>   switching to device when probing the subnodes, but it may be not enough
>>>> - when manually switching from Host to Device when the USB port is not
>>>>   populated (should not happen with proper Micro-USB/USB-C OTG switch), it
>>>>   makes the DWC3 to crash. The only way to avoid that is to use the Host
>>>>   Disconnect bit to disconnect the DWC3 controller from the port, but we can't
>>>>   recover the Host functionnality unless resetting the DWC3 controller.
>>>>   This bit is set when only manual switch is done, and a warning is printed
>>>>   on manual switching.
>>>>
>>>> The patches 1-8 should be applied first, then either waiting the next release
>>>> or if the usb maintainer can provide us a stable tag, we can use it to merge
>>>> the DT and bindings.
>>>
>>> it's unclear to me if this series is ready to be merged. Can someone
>>> confirm? If it is, can you resend with all reviewed by tags in place?
>> 
>> Are we getting a v2 for this?
>> 
>
> Yes, even a v3 with reviews on all patches:
> http://lkml.kernel.org/r/20200416121910.12723-1-narmstrong@baylibre.com

In that case, can you check that I have applied everything correctly in
testing/next?

cheers
Neil Armstrong May 15, 2020, 8:03 a.m. UTC | #5
On 14/05/2020 14:59, Felipe Balbi wrote:
> Neil Armstrong <narmstrong@baylibre.com> writes:
> 
>> Hi,
>>
>> On 14/05/2020 12:23, Felipe Balbi wrote:
>>> Felipe Balbi <balbi@kernel.org> writes:
>>>
>>>> Neil Armstrong <narmstrong@baylibre.com> writes:
>>>>
>>>>> The USB support was initialy done with a set of PHYs and dwc3-of-simple
>>>>> because the architecture of the USB complex was not understood correctly
>>>>> at the time (and proper documentation was missing...).
>>>>>
>>>>> But with the G12A family, the USB complex was correctly understood and
>>>>> implemented correctly.
>>>>> But seems the G12A architecture was derived for the GXL USB architecture,
>>>>> with minor differences and looks we can share most of the USB DWC3 glue
>>>>> driver.
>>>>>
>>>>> This patchset refactors and adds callbacks to handle the architecture
>>>>> difference while keeping the main code shared.
>>>>>
>>>>> The main difference is that on GXL/GXM the USB2 PHY control registers
>>>>> are mixed with the PHY registers (we already handle correctly), and
>>>>> the GLUE registers are allmost (99%) the same as G12A.
>>>>>
>>>>> But, the GXL/GXM HW is buggy, here are the quirks :
>>>>> - for the DWC2 controller to reset correctly, the GLUE mux must be switched
>>>>>   to peripheral when the DWC2 controlle probes. For now it's handled by simply
>>>>>   switching to device when probing the subnodes, but it may be not enough
>>>>> - when manually switching from Host to Device when the USB port is not
>>>>>   populated (should not happen with proper Micro-USB/USB-C OTG switch), it
>>>>>   makes the DWC3 to crash. The only way to avoid that is to use the Host
>>>>>   Disconnect bit to disconnect the DWC3 controller from the port, but we can't
>>>>>   recover the Host functionnality unless resetting the DWC3 controller.
>>>>>   This bit is set when only manual switch is done, and a warning is printed
>>>>>   on manual switching.
>>>>>
>>>>> The patches 1-8 should be applied first, then either waiting the next release
>>>>> or if the usb maintainer can provide us a stable tag, we can use it to merge
>>>>> the DT and bindings.
>>>>
>>>> it's unclear to me if this series is ready to be merged. Can someone
>>>> confirm? If it is, can you resend with all reviewed by tags in place?
>>>
>>> Are we getting a v2 for this?
>>>
>>
>> Yes, even a v3 with reviews on all patches:
>> http://lkml.kernel.org/r/20200416121910.12723-1-narmstrong@baylibre.com
> 
> In that case, can you check that I have applied everything correctly in
> testing/next?
> 
> cheers
> 

Looks fine,

Thanks,
Neil