• Amelie Delaunay's avatar
    usb: dwc2: override PHY input signals with usb role switch support · bc0f0d4a
    Amelie Delaunay authored
    This patch adds support for usb role switch to dwc2, by using overriding
    control of the PHY voltage valid and ID input signals.
    
    iddig signal (ID) can be overridden:
    - when setting GUSBCFG_FORCEHOSTMODE, iddig input pin is overridden with 1;
    - when setting GUSBCFG_FORCEDEVMODE, iddig input pin is overridden with 0.
    
    avalid/bvalid/vbusvalid signals can be overridden respectively with:
    - GOTGCTL_AVALOEN + GOTGCTL_AVALOVAL
    - GOTGCTL_BVALOEN + GOTGCTL_BVALOVAL
    - GOTGCTL_VBVALEN + GOTGCTL_VBVALOVAL
    
    It is possible to determine valid sessions thanks to usb role switch:
    - if USB_ROLE_NONE then !avalid && !bvalid && !vbusvalid
    - if USB_ROLE_DEVICE then !avalid && bvalid && vbusvalid
    - if USB_ROLE_HOST then avalid && !bvalid && vbusvalid
    Acked-by: default avatarMinas Harutyunyan <hminas@synopsys.com>
    Signed-off-by: default avatarAmelie Delaunay <amelie.delaunay@st.com>
    Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
    bc0f0d4a
gadget.c 138 KB