On 2019/11/22 15:52, Martin Blumenstingl wrote: > Hello Hanjie, > > On Fri, Nov 22, 2019 at 7:55 AM Hanjie Lin <hanjie.lin@xxxxxxxxxxx> wrote: > [...] >> dt-bindings: phy: Add Amlogic G12A USB2 PHY Bindings >> dt-bindings: usb: dwc3: Add the Amlogic A1 Family DWC3 Glue Bindings >> phy: amlogic: Add Amlogic A1 USB2 PHY Driver > drivers/phy/amlogic/phy-meson-g12a-usb2.c seems very similar to the A1 > USB2 PHY you are introducing here. > >> usb: dwc3: Add Amlogic A1 DWC3 glue > drivers/usb/dwc3/dwc3-meson-g12a.c is also very similar to the dwc3 glue. > > I have two questions: > - how is the PHY and the dwc3 glue different from G12A (or SM1)? > - why do we need a separate set of new drivers (instead of updating > the existing drivers)? > > We try to use one driver for the same IP block, even if there are > several revisions with small differences (for example the SAR ADC > driver supports all SoC generations from Meson8 to G12A/G12B/SM1, > because 80-90% of the code is shared across all revisions). > > > Martin > > . > Hi Martin, thanks for the comment. 1, G12A have usb2-phy0/usb2-phy1/usb3-phy0 three phys and an interrupt to support host/peripheral/otg modes. A1 has one usb2-phy0 phy and only support host mode. 2, G12A glue/phy drivers are for G12A SoCs, there are some diffrences to A1. G12A glue driver have dr_mode and interrupts two attributes to support otg mode while A1 hasn't this requirement. G12A glue driver has a hard coding vbus regulator code to support otg mode while A1 hasn't this requirement. G12A glue driver has a hard coding support phys while A1 only supports host mode. enum { USB2_HOST_PHY = 0, USB2_OTG_PHY, USB3_HOST_PHY, PHY_COUNT, }; G12A glue driver only supports one clock while A1 needs four clocks. G12A and A1 phy drivers have different register configurations since hardware differences. 3, We have estimated these differences and we thought it's more clear and readable to have a dedicated glue/phy driver for A1 SoCs, so also dedicated dt-bindings.