mbox series

[v8,0/9] Add support MediaTek USB3 DRD driver

Message ID 1602659313-15391-1-git-send-email-chunfeng.yun@mediatek.com
Headers show
Series Add support MediaTek USB3 DRD driver | expand

Message

Chunfeng Yun Oct. 14, 2020, 7:08 a.m. UTC
These patches introduce the MediaTek USB3 Dual-Role Controller
driver.
The driver can be configured as Peripheral only and Host only
(based on xHCI) modes, and it's ported from Linux Kernel 5.8-rc1

v8 changes suggested by Bin:
    1. modify Kconfig and mt8512 defconfig
    2. merge [v7 8/10] and [v7 9/10]
    3. modify some commit log

v7 changes:
    1. use xhci quirk flag XHCI_MTK_HOST

v6 changes:
    1. modify commit message of [4/10]

v5 changes:
    1. change condition of readl_poll_timeout() when check clocks
    2. add xhci-mtk.c and myself as maintainer for MTK USB

v4 changes:
    1. [4/10], [9/10] and [10/10] are new patches
    2. add a glue driver
    3. add host driver and rebuild host flow
    4. support force_vbus mode for device
    5. update bindings to support glue driver

v3 changes:
    1. add patch [5/7]
    2. add udc_set_speed()
    3. simplify some code flow

v2 changes:
    1. simplify QMU operations

Chunfeng Yun (9):
  dt-binding: usb: add bindings for some common properties
  dt-bindings: usb: mtu3: add bindings for MediaTek USB3 DRD
  usb: add USB_SPEED_SUPER_PLUS
  usb: common: add define of usb_speed_string()
  usb: add MediaTek USB3 DRD driver
  usb: gadget: Add bcdDevice for the MTU3 USB Gadget Controller
  arm: dts: mt8512: add usb related nodes
  configs: mt8512: enable fastboot and USB host related configs
  MAINTAINERS: add USB driver to ARM MEDIATEK

 MAINTAINERS                                   |   3 +
 Makefile                                      |   1 +
 arch/arm/dts/mt8512-bm1-emmc.dts              |  34 +
 arch/arm/dts/mt8512.dtsi                      |  49 +-
 configs/mt8512_bm1_emmc_defconfig             |  26 +
 doc/device-tree-bindings/usb/generic.txt      |  31 +
 .../usb/mediatek,mtu3.txt                     |  79 ++
 drivers/usb/Kconfig                           |   2 +
 drivers/usb/common/common.c                   |   8 +
 drivers/usb/gadget/gadget_chips.h             |   8 +
 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 +
 include/linux/usb/ch9.h                       |   5 +-
 23 files changed, 4793 insertions(+), 5 deletions(-)
 create mode 100644 doc/device-tree-bindings/usb/generic.txt
 create mode 100644 doc/device-tree-bindings/usb/mediatek,mtu3.txt
 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

Comments

Bin Meng Oct. 14, 2020, 8:04 a.m. UTC | #1
On Wed, Oct 14, 2020 at 3:08 PM Chunfeng Yun <chunfeng.yun@mediatek.com> wrote:
>
> 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.
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
> 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
>

Acked-by: Bin Meng <bmeng.cn@gmail.com>
Marek Vasut Oct. 14, 2020, 8:22 a.m. UTC | #2
On 10/14/20 9:08 AM, Chunfeng Yun wrote:
> 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.

This one does not apply, can you rebase just this one on top of usb/next
and resend ? I picked the other patches into there already, so you don't
have to resend the whole series.

[...]

> +#define	MU3D_EP_TXCR0(epnum)	(U3D_TX1CSR0 + (((epnum) - 1) * 0x10))
> +#define	MU3D_EP_TXCR1(epnum)	(U3D_TX1CSR1 + (((epnum) - 1) * 0x10))
> +#define	MU3D_EP_TXCR2(epnum)	(U3D_TX1CSR2 + (((epnum) - 1) * 0x10))
> +
> +#define	MU3D_EP_RXCR0(epnum)	(U3D_RX1CSR0 + (((epnum) - 1) * 0x10))
> +#define	MU3D_EP_RXCR1(epnum)	(U3D_RX1CSR1 + (((epnum) - 1) * 0x10))
> +#define	MU3D_EP_RXCR2(epnum)	(U3D_RX1CSR2 + (((epnum) - 1) * 0x10))

#define[space] please, use consistently.

> +#define USB_QMU_RQCSR(epnum)	(U3D_RXQCSR1 + (((epnum) - 1) * 0x10))
> +#define USB_QMU_RQSAR(epnum)	(U3D_RXQSAR1 + (((epnum) - 1) * 0x10))
> +#define USB_QMU_RQCPR(epnum)	(U3D_RXQCPR1 + (((epnum) - 1) * 0x10))

[...]
Chunfeng Yun Oct. 14, 2020, 8:49 a.m. UTC | #3
On Wed, 2020-10-14 at 10:22 +0200, Marek Vasut wrote:
> On 10/14/20 9:08 AM, Chunfeng Yun wrote:
> > 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.
> 
> This one does not apply, can you rebase just this one on top of usb/next
> and resend ? I picked the other patches into there already, so you don't
> have to resend the whole series.
Ok
> 
> [...]
> 
> > +#define	MU3D_EP_TXCR0(epnum)	(U3D_TX1CSR0 + (((epnum) - 1) * 0x10))
> > +#define	MU3D_EP_TXCR1(epnum)	(U3D_TX1CSR1 + (((epnum) - 1) * 0x10))
> > +#define	MU3D_EP_TXCR2(epnum)	(U3D_TX1CSR2 + (((epnum) - 1) * 0x10))
> > +
> > +#define	MU3D_EP_RXCR0(epnum)	(U3D_RX1CSR0 + (((epnum) - 1) * 0x10))
> > +#define	MU3D_EP_RXCR1(epnum)	(U3D_RX1CSR1 + (((epnum) - 1) * 0x10))
> > +#define	MU3D_EP_RXCR2(epnum)	(U3D_RX1CSR2 + (((epnum) - 1) * 0x10))
> 
> #define[space] please, use consistently.
Will fix it

Thanks
> 
> > +#define USB_QMU_RQCSR(epnum)	(U3D_RXQCSR1 + (((epnum) - 1) * 0x10))
> > +#define USB_QMU_RQSAR(epnum)	(U3D_RXQSAR1 + (((epnum) - 1) * 0x10))
> > +#define USB_QMU_RQCPR(epnum)	(U3D_RXQCPR1 + (((epnum) - 1) * 0x10))
> 
> [...]