MLK-17821-1 USB: gadget: Add the cadence USB3 gadget driver
authorYe Li <ye.li@nxp.com>
Fri, 16 Mar 2018 07:03:40 +0000 (00:03 -0700)
committerYe Li <ye.li@nxp.com>
Mon, 19 Mar 2018 08:51:46 +0000 (01:51 -0700)
commit70514bd095ff9a94e9a523845641381486284257
tree51a56a52d2164b3cc81c2cba09c2f29a1a0e58cb
parent2fd813fcfcb82f28f353fbdc727765d6e848bfd7
MLK-17821-1 USB: gadget: Add the cadence USB3 gadget driver

Porting the cadence USB3 (CDNS3) driver from kernel to u-boot. We only support
the gadget (device mode), while the host mode is not supported. Users remains
to use xhci-imx8 driver for host mode.

Some changes in the CDNS3 driver porting:

1. Add match_ep call back to usb_gadget_ops. The CDNS3 gadget driver replies
   on this operation to bind the usb_ep/usb_ss_ep with the endpoint descriptor
   when function layer uses usb_ep_autoconfig to add endpoint descriptors to gadget.
   So that CDNS3 driver can know the EP information and configure the EP once the
   set configuration request is received.

2. U-boot does not have CMA, so it won't allocate uncached memory. Need to flush
   TRB and its DMA buffer before prime to usb controller and after complete transfer.

3. In core.c, we add functions to hook with u-boot. It needs uplayer like
   to pass the register base address of each part of the USB controller.

4. Force the CDNS3 gadget max speed to HS. The SuperSpeed is not supported by u-boot,
   so disable it in gadget driver. A configuration USB_CDNS3_GADGET_FORCE_HIGHSPEED is
   selected.

5. Added gadget_is_cdns3 checking to provide bcdUSB value in device descriptor.

6. Moved some new fields in usb_ep structure to usb_ss_ep, since u-boot does not have them.

7. Remove host part codes as it is not supported by this driver.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peter Chen <peter.chen@nxp.com>
19 files changed:
Makefile
drivers/usb/Kconfig
drivers/usb/cdns3/Kconfig [new file with mode: 0644]
drivers/usb/cdns3/Makefile [new file with mode: 0644]
drivers/usb/cdns3/cdns3-nxp-reg-def.h [new file with mode: 0644]
drivers/usb/cdns3/core.c [new file with mode: 0644]
drivers/usb/cdns3/core.h [new file with mode: 0644]
drivers/usb/cdns3/dev-regs-macro.h [new file with mode: 0644]
drivers/usb/cdns3/dev-regs-map.h [new file with mode: 0644]
drivers/usb/cdns3/gadget-export.h [new file with mode: 0644]
drivers/usb/cdns3/gadget.c [new file with mode: 0644]
drivers/usb/cdns3/gadget.h [new file with mode: 0644]
drivers/usb/cdns3/io.h [new file with mode: 0644]
drivers/usb/cdns3/linux-compat.h [new file with mode: 0644]
drivers/usb/gadget/epautoconf.c
drivers/usb/gadget/gadget_chips.h
drivers/usb/gadget/udc/Makefile
include/cdns3-uboot.h [new file with mode: 0644]
include/linux/usb/gadget.h