Skip to contentSkip to conversation

usb: add MediaTek USB3 DRD driver

PATCH RESEND Superseded Chunfeng Yun 1 participant 1 message Oct 14, 2020

Subsystems (3)

v9 of 10 Superseded Latest is v10 →

lore
Share & tools
lore

Chunfeng Yun

author maintainer
#0 lore raw

PATCH RESEND v9 1/1 usb: add MediaTek USB3 DRD driver

This patch adds support for the MediaTek USB3 DRD controller, its host side is based on xHCI, this driver supports device mode and host mode.

---
v9:
1. replace tab by space for macro in mtu3.h suggested by Marek
2. add Acked-by Bin

v8: Simplify Kconfig suggested by Bin

v7: use xhci quirk flag XHCI_MTK_HOST

v6: no changes

v5: change condition of readl_poll_timeout() when check clocks

v4:
1. remove unused member @busy and @wedged, use their flags instead
2. support force_vbus mode
3. add a glue driver using UCLASS_NOP
4. add host driver, and rebuild host flow

v3 changes
1. add ->udc_set_speed()
2. simplify some code flow

v2: simplify QMU operations

---
 Makefile                           |   1 +
 drivers/usb/Kconfig                |   2 +
 drivers/usb/mtu3/Kconfig           |  44 ++
 drivers/usb/mtu3/Makefile          |  11 +
 drivers/usb/mtu3/mtu3.h            | 423 +++++++++++++
 drivers/usb/mtu3/mtu3_core.c       | 838 ++++++++++++++++++++++++++
 drivers/usb/mtu3/mtu3_dr.h         |  52 ++
 drivers/usb/mtu3/mtu3_gadget.c     | 686 +++++++++++++++++++++
 drivers/usb/mtu3/mtu3_gadget_ep0.c | 933 +++++++++++++++++++++++++++++
 drivers/usb/mtu3/mtu3_host.c       | 141 +++++
 drivers/usb/mtu3/mtu3_hw_regs.h    | 515 ++++++++++++++++
 drivers/usb/mtu3/mtu3_plat.c       | 368 ++++++++++++
 drivers/usb/mtu3/mtu3_qmu.c        | 504 ++++++++++++++++
 drivers/usb/mtu3/mtu3_qmu.h        |  37 ++
 14 files changed, 4555 insertions(+)
 create mode 100644 drivers/usb/mtu3/Kconfig
 create mode 100644 drivers/usb/mtu3/Makefile
 create mode 100644 drivers/usb/mtu3/mtu3.h
 create mode 100644 drivers/usb/mtu3/mtu3_core.c
 create mode 100644 drivers/usb/mtu3/mtu3_dr.h
 create mode 100644 drivers/usb/mtu3/mtu3_gadget.c
 create mode 100644 drivers/usb/mtu3/mtu3_gadget_ep0.c
 create mode 100644 drivers/usb/mtu3/mtu3_host.c
 create mode 100644 drivers/usb/mtu3/mtu3_hw_regs.h
 create mode 100644 drivers/usb/mtu3/mtu3_plat.c
 create mode 100644 drivers/usb/mtu3/mtu3_qmu.c
 create mode 100644 drivers/usb/mtu3/mtu3_qmu.h
Makefile +1 -0
index 5390c93f21..7379fb5db8 100644
@@ -795,6 +795,7 @@ libs-y += drivers/usb/eth/
 libs-$(CONFIG_USB_GADGET) += drivers/usb/gadget/
 libs-$(CONFIG_USB_GADGET) += drivers/usb/gadget/udc/
 libs-y += drivers/usb/host/
+libs-y += drivers/usb/mtu3/
 libs-y += drivers/usb/musb/
 libs-y += drivers/usb/musb-new/
 libs-y += drivers/usb/phy/
drivers/usb/Kconfig +2 -0
index 34881a12b8..fedc0134f5 100644
@@ -72,6 +72,8 @@ source "drivers/usb/cdns3/Kconfig"
 
 source "drivers/usb/dwc3/Kconfig"
 
+source "drivers/usb/mtu3/Kconfig"
+
 source "drivers/usb/musb/Kconfig"
 
 source "drivers/usb/musb-new/Kconfig"
drivers/usb/mtu3/Kconfig new file +44 -0

44 lines not on this page · raw message

drivers/usb/mtu3/Makefile new file +11 -0
new file mode 100644
index 0000000000..234f3a380a
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: GPL-2.0
+
+ccflags-$(CONFIG_USB_MTU3_DEBUG)	+= -DDEBUG
+
+obj-$(CONFIG_USB_MTU3)	+= mtu3.o
+
+mtu3-y	:= mtu3_plat.o
+
+obj-$(CONFIG_USB_MTU3_GADGET)	+= mtu3_core.o mtu3_gadget_ep0.o mtu3_gadget.o
+obj-$(CONFIG_USB_MTU3_GADGET)	+= mtu3_qmu.o
+obj-$(CONFIG_USB_MTU3_HOST)	+= mtu3_host.o
drivers/usb/mtu3/mtu3.h new file +423 -0

423 lines not on this page · raw message

drivers/usb/mtu3/mtu3_core.c new file +838 -0

838 lines not on this page · raw message

drivers/usb/mtu3/mtu3_dr.h new file +52 -0

52 lines not on this page · raw message

drivers/usb/mtu3/mtu3_gadget.c new file +686 -0

686 lines not on this page · raw message

drivers/usb/mtu3/mtu3_gadget_ep0.c new file +933 -0

931 lines not on this page · raw message

drivers/usb/mtu3/mtu3_host.c new file +141 -0

141 lines not on this page · raw message

drivers/usb/mtu3/mtu3_hw_regs.h new file +515 -0

515 lines not on this page · raw message

drivers/usb/mtu3/mtu3_plat.c new file +368 -0

368 lines not on this page · raw message

drivers/usb/mtu3/mtu3_qmu.c new file +504 -0

504 lines not on this page · raw message

drivers/usb/mtu3/mtu3_qmu.h new file +37 -0
new file mode 100644
index 0000000000..ba8a3aa309

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.18.0

Part of the diff is not shown here. View the raw message.