Add support MediaTek USB3 DRD driver
Subsystems (5)
Chunfeng Yun
maintainerv8 cover Add support MediaTek USB3 DRD driver
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
Signature · 1 line
2.18.0
Chunfeng Yun
maintainerPATCH v8 1/9 dt-binding: usb: add bindings for some common properties
Add bindings for common properties, include maximum-speed, dr_mode and phy_type
---
v8: add Reviewed-by Bin
v2~v7: no changes
--- doc/device-tree-bindings/usb/generic.txt | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 doc/device-tree-bindings/usb/generic.txt
doc/device-tree-bindings/usb/generic.txt new file +31 -0
@@ -0,0 +1,31 @@ +Generic USB Properties + +Optional properties: + - maximum-speed: tells USB controllers we want to work up to a certain + speed. Valid arguments are "super-speed-plus", + "super-speed", "high-speed", "full-speed" and + "low-speed". In case this isn't passed via DT, USB + controllers should default to their maximum HW + capability. + - dr_mode: tells Dual-Role USB controllers that we want to work on a + particular mode. Valid arguments are "host", + "peripheral" and "otg". In case this attribute isn't + passed via DT, USB DRD controllers should default to + OTG. + - phy_type: tells USB controllers that we want to configure the core to support + a UTMI+ PHY with an 8- or 16-bit interface if UTMI+ is + selected. Valid arguments are "utmi" and "utmi_wide". + In case this isn't passed via DT, USB controllers should + default to HW capability. + +This is an attribute to a USB controller such as: + +dwc3 at 4a030000 { + compatible = "synopsys,dwc3"; + reg = <0x4a030000 0xcfff>; + interrupts = <0 92 4> + usb-phy = <&usb2_phy>, <&usb3,phy>; + maximum-speed = "super-speed"; + dr_mode = "otg"; + phy_type = "utmi_wide"; +};
Signature · 1 line
2.18.0
Chunfeng Yun
maintainerPATCH v8 2/9 dt-bindings: usb: mtu3: add bindings for MediaTek USB3 DRD
In reply to Chunfeng YunAdd dt-binding for MediaTek USB3 DRD Driver which it's ported from the Linux kernel DTS binding:Documentation/devicetree/bindings/usb/mediatek,mtu3.txt Commit ID:34d0545978b6 ("dt-bindings: usb: mtu3: fix typo of DMA clock name")
Due to Dual-Role switch is not supported in Uboot, some properties are removed or changed.
---
v8: add commit ID the binding referenced suggested by Bin
v5~v7: no changes
v4: Add support host mode, introduce some new properties and subnode
v2~v3: no changes
--- .../usb/mediatek,mtu3.txt | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 doc/device-tree-bindings/usb/mediatek,mtu3.txt
doc/device-tree-bindings/usb/mediatek,mtu3.txt new file +79 -0
@@ -0,0 +1,79 @@ +The device node for Mediatek USB3 DRD controller + +Required properties: + - compatible : should be "mediatek,<soc-model>-mtu3", "mediatek,mtu3", + soc-model is the name of SoC, such as mt8512 etc, + when using "mediatek,mtu3" compatible string, you need SoC specific + ones in addition, one of: + - "mediatek,mt8512-mtu3" + - reg : specifies physical base address and size of the registers + - reg-names: should be + - "ippc" : IP Port Control + - power-domains : a phandle to USB power domain node to control USB's MTCMOS + - clocks : a list of phandle + clock-specifier pairs, one for each + entry in clock-names + - clock-names : must contain "sys_ck" for clock of controller, + the following clocks are optional: + "ref_ck", "mcu_ck", "dma_ck" and "xhci_ck"; + - phys : list of all the USB PHYs on this HCD + - #address-cells, #size-cells : used for sub-nodes with 'reg' property + - ranges : allows valid 1:1 translation between child's address space and + parent's address space + +Optional properties: + - vusb33-supply : regulator of USB AVDD3.3v + - vbus-supply : regulator of VBUS 5v, needed when supports host mode. + +Sub-nodes: +Required properties: + - compatible : should be "mediatek,ssusb" + - reg : specifies physical base address and size of the registers + - reg-names: should be + - "mac" : SSUSB MAC, include xHCI and device + - interrupts : interrupt used by xHCI or device + - dr_mode : should be one of "host" or "peripheral", + see : usb/generic.txt + +Optional properties: + - pinctrl-names : a pinctrl state named "default" is optional + - pinctrl-0 : pin control group + See: pinctrl/pinctrl-bindings.txt + + - device mode: + - maximum-speed : valid arguments are "full-speed", "high-speed", + "super-speed" and "super-speed-plus", + see: usb/generic.txt + - mediatek,force-vbus : force vbus as valid by SW + + - host mode (dr_mode is "host"): + - mediatek,u3p-dis-msk : mask to disable u3ports, bit0 for u3port0, + bit1 for u3port1, ... etc; + +Example: +usb3: usb at 11213e00 { + compatible = "mediatek,mt8512-mtu3", "mediatek,mtu3"; + reg = <0x11213e00 0x0100>; + reg-names = "ippc"; + phys = <&u2port0 PHY_TYPE_USB2>, <&u2port1 PHY_TYPE_USB2>; + power-domains = <&scpsys MT8512_POWER_DOMAIN_USB>; + clocks = <&infracfg CLK_INFRA_USB_SYS>, + <&topckgen CLK_TOP_SSUSB_TOP_CK_EN>, + <&infracfg CLK_INFRA_ICUSB>; + clock-names = "sys_ck", "ref_ck", "mcu_ck"; + vusb33-supply = <reg_3p3v>; + vbus-supply = <&usb_p0_vbus>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + status = "disabled"; + + ssusb: usb at 11210000 { + compatible = "mediatek,ssusb"; + reg = <0x11210000 0x3e00>; + interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_LOW>; + reg-names = "mac"; + dr_mode = "peripheral"; + maximum-speed = "high-speed"; + status = "disabled"; + }; +};
Signature · 1 line
2.18.0
PATCH v8 2/9 dt-bindings: usb: mtu3: add bindings for MediaTek USB3 DRD
Quoted 2 lines · Chunfeng Yun
Add dt-binding for MediaTek USB3 DRD Driver which it's ported
which is
Quoted 14 lines
from the Linux kernel DTS binding:
Documentation/devicetree/bindings/usb/mediatek,mtu3.txtCommit ID:34d0545978b6("dt-bindings: usb: mtu3: fix typo of DMA clock name")Due to Dual-Role switch is not supported in Uboot, some properties are removed or changed.
Signed-off-by Chunfeng Yun <[email protected]>---
v8: add commit ID the binding referenced suggested by Binv5~v7: no changes
Quoted 8 lines
v4: Add support host mode, introduce some new properties and subnode
v2~v3: no changes
--- .../usb/mediatek,mtu3.txt | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 doc/device-tree-bindings/usb/mediatek,mtu3.txt
Chunfeng Yun
maintainerPATCH v8 3/9 usb: add USB_SPEED_SUPER_PLUS
In reply to Chunfeng YunAdd enum USB_SPEED_SUPER_PLUS for USB3.1
---
v8: add Reviewed-by Bin
v5~v7: no changes
v4: also add it into speed_names array
v2~v3: no changes
--- drivers/usb/common/common.c | 1 + include/linux/usb/ch9.h | 1 + 2 files changed, 2 insertions(+)
drivers/usb/common/common.c +1 -0
@@ -46,6 +46,7 @@ static const char *const speed_names[] = { [USB_SPEED_HIGH] = "high-speed", [USB_SPEED_WIRELESS] = "wireless", [USB_SPEED_SUPER] = "super-speed", + [USB_SPEED_SUPER_PLUS] = "super-speed-plus", };enum usb_device_speed usb_get_maximum_speed (ofnode node)
include/linux/usb/ch9.h +1 -0
@@ -956,6 +956,7 @@ enum usb_device_speed {USB_SPEED_HIGH ,/* usb 2.0 */ USB_SPEED_WIRELESS ,/* wireless (usb 2.5) */ USB_SPEED_SUPER ,/* usb 3.0 */ + USB_SPEED_SUPER_PLUS, /* usb 3.1 */ };#ifdef __KERNEL__
Signature · 1 line
2.18.0
Chunfeng Yun
maintainerPATCH v8 4/9 usb: common: add define of usb_speed_string()
In reply to Chunfeng YunThere is only declaration of usb_speed_string(), but no definition, so add it to avoid build error when call it.
---
v8: add Reviewed-by Bin
v7: no changes
v6: modify commit message suggested by Roger
v5: no changes
v4: new patch
--- drivers/usb/common/common.c | 7 +++++++ include/linux/usb/ch9.h | 4 ---- 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/usb/common/common.c +7 -0
@@ -49,6 +49,13 @@ static const char *const speed_names[] = { [USB_SPEED_SUPER_PLUS] = "super-speed-plus", }; +const char *usb_speed_string (enum usb_device_speed speed) +{ +if (speed <0 || speed >=ARRAY_SIZE (speed_names)) + speed =USB_SPEED_UNKNOWN ; +return speed_names[speed]; +} +enum usb_device_speed usb_get_maximum_speed (ofnode node) {const char *max_speed;
include/linux/usb/ch9.h +0 -4
@@ -959,8 +959,6 @@ enum usb_device_speed { USB_SPEED_SUPER_PLUS, /* usb 3.1 */ }; -#ifdef __KERNEL__ -/** * usb_speed_string() - Returns human readable-name of the speed. * @speed: The speed to return human-readable name for. If it's not
@@ -969,8 +967,6 @@ enum usb_device_speed {*/ extern const char *usb_speed_string (enum usb_device_speed speed); -#endif -enum usb_device_state {/* NOTATTACHED isn't in the USB spec, and this state acts * the same as ATTACHED ... but it's clearer this way.
Signature · 1 line
2.18.0
Chunfeng Yun
maintainerPATCH v8 5/9 usb: add MediaTek USB3 DRD driver
In reply to Chunfeng YunThis patch adds support for the MediaTek USB3 DRD controller, its host side is based on xHCI, this driver supports device mode and host mode.
---
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
@@ -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
@@ -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
@@ -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
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.
PATCH v8 5/9 usb: add MediaTek USB3 DRD driver
Quoted 46 lines · Chunfeng Yun
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 <[email protected]>---
v8: SimplifyKconfigsuggested by Binv7: use xhci quirk flag
XHCI_MTK_HOSTv6: no changes
v5: change condition of
readl_poll_timeout()when check clocksv4:
1. remove unused member @busy and @wedged, use their flags instead
2. supportforce_vbusmode
3. add a glue driver usingUCLASS_NOP
4. add host driver, and rebuild host flowv3 changes
1. add ->udc_set_speed()
2. simplify some code flowv2: 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
Quoted 9 lines
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
PATCH v8 5/9 usb: add MediaTek USB3 DRD driver
In reply to Chunfeng YunQuoted 3 lines · Chunfeng Yun
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.
[...]
drivers/usb/mtu3/mtu3.h line 40
Quoted 7 lines
drivers/usb/mtu3/mtu3.h new file +7
-0+#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.
Quoted 3 lines
drivers/usb/mtu3/mtu3.h new file +3
-0+#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
maintainerPATCH v8 5/9 usb: add MediaTek USB3 DRD driver
Quoted 8 lines · Marek Vasut
Quoted 3 lines · Chunfeng Yun
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
Quoted 12 lines
[...]
drivers/usb/mtu3/mtu3.h line 40
Quoted 7 lines
drivers/usb/mtu3/mtu3.h new file +7
-0+#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
Quoted 6 lines
Quoted 4 lines
drivers/usb/mtu3/mtu3.h new file +3
-0+#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
maintainerPATCH v8 6/9 usb: gadget: Add bcdDevice for the MTU3 USB Gadget Controller
In reply to Chunfeng YunAdd an entry in usb_gadget_controller_number() for the MTU3 gadget controller. It is used to bind the USB Ethernet driver.
---
v8: add Reviewed-by Bin
v4~v7: no changes
v3: new patch
--- drivers/usb/gadget/gadget_chips.h | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/usb/gadget/gadget_chips.h +8 -0
@@ -161,6 +161,12 @@#define gadget_is_max3420 (g) 0#endif +#ifdef CONFIG_USB_MTU3_GADGET +#define gadget_is_mtu3 (g) (!strcmp("mtu3-gadget", (g)->name)) +#else +#define gadget_is_mtu3 (g) 0 +#endif +/** * usb_gadget_controller_number - support bcdDevice id convention * @gadget: the controller being driven
@@ -224,5 +230,7 @@ static inline int usb_gadget_controller_number(struct usb_gadget *gadget)return 0x24 ; else if (gadget_is_max3420(gadget)) return 0x25; + else if (gadget_is_mtu3(gadget)) + return 0x26;return -ENOENT ; }
Signature · 1 line
2.18.0
Chunfeng Yun
maintainerPATCH v8 7/9 arm: dts: mt8512: add usb related nodes
In reply to Chunfeng YunAdd usb, usb phy, and fixed regulators nodes
---
v8: add Acked-by Bin
v5~v7: no changes
v4: add host related properties, add subnode.
v3: remove unused property mediatek,discth
v2: no changes
--- arch/arm/dts/mt8512-bm1-emmc.dts | 34 ++++++++++++++++++++++ arch/arm/dts/mt8512.dtsi | 49 +++++++++++++++++++++++++++++++- 2 files changed, 82 insertions(+), 1 deletion(-)
arch/arm/dts/mt8512-bm1-emmc.dts +34 -0
@@ -43,6 +43,25 @@ regulator-boot-on; regulator-always-on; }; + + usb_p0_vbus: regulator at 0 { + compatible = "regulator-fixed"; + regulator-name = "p0_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio 27 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + usb_p1_vbus: regulator at 1 { + compatible = "regulator-fixed"; + regulator-name = "p1_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio 32 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-always-on; + }; }; &mmc0 {
@@ -95,6 +114,21 @@ }; }; +&ssusb { + dr_mode = "peripheral"; + maximum-speed = "high-speed"; + status = "okay"; +}; + +&usb3 { + vbus-supply = <&usb_p0_vbus>; + status = "okay"; +}; + +&u3phy { + status = "okay"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pins>;
arch/arm/dts/mt8512.dtsi +48 -1
65 lines not on this page · raw message
Signature · 1 line
2.18.0
Chunfeng Yun
maintainerPATCH v8 8/9 configs: mt8512: enable fastboot and USB host related configs
In reply to Chunfeng YunEnable mtu3, xhci, tphy drivers.
Device mode: enable fastboot;
Host mode: enable USB, FAT commands, and fixed regulator, mass storage drivers;
Due to device mode is enabled by default, comment out the host mode config here.
---
v8 changes:
1. add CONFIG_USB_XHCI_HCD due to Kconfig changes
2. modify comment of CONFIG_USB_MTU3_HOST suggested by Bin
3. merge [v7 8/10] add [v7 9/10] suggested by Bin
v2~v7: no changes
--- configs/mt8512_bm1_emmc_defconfig | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
configs/mt8512_bm1_emmc_defconfig +26 -0
@@ -9,11 +9,16 @@ CONFIG_DM_GPIO=y CONFIG_TARGET_MT8512=y CONFIG_DEFAULT_DEVICE_TREE="mt8512-bm1-emmc" CONFIG_FIT=y +CONFIG_EFI_PARTITION=y CONFIG_FIT_SIGNATURE=y CONFIG_DEFAULT_FDT_FILE="mt8512-bm1-emmc.dtb" CONFIG_SYS_PROMPT="MT8512> " CONFIG_CMD_BOOTMENU=y CONFIG_CMD_MMC=y +CONFIG_CMD_USB=y +CONFIG_CMD_FAT=y +CONFIG_CMD_FS_GENERIC=y +# CONFIG_DOS_PARTITION is not set CONFIG_ENV_OVERWRITE=y CONFIG_REGMAP=y CONFIG_SYSCON=y
@@ -26,6 +31,16 @@ CONFIG_PINCONF=y CONFIG_PINCTRL_MT8512=y CONFIG_RAM=y CONFIG_BAUDRATE=921600 +CONFIG_USB_FUNCTION_FASTBOOT=y +CONFIG_FASTBOOT_BUF_ADDR=0x56000000 +CONFIG_FASTBOOT_BUF_SIZE=0x1e00000 +CONFIG_FASTBOOT_FLASH=y +CONFIG_FASTBOOT_FLASH_MMC_DEV=0 +CONFIG_FASTBOOT_MMC_BOOT1_SUPPORT=y +CONFIG_PHY=y +CONFIG_PHY_MTK_TPHY=y +CONFIG_DM_REGULATOR=y +CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_SERIAL=y CONFIG_MTK_SERIAL=y CONFIG_TIMER=y
@@ -33,3 +48,14 @@ CONFIG_MTK_TIMER=y CONFIG_WDT=y CONFIG_WDT_MTK=y CONFIG_LZO=y +CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_DM_USB_GADGET=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_MTU3=y +# CONFIG_USB_MTU3_HOST is not set +CONFIG_USB_STORAGE=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_MANUFACTURER="MediaTek" +CONFIG_USB_GADGET_VENDOR_NUM=0x0e8d +CONFIG_USB_GADGET_PRODUCT_NUM=0x201c
Signature · 1 line
2.18.0
PATCH v8 8/9 configs: mt8512: enable fastboot and USB host related configs
Quoted 15 lines · Chunfeng Yun
Enable mtu3, xhci, tphy drivers.
Device mode: enable fastboot;
Host mode: enable USB, FAT commands, and fixed regulator, mass storage drivers;
Due to device mode is enabled by default, comment out the host mode config here.Signed-off-by Chunfeng Yun <[email protected]>---
v8 changes:
1. addCONFIG_USB_XHCI_HCDdue toKconfigchanges
2. modify comment ofCONFIG_USB_MTU3_HOSTsuggested by Bin
3. merge [v7 8/10] add [v7 9/10] suggested by Bin
Quoted 5 lines
v2~v7: no changes
--- configs/mt8512_bm1_emmc_defconfig | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
Chunfeng Yun
maintainerPATCH v8 8/9 configs: mt8512: enable fastboot and USB host related configs
Hi Bin,
Thank you again
Quoted 23 lines · Bin Meng
Quoted 15 lines · Chunfeng Yun
Enable mtu3, xhci, tphy drivers.
Device mode: enable fastboot;
Host mode: enable USB, FAT commands, and fixed regulator, mass storage drivers;
Due to device mode is enabled by default, comment out the host mode config here.Signed-off-by Chunfeng Yun <[email protected]>---
v8 changes:
1. addCONFIG_USB_XHCI_HCDdue toKconfigchanges
2. modify comment ofCONFIG_USB_MTU3_HOSTsuggested by Bin
3. merge [v7 8/10] add [v7 9/10] suggested by BinQuoted 5 lines
v2~v7: no changes
--- configs/mt8512_bm1_emmc_defconfig | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)Reviewed-by Bin Meng <[email protected]>
Chunfeng Yun
maintainerPATCH v8 9/9 MAINTAINERS: add USB driver to ARM MEDIATEK
In reply to Chunfeng YunAdd MediaTek USB3 Dual-Role controller driver to ARM MEDIATEK, and add myself as a maintainer for it.
---
v8: add Reviewed-by Bin
v6~v7: no changes
v5: add mtu3/, xhci-mtk.c, and myself as maintainer for MTK USB
v4: new patch
--- MAINTAINERS | 3 +++ 1 file changed, 3 insertions(+)
MAINTAINERS +3 -0
@@ -266,6 +266,7 @@ F: arch/arm/include/asm/arch-pxa/ ARM MEDIATEK M: Ryder Lee <[email protected]> M: Weijie Gao <[email protected]> +M: Chunfeng Yun <[email protected]> R: GSS_MTK_Uboot_upstream <[email protected]> S: Maintained F: arch/arm/mach-mediatek/
@@ -282,6 +283,8 @@ F: drivers/power/domain/mtk-power-domain.c F: drivers/ram/mediatek/ F: drivers/spi/mtk_snfi_spi.c F: drivers/timer/mtk_timer.c +F: drivers/usb/host/xhci-mtk.c +F: drivers/usb/mtu3/ F: drivers/watchdog/mtk_wdt.c F: drivers/net/mtk_eth.c F: drivers/reset/reset-mediatek.c
Signature · 1 line
2.18.0