u-boot-brain/drivers/usb/gadget
Fabrice Gasnier 7fd9f31c6b usb: dwc2: fix gadget disconnect
This fixes a disconnect issue detected with fastboot command, when using
dwc2 driver.
- On u-boot side:
uboot>$ fastboot 0
- On USB host PC side, few seconds after
PC>$ fastboot reboot # Get stuck, uboot target never reboots

By enabling DEBUG_ISR logs, the bus suspend interrupt is seen before the
PC command has been issued. When the USB bus suspend occurs, there's a HACK
that disables the fastboot (composite driver). Here is the call stack
upon USB bus suspend:
- dwc2_handle_usb_suspend_intr()
  - dev->driver->disconnect()
    - composite_disconnect()
      - reset_config()
        - f->disable()
          - fastboot_disable()
            - usb_ep_disable(f_fb->out_ep);
            - usb_ep_disable(f_fb->in_ep);
            .. other disable calls.

When the resume interrupt happens, everything has been disabled, then
nothing happens. fastboot command gets stuck on HOST side.

Remove original HACK, that disconnects the composite driver upon
USB bus suspend. Implement disconnect detection instead:
- check GINTSTS OTG interrupt
- read GOTGINT register
- check GOTGINT, SesEndDet bit (e.g. session end)
This is inspired by what is implemented currently in Linux dwc2 driver.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Reviewed-by: Marek Vasut <marex@denx.de>
2019-04-21 10:26:52 +02:00
..
udc usb: udc-uclass: Fixed problem when no alias is defined in DT 2019-03-16 13:29:43 +01:00
at91_udc.c usb: composite: Move bitmap related operations to ./include/linux/bitmap.h 2018-12-14 17:59:08 +01:00
at91_udc.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
atmel_usba_udc.c usb: composite: Move bitmap related operations to ./include/linux/bitmap.h 2018-12-14 17:59:08 +01:00
atmel_usba_udc.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
bcm_udc_otg_phy.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
bcm_udc_otg.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
ci_udc.c usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/ 2018-11-26 21:19:03 +01:00
ci_udc.h ci_udc: Update the ci_udc driver to support bulk transfers 2015-05-29 12:41:04 +02:00
composite.c usb: composite: Fix max packet size for USB3.0 2018-12-14 17:59:10 +01:00
config.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
core.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
designware_udc.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
dwc2_udc_otg_phy.c usb: composite: Move bitmap related operations to ./include/linux/bitmap.h 2018-12-14 17:59:08 +01:00
dwc2_udc_otg_priv.h usb: dwc2_udc_otg: Read MAX_HW_ENDPOINT from HWCFG4 register 2019-04-21 10:26:52 +02:00
dwc2_udc_otg_regs.h usb: dwc2: fix gadget disconnect 2019-04-21 10:26:52 +02:00
dwc2_udc_otg_xfer_dma.c usb: dwc2: fix gadget disconnect 2019-04-21 10:26:52 +02:00
dwc2_udc_otg.c stm32mp1: add stusb1600 support for DK1 and DK2 board 2019-04-21 10:26:52 +02:00
ep0.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
ep0.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
epautoconf.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
ether.c usb: ether: call _usb_eth_halt() if initialization fails 2019-02-01 09:09:40 -05:00
f_dfu.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
f_dfu.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
f_fastboot.c usb: fastboot: Convert USB f_fastboot to shared fastboot 2018-05-30 11:59:21 +02:00
f_mass_storage.c usb: composite: Move bitmap related operations to ./include/linux/bitmap.h 2018-12-14 17:59:08 +01:00
f_rockusb.c usb: rockchip: on K_FW_LBA_WRITE_10 remove magic block size of 512 bytes 2018-08-08 22:22:08 +02:00
f_sdp.c usb: gadget: f_sdp: Provide filesize env variable for downloaded images 2018-12-14 17:59:08 +01:00
f_thor.c gadget: f_thor: fix hang-up with ctrl-c 2018-08-08 22:22:07 +02:00
f_thor.h gadget: f_thor: update to support more than 4GB file as thor 5.0 2018-05-18 13:17:30 +02:00
fotg210.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
g_dnl.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
gadget_chips.h usb: gadget: Add bcdDevice for the DWC3 USB Gadget Controller 2018-08-21 16:21:37 +02:00
Kconfig usb: gadget: USB_ETHER requires network support 2018-04-08 23:00:58 -04:00
Makefile spl: Kconfig: Drop the _SUPPORT postfix from SPL_DFU 2019-01-26 08:13:54 -05:00
ndis.h USB: Add USB RNDIS gadget protocol 2011-02-19 20:32:37 +01:00
pxa25x_udc.c usb: composite: Move bitmap related operations to ./include/linux/bitmap.h 2018-12-14 17:59:08 +01:00
pxa25x_udc.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
pxa27x_udc.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
rndis.c net.h: Include linux/if_ether.h to avoid duplication 2018-10-10 12:28:52 -05:00
rndis.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
storage_common.c lib: Add hexdump 2018-06-13 07:49:12 -04:00
usbstring.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00