* Add MediaTek USB3 DRD Driver
@ 2016-06-10 7:32 Chunfeng Yun
2016-06-10 7:32 ` [PATCH v3, 1/5] dt-bindings: mt8173-xhci: support host side of dual-role mode Chunfeng Yun
` (6 more replies)
0 siblings, 7 replies; 15+ messages in thread
From: Chunfeng Yun @ 2016-06-10 7:32 UTC (permalink / raw)
To: linux-arm-kernel
>From 8fdc924cecf0ca14da6e8aba360501e53437e548 Mon Sep 17 00:00:00 2001
From: Chunfeng Yun <chunfeng.yun@mediatek.com>
Date: Fri, 10 Jun 2016 15:20:20 +0800
Subject: [PATCH 0/5] Add MediaTek USB3 DRD Driver
These patches introduce the MediaTek USB3 dual-role controller
driver.
The driver can be configured as Dual-Role Device (DRD),
Peripheral Only and Host Only (xHCI) modes. It works well
with Mass Storage, RNDIS and g_zero on FS/HS and SS. And it is
tested on MT8173 platform which only contains USB2.0 device IP,
and on MT6290 platform which contains USB3.0 device IP.
Change in v3:
1. fix some typo error
2. rename mtu3.txt to mt8173-mtu3.txt
Change in v2:
1. modify binding docs according to suggestions
2. modify some comments and remove some dummy blank lines
3. fix memory leakage
Chunfeng Yun (5):
dt-bindings: mt8173-xhci: support host side of dual-role mode
dt-bindings: mt8173-mtu3: add devicetree bindings
usb: xhci-mtk: make IPPC register optional
usb: Add MediaTek USB3 DRD Driver
arm64: dts: mediatek: add USB3 DRD driver
.../devicetree/bindings/usb/mt8173-mtu3.txt | 85 ++
.../devicetree/bindings/usb/mt8173-xhci.txt | 48 ++
arch/arm64/boot/dts/mediatek/mt8173-evb.dts | 46 +-
arch/arm64/boot/dts/mediatek/mt8173.dtsi | 28 +-
drivers/usb/Kconfig | 2 +
drivers/usb/Makefile | 1 +
drivers/usb/host/xhci-mtk.c | 32 +-
drivers/usb/mtu3/Kconfig | 47 ++
drivers/usb/mtu3/Makefile | 20 +
drivers/usb/mtu3/mtu3.h | 422 ++++++++++
drivers/usb/mtu3/mtu3_core.c | 879 ++++++++++++++++++++
drivers/usb/mtu3/mtu3_dr.c | 348 ++++++++
drivers/usb/mtu3/mtu3_dr.h | 108 +++
drivers/usb/mtu3/mtu3_gadget.c | 731 ++++++++++++++++
drivers/usb/mtu3/mtu3_gadget_ep0.c | 879 ++++++++++++++++++++
drivers/usb/mtu3/mtu3_host.c | 294 +++++++
drivers/usb/mtu3/mtu3_hw_regs.h | 474 +++++++++++
drivers/usb/mtu3/mtu3_plat.c | 490 +++++++++++
drivers/usb/mtu3/mtu3_qmu.c | 599 +++++++++++++
drivers/usb/mtu3/mtu3_qmu.h | 43 +
20 files changed, 5562 insertions(+), 14 deletions(-)
create mode 100644 Documentation/devicetree/bindings/usb/mt8173-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.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
--
1.7.9.5
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3, 1/5] dt-bindings: mt8173-xhci: support host side of dual-role mode
2016-06-10 7:32 Add MediaTek USB3 DRD Driver Chunfeng Yun
@ 2016-06-10 7:32 ` Chunfeng Yun
2016-06-13 18:54 ` [PATCH v3,1/5] " Rob Herring
2016-06-10 7:32 ` [PATCH v3,2/5] dt-bindings: mt8173-mtu3: add devicetree bindings Chunfeng Yun
` (5 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Chunfeng Yun @ 2016-06-10 7:32 UTC (permalink / raw)
To: linux-arm-kernel
Some resources, such as IPPC register etc, shared with device
driver are moved into common glue layer when xHCI driver is the
host side of dual-role mode and they should be changed as optional
properties if they are required ones before. For clarity, add
a new part of binding to support host side of dual-role mode.
Additionally add optional properties of pinctrl for host only mode
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
.../devicetree/bindings/usb/mt8173-xhci.txt | 48 ++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/Documentation/devicetree/bindings/usb/mt8173-xhci.txt b/Documentation/devicetree/bindings/usb/mt8173-xhci.txt
index b3a7ffa..bec2dff 100644
--- a/Documentation/devicetree/bindings/usb/mt8173-xhci.txt
+++ b/Documentation/devicetree/bindings/usb/mt8173-xhci.txt
@@ -2,6 +2,14 @@ MT8173 xHCI
The device node for Mediatek SOC USB3.0 host controller
+There are two scenarios: the first one only supports xHCI driver;
+the second one supports dual-role mode, and the host is based on xHCI
+driver. Take account of backward compatibility, we divide bindings
+into two parts.
+
+1st: only supports xHCI driver
+------------------------------------------------------------------------
+
Required properties:
- compatible : should contain "mediatek,mt8173-xhci"
- reg : specifies physical base address and size of the registers,
@@ -27,6 +35,9 @@ Optional properties:
control register, it depends on "mediatek,wakeup-src".
- vbus-supply : reference to the VBUS regulator;
- usb3-lpm-capable : supports USB3.0 LPM
+ - pinctrl-names : a pinctrl state named "default" must be defined
+ - pinctrl-0 : pin control group
+ See: Documentation/devicetree/bindings/pinctrl/pinctrl-binding.txt
Example:
usb30: usb at 11270000 {
@@ -49,3 +60,40 @@ usb30: usb at 11270000 {
mediatek,syscon-wakeup = <&pericfg>;
mediatek,wakeup-src = <1>;
};
+
+2nd: dual-role mode with xHCI driver
+------------------------------------------------------------------------
+
+In the case, xhci is added as subnode to mtu3. An example and the DT binding
+details of mtu3 can be found in:
+Documentation/devicetree/bindings/usb/mtu3.txt
+
+Required properties:
+ - compatible : should contain "mediatek,mt8173-xhci"
+ - reg : specifies physical base address and size of the registers,
+ should be only for xHCI IP registers
+ - interrupts : interrupt used by the host controller
+ - power-domains : a phandle to USB power domain node to control USB's
+ mtcmos
+ - vusb33-supply : regulator of USB avdd3.3v
+
+ - clocks : a list of phandle + clock-specifier pairs, one for each
+ entry in clock-names
+ - clock-names : must be
+ "sys_ck": for clock of xHCI MAC
+
+Optional properties:
+ - vbus-supply : reference to the VBUS regulator;
+ - usb3-lpm-capable : supports USB3.0 LPM
+
+Example:
+usb30: usb at 11270000 {
+ compatible = "mediatek,mt8173-xhci";
+ reg = <0 0x11270000 0 0x1000>;
+ interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_LOW>;
+ power-domains = <&scpsys MT8173_POWER_DOMAIN_USB>;
+ clocks = <&topckgen CLK_TOP_USB30_SEL>;
+ clock-names = "sys_ck";
+ vusb33-supply = <&mt6397_vusb_reg>;
+ usb3-lpm-capable;
+};
--
1.7.9.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3,2/5] dt-bindings: mt8173-mtu3: add devicetree bindings
2016-06-10 7:32 Add MediaTek USB3 DRD Driver Chunfeng Yun
2016-06-10 7:32 ` [PATCH v3, 1/5] dt-bindings: mt8173-xhci: support host side of dual-role mode Chunfeng Yun
@ 2016-06-10 7:32 ` Chunfeng Yun
2016-06-10 9:21 ` Felipe Balbi
2016-06-10 7:32 ` [PATCH v3,3/5] usb: xhci-mtk: make IPPC register optional Chunfeng Yun
` (4 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Chunfeng Yun @ 2016-06-10 7:32 UTC (permalink / raw)
To: linux-arm-kernel
add a DT binding doc for MediaTek USB3 DRD driver
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
.../devicetree/bindings/usb/mt8173-mtu3.txt | 85 ++++++++++++++++++++
1 file changed, 85 insertions(+)
create mode 100644 Documentation/devicetree/bindings/usb/mt8173-mtu3.txt
diff --git a/Documentation/devicetree/bindings/usb/mt8173-mtu3.txt b/Documentation/devicetree/bindings/usb/mt8173-mtu3.txt
new file mode 100644
index 0000000..571ae8b
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/mt8173-mtu3.txt
@@ -0,0 +1,85 @@
+The device node for Mediatek USB3.0 DRD controller
+
+Required properties:
+ - compatible : should be "mediatek,mt8173-mtu3"
+ - reg : specifies physical base address and size of the registers
+ - reg-names: should be "mac" for device IP and "ippc" for IP port control
+ - interrupts : interrupt used by the device IP
+ - power-domains : a phandle to USB power domain node to control USB's
+ mtcmos
+ - vusb33-supply : regulator of USB avdd3.3v
+ - 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;
+ "wakeup_deb_p0" and "wakeup_deb_p1" are optional, they are
+ depends on "mediatek,enable-wakeup"
+ - phys : a list of phandle + phy specifier pairs
+ - dr_mode : should be one of "host", "peripheral" or "otg",
+ refer to usb/generic.txt
+
+Optional properties:
+ - #address-cells, #size-cells : should be '2' if the device has sub-nodes
+ with 'reg' property
+ - ranges : allows valid 1:1 translation between child's address space and
+ parent's address space
+ - extcon : external connector for vbus and idpin changes detection, needed
+ when supports dual-role mode.
+ - vbus-supply : reference to the VBUS regulator, needed when supports
+ dual-role mode.
+ - pinctl-names : a pinctrl state named "default" must be defined,
+ "id_float" and "id_ground" are optinal which depends on
+ "mediatek,enable-manual-drd"
+ - pinctrl-0 : pin control group
+ See: Documentation/devicetree/bindings/pinctrl/pinctrl-binding.txt
+
+ - maximum-speed : valid arguments are "super-speed", "high-speed" and
+ "full-speed"; refer to usb/generic.txt
+ - enable-manual-drd : supports manual dual-role switch via sysfs; only used
+ when receptacle is TYPE-A and also wants to support dual-role mode.
+ - mediatek,enable-wakeup : supports ip sleep wakeup used by host mode
+ - mediatek,syscon-wakeup : phandle to syscon used to access USB wakeup
+ control register, it depends on "mediatek,enable-wakeup".
+
+Sub-nodes:
+The xhci should be added as subnode to mtu3 as shown in the following example
+if host mode is enabled. The DT binding details of xhci can be found in:
+Documentation/devicetree/bindings/usb/mt8173-xhci.txt
+
+Example:
+ssusb: usb at 11271000 {
+ compatible = "mediatek,mt8173-mtu3";
+ reg = <0 0x11271000 0 0x3000>,
+ <0 0x11280700 0 0x0100>;
+ reg-names = "mac", "ippc";
+ interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_LOW>;
+ phys = <&phy_port0 PHY_TYPE_USB3>,
+ <&phy_port1 PHY_TYPE_USB2>;
+ power-domains = <&scpsys MT8173_POWER_DOMAIN_USB>;
+ clocks = <&topckgen CLK_TOP_USB30_SEL>,
+ <&pericfg CLK_PERI_USB0>,
+ <&pericfg CLK_PERI_USB1>;
+ clock-names = "sys_ck",
+ "wakeup_deb_p0",
+ "wakeup_deb_p1";
+ vusb33-supply = <&mt6397_vusb_reg>;
+ vbus-supply = <&usb_p0_vbus>;
+ extcon = <&extcon_usb>;
+ dr_mode = "otg";
+ mediatek,enable-wakeup;
+ mediatek,syscon-wakeup = <&pericfg>;
+ #address-cells = <2>;
+ #size-cells = <2>;
+ ranges;
+ status = "disabled";
+
+ usb_host: xhci at 11270000 {
+ compatible = "mediatek,mt8173-xhci";
+ reg = <0 0x11270000 0 0x1000>;
+ interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_LOW>;
+ power-domains = <&scpsys MT8173_POWER_DOMAIN_USB>;
+ clocks = <&topckgen CLK_TOP_USB30_SEL>;
+ clock-names = "sys_ck";
+ vusb33-supply = <&mt6397_vusb_reg>;
+ status = "disabled";
+ };
+};
--
1.7.9.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3,3/5] usb: xhci-mtk: make IPPC register optional
2016-06-10 7:32 Add MediaTek USB3 DRD Driver Chunfeng Yun
2016-06-10 7:32 ` [PATCH v3, 1/5] dt-bindings: mt8173-xhci: support host side of dual-role mode Chunfeng Yun
2016-06-10 7:32 ` [PATCH v3,2/5] dt-bindings: mt8173-mtu3: add devicetree bindings Chunfeng Yun
@ 2016-06-10 7:32 ` Chunfeng Yun
2016-06-10 7:32 ` [PATCH v3,5/5] arm64: dts: mediatek: add USB3 DRD driver Chunfeng Yun
` (3 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: Chunfeng Yun @ 2016-06-10 7:32 UTC (permalink / raw)
To: linux-arm-kernel
Make IPPC register optional to support host side of dual-role mode,
due to it is moved into common glue layer for simplification.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
drivers/usb/host/xhci-mtk.c | 32 +++++++++++++++++++++++++++-----
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index 79959f1..dc86832 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -94,6 +94,9 @@ static int xhci_mtk_host_enable(struct xhci_hcd_mtk *mtk)
int ret;
int i;
+ if (ippc == NULL)
+ return 0;
+
/* power on host ip */
value = readl(&ippc->ip_pw_ctr1);
value &= ~CTRL1_IP_HOST_PDN;
@@ -139,6 +142,9 @@ static int xhci_mtk_host_disable(struct xhci_hcd_mtk *mtk)
int ret;
int i;
+ if (ippc == NULL)
+ return 0;
+
/* power down all u3 ports */
for (i = 0; i < mtk->num_u3_ports; i++) {
value = readl(&ippc->u3_ctrl_p[i]);
@@ -173,6 +179,9 @@ static int xhci_mtk_ssusb_config(struct xhci_hcd_mtk *mtk)
struct mu3c_ippc_regs __iomem *ippc = mtk->ippc_regs;
u32 value;
+ if (ippc == NULL)
+ return 0;
+
/* reset whole ip */
value = readl(&ippc->ip_pw_ctr0);
value |= CTRL0_IP_SW_RST;
@@ -475,6 +484,7 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci)
/* called during probe() after chip reset completes */
static int xhci_mtk_setup(struct usb_hcd *hcd)
{
+ struct xhci_hcd *xhci = hcd_to_xhci(hcd);
struct xhci_hcd_mtk *mtk = hcd_to_mtk(hcd);
int ret;
@@ -482,12 +492,21 @@ static int xhci_mtk_setup(struct usb_hcd *hcd)
ret = xhci_mtk_ssusb_config(mtk);
if (ret)
return ret;
+ }
+
+ ret = xhci_gen_setup(hcd, xhci_mtk_quirks);
+ if (ret)
+ return ret;
+
+ if (usb_hcd_is_primary_hcd(hcd)) {
+ mtk->num_u3_ports = xhci->num_usb3_ports;
+ mtk->num_u2_ports = xhci->num_usb2_ports;
ret = xhci_mtk_sch_init(mtk);
if (ret)
return ret;
}
- return xhci_gen_setup(hcd, xhci_mtk_quirks);
+ return ret;
}
static int xhci_mtk_probe(struct platform_device *pdev)
@@ -595,11 +614,14 @@ static int xhci_mtk_probe(struct platform_device *pdev)
hcd->rsrc_start = res->start;
hcd->rsrc_len = resource_size(res);
+ mtk->ippc_regs = NULL;
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- mtk->ippc_regs = devm_ioremap_resource(dev, res);
- if (IS_ERR(mtk->ippc_regs)) {
- ret = PTR_ERR(mtk->ippc_regs);
- goto put_usb2_hcd;
+ if (res) { /* ippc register is optional */
+ mtk->ippc_regs = devm_ioremap_resource(dev, res);
+ if (IS_ERR(mtk->ippc_regs)) {
+ ret = PTR_ERR(mtk->ippc_regs);
+ goto put_usb2_hcd;
+ }
}
for (phy_num = 0; phy_num < mtk->num_phys; phy_num++) {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3,5/5] arm64: dts: mediatek: add USB3 DRD driver
2016-06-10 7:32 Add MediaTek USB3 DRD Driver Chunfeng Yun
` (2 preceding siblings ...)
2016-06-10 7:32 ` [PATCH v3,3/5] usb: xhci-mtk: make IPPC register optional Chunfeng Yun
@ 2016-06-10 7:32 ` Chunfeng Yun
2016-06-10 9:15 ` Add MediaTek USB3 DRD Driver chunfeng yun
` (2 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: Chunfeng Yun @ 2016-06-10 7:32 UTC (permalink / raw)
To: linux-arm-kernel
USB3 DRD driver is added for MT8173-EVB, and xHCI driver
becomes its subnode
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
arch/arm64/boot/dts/mediatek/mt8173-evb.dts | 46 +++++++++++++++++++++++++--
arch/arm64/boot/dts/mediatek/mt8173.dtsi | 28 ++++++++++++----
2 files changed, 65 insertions(+), 9 deletions(-)
diff --git a/arch/arm64/boot/dts/mediatek/mt8173-evb.dts b/arch/arm64/boot/dts/mediatek/mt8173-evb.dts
index 7453a47..682dfd7 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173-evb.dts
+++ b/arch/arm64/boot/dts/mediatek/mt8173-evb.dts
@@ -34,6 +34,11 @@
chosen { };
+ extcon_usb: extcon_iddig {
+ compatible = "linux,extcon-usb-gpio";
+ id-gpio = <&pio 16 GPIO_ACTIVE_HIGH>;
+ };
+
usb_p1_vbus: regulator at 0 {
compatible = "regulator-fixed";
regulator-name = "usb_vbus";
@@ -42,6 +47,16 @@
gpio = <&pio 130 GPIO_ACTIVE_HIGH>;
enable-active-high;
};
+
+ usb_p0_vbus: regulator at 1 {
+ compatible = "regulator-fixed";
+ regulator-name = "vbus";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ gpio = <&pio 9 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ };
+
};
&i2c1 {
@@ -205,6 +220,20 @@
bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
};
};
+
+ usb_id_pins_float: usb_iddig_pull_up {
+ pins_iddig {
+ pinmux = <MT8173_PIN_16_IDDIG__FUNC_IDDIG>;
+ bias-pull-up;
+ };
+ };
+
+ usb_id_pins_ground: usb_iddig_pull_down {
+ pins_iddig {
+ pinmux = <MT8173_PIN_16_IDDIG__FUNC_IDDIG>;
+ bias-pull-down;
+ };
+ };
};
&pwm0 {
@@ -431,12 +460,25 @@
status = "okay";
};
+&ssusb {
+ vusb33-supply = <&mt6397_vusb_reg>;
+ vbus-supply = <&usb_p0_vbus>;
+ extcon = <&extcon_usb>;
+ dr_mode = "otg";
+ mediatek,enable-wakeup;
+ pinctrl-names = "default", "id_float", "id_ground";
+ pinctrl-0 = <&usb_id_pins_float>;
+ pinctrl-1 = <&usb_id_pins_float>;
+ pinctrl-2 = <&usb_id_pins_ground>;
+ status = "okay";
+};
+
&uart0 {
status = "okay";
};
-&usb30 {
+&usb_host {
vusb33-supply = <&mt6397_vusb_reg>;
vbus-supply = <&usb_p1_vbus>;
- mediatek,wakeup-src = <1>;
+ status = "okay";
};
diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index 05f89c4..723ab6e 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -608,11 +608,14 @@
status = "disabled";
};
- usb30: usb at 11270000 {
- compatible = "mediatek,mt8173-xhci";
- reg = <0 0x11270000 0 0x1000>,
+ ssusb: usb at 11271000 {
+ compatible = "mediatek,mt8173-mtu3";
+ reg = <0 0x11271000 0 0x3000>,
<0 0x11280700 0 0x0100>;
- interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_LOW>;
+ reg-names = "mac", "ippc";
+ interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_LOW>;
+ phys = <&phy_port0 PHY_TYPE_USB3>,
+ <&phy_port1 PHY_TYPE_USB2>;
power-domains = <&scpsys MT8173_POWER_DOMAIN_USB>;
clocks = <&topckgen CLK_TOP_USB30_SEL>,
<&pericfg CLK_PERI_USB0>,
@@ -620,10 +623,21 @@
clock-names = "sys_ck",
"wakeup_deb_p0",
"wakeup_deb_p1";
- phys = <&phy_port0 PHY_TYPE_USB3>,
- <&phy_port1 PHY_TYPE_USB2>;
mediatek,syscon-wakeup = <&pericfg>;
- status = "okay";
+ #address-cells = <2>;
+ #size-cells = <2>;
+ ranges;
+ status = "disabled";
+
+ usb_host: xhci at 11270000 {
+ compatible = "mediatek,mt8173-xhci";
+ reg = <0 0x11270000 0 0x1000>;
+ interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_LOW>;
+ power-domains = <&scpsys MT8173_POWER_DOMAIN_USB>;
+ clocks = <&topckgen CLK_TOP_USB30_SEL>;
+ clock-names = "sys_ck";
+ status = "disabled";
+ };
};
u3phy: usb-phy at 11290000 {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Add MediaTek USB3 DRD Driver
2016-06-10 7:32 Add MediaTek USB3 DRD Driver Chunfeng Yun
` (3 preceding siblings ...)
2016-06-10 7:32 ` [PATCH v3,5/5] arm64: dts: mediatek: add USB3 DRD driver Chunfeng Yun
@ 2016-06-10 9:15 ` chunfeng yun
2016-06-10 9:27 ` Felipe Balbi
[not found] ` <1465543962-11678-5-git-send-email-chunfeng.yun@mediatek.com>
6 siblings, 0 replies; 15+ messages in thread
From: chunfeng yun @ 2016-06-10 9:15 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On Fri, 2016-06-10 at 15:32 +0800, Chunfeng Yun wrote:
> From 8fdc924cecf0ca14da6e8aba360501e53437e548 Mon Sep 17 00:00:00 2001
> From: Chunfeng Yun <chunfeng.yun@mediatek.com>
> Date: Fri, 10 Jun 2016 15:20:20 +0800
> Subject: [PATCH 0/5] Add MediaTek USB3 DRD Driver
>
> These patches introduce the MediaTek USB3 dual-role controller
> driver.
>
> The driver can be configured as Dual-Role Device (DRD),
> Peripheral Only and Host Only (xHCI) modes. It works well
> with Mass Storage, RNDIS and g_zero on FS/HS and SS. And it is
> tested on MT8173 platform which only contains USB2.0 device IP,
> and on MT6290 platform which contains USB3.0 device IP.
>
> Change in v3:
> 1. fix some typo error
> 2. rename mtu3.txt to mt8173-mtu3.txt
>
> Change in v2:
> 1. modify binding docs according to suggestions
> 2. modify some comments and remove some dummy blank lines
> 3. fix memory leakage
>
> Chunfeng Yun (5):
> dt-bindings: mt8173-xhci: support host side of dual-role mode
> dt-bindings: mt8173-mtu3: add devicetree bindings
Could you please help me to review the following two patches based on
v4.7-rc1:
1- usb: xhci-mtk: make IPPC register optional
2- usb: Add MediaTek USB3 DRD Driver
Thank you very much
> usb: xhci-mtk: make IPPC register optional
> usb: Add MediaTek USB3 DRD Driver
> arm64: dts: mediatek: add USB3 DRD driver
>
> .../devicetree/bindings/usb/mt8173-mtu3.txt | 85 ++
> .../devicetree/bindings/usb/mt8173-xhci.txt | 48 ++
> arch/arm64/boot/dts/mediatek/mt8173-evb.dts | 46 +-
> arch/arm64/boot/dts/mediatek/mt8173.dtsi | 28 +-
> drivers/usb/Kconfig | 2 +
> drivers/usb/Makefile | 1 +
> drivers/usb/host/xhci-mtk.c | 32 +-
> drivers/usb/mtu3/Kconfig | 47 ++
> drivers/usb/mtu3/Makefile | 20 +
> drivers/usb/mtu3/mtu3.h | 422 ++++++++++
> drivers/usb/mtu3/mtu3_core.c | 879 ++++++++++++++++++++
> drivers/usb/mtu3/mtu3_dr.c | 348 ++++++++
> drivers/usb/mtu3/mtu3_dr.h | 108 +++
> drivers/usb/mtu3/mtu3_gadget.c | 731 ++++++++++++++++
> drivers/usb/mtu3/mtu3_gadget_ep0.c | 879 ++++++++++++++++++++
> drivers/usb/mtu3/mtu3_host.c | 294 +++++++
> drivers/usb/mtu3/mtu3_hw_regs.h | 474 +++++++++++
> drivers/usb/mtu3/mtu3_plat.c | 490 +++++++++++
> drivers/usb/mtu3/mtu3_qmu.c | 599 +++++++++++++
> drivers/usb/mtu3/mtu3_qmu.h | 43 +
> 20 files changed, 5562 insertions(+), 14 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/usb/mt8173-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.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
>
> --
> 1.7.9.5
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3,2/5] dt-bindings: mt8173-mtu3: add devicetree bindings
2016-06-10 7:32 ` [PATCH v3,2/5] dt-bindings: mt8173-mtu3: add devicetree bindings Chunfeng Yun
@ 2016-06-10 9:21 ` Felipe Balbi
2016-06-14 2:19 ` chunfeng yun
0 siblings, 1 reply; 15+ messages in thread
From: Felipe Balbi @ 2016-06-10 9:21 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
Chunfeng Yun <chunfeng.yun@mediatek.com> writes:
> + - enable-manual-drd : supports manual dual-role switch via sysfs; only used
> + when receptacle is TYPE-A and also wants to support dual-role mode.
sorry, but this manual-drd can't be accepted. You should rely on a DT
property for this and you shouldn't expose it to sysfs. Use DebugFS for
that.
--
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160610/ae48bff0/attachment.sig>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Add MediaTek USB3 DRD Driver
2016-06-10 7:32 Add MediaTek USB3 DRD Driver Chunfeng Yun
` (4 preceding siblings ...)
2016-06-10 9:15 ` Add MediaTek USB3 DRD Driver chunfeng yun
@ 2016-06-10 9:27 ` Felipe Balbi
[not found] ` <1465543962-11678-5-git-send-email-chunfeng.yun@mediatek.com>
6 siblings, 0 replies; 15+ messages in thread
From: Felipe Balbi @ 2016-06-10 9:27 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
Chunfeng Yun <chunfeng.yun@mediatek.com> writes:
> From 8fdc924cecf0ca14da6e8aba360501e53437e548 Mon Sep 17 00:00:00 2001
> From: Chunfeng Yun <chunfeng.yun@mediatek.com>
> Date: Fri, 10 Jun 2016 15:20:20 +0800
> Subject: [PATCH 0/5] Add MediaTek USB3 DRD Driver
>
> These patches introduce the MediaTek USB3 dual-role controller
> driver.
>
> The driver can be configured as Dual-Role Device (DRD),
> Peripheral Only and Host Only (xHCI) modes. It works well
> with Mass Storage, RNDIS and g_zero on FS/HS and SS. And it is
> tested on MT8173 platform which only contains USB2.0 device IP,
> and on MT6290 platform which contains USB3.0 device IP.
>
> Change in v3:
> 1. fix some typo error
> 2. rename mtu3.txt to mt8173-mtu3.txt
>
> Change in v2:
> 1. modify binding docs according to suggestions
> 2. modify some comments and remove some dummy blank lines
> 3. fix memory leakage
I don't see anything inherently wrong with this series. But keep in mind
I don't have HW to test. I can take the peripheral driver in a few days.
--
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160610/f4fc2408/attachment-0001.sig>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3,4/5] usb: Add MediaTek USB3 DRD Driver
[not found] ` <1465543962-11678-5-git-send-email-chunfeng.yun@mediatek.com>
@ 2016-06-11 21:08 ` kbuild test robot
2016-06-12 4:14 ` kbuild test robot
2016-08-08 13:10 ` Greg Kroah-Hartman
2 siblings, 0 replies; 15+ messages in thread
From: kbuild test robot @ 2016-06-11 21:08 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on v4.7-rc2 next-20160609]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Chunfeng-Yun/usb-Add-MediaTek-USB3-DRD-Driver/20160610-153559
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: blackfin-allmodconfig (attached as .config)
compiler: bfin-uclinux-gcc (GCC) 4.6.3
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=blackfin
All errors (new ones prefixed by >>):
drivers/usb/mtu3/mtu3_dr.c: In function 'ssusb_mode_sysfs_switch':
>> drivers/usb/mtu3/mtu3_dr.c:271:3: error: implicit declaration of function 'pinctrl_select_state' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
vim +/pinctrl_select_state +271 drivers/usb/mtu3/mtu3_dr.c
265 struct otg_switch_mtk *otg_sx = &ssusb->otg_switch;
266
267 if (!otg_sx->manual_drd_enabled)
268 return;
269
270 if (to_host)
> 271 pinctrl_select_state(otg_sx->id_pinctrl, otg_sx->id_ground);
272 else
273 pinctrl_select_state(otg_sx->id_pinctrl, otg_sx->id_float);
274 }
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 40649 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160612/bb680ca8/attachment-0001.obj>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3,4/5] usb: Add MediaTek USB3 DRD Driver
[not found] ` <1465543962-11678-5-git-send-email-chunfeng.yun@mediatek.com>
2016-06-11 21:08 ` [PATCH v3,4/5] usb: " kbuild test robot
@ 2016-06-12 4:14 ` kbuild test robot
2016-08-08 13:10 ` Greg Kroah-Hartman
2 siblings, 0 replies; 15+ messages in thread
From: kbuild test robot @ 2016-06-12 4:14 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on v4.7-rc2 next-20160609]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Chunfeng-Yun/usb-Add-MediaTek-USB3-DRD-Driver/20160610-153559
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: i386-randconfig-x011-06120748 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All error/warnings (new ones prefixed by >>):
warning: (USB_MTU3) selects USB_XHCI_MTK which has unmet direct dependencies (USB_SUPPORT && USB && USB_XHCI_HCD && (ARCH_MEDIATEK || COMPILE_TEST))
drivers/built-in.o: In function `mtu3_probe':
>> mtu3_plat.c:(.text+0x21471d): undefined reference to `extcon_get_edev_by_phandle'
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 27652 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160612/d55e8007/attachment-0001.obj>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3,1/5] dt-bindings: mt8173-xhci: support host side of dual-role mode
2016-06-10 7:32 ` [PATCH v3, 1/5] dt-bindings: mt8173-xhci: support host side of dual-role mode Chunfeng Yun
@ 2016-06-13 18:54 ` Rob Herring
2016-06-14 2:20 ` chunfeng yun
0 siblings, 1 reply; 15+ messages in thread
From: Rob Herring @ 2016-06-13 18:54 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Jun 10, 2016 at 03:32:38PM +0800, Chunfeng Yun wrote:
> Some resources, such as IPPC register etc, shared with device
> driver are moved into common glue layer when xHCI driver is the
> host side of dual-role mode and they should be changed as optional
> properties if they are required ones before. For clarity, add
> a new part of binding to support host side of dual-role mode.
>
> Additionally add optional properties of pinctrl for host only mode
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
> .../devicetree/bindings/usb/mt8173-xhci.txt | 48 ++++++++++++++++++++
> 1 file changed, 48 insertions(+)
Acked-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3,2/5] dt-bindings: mt8173-mtu3: add devicetree bindings
2016-06-10 9:21 ` Felipe Balbi
@ 2016-06-14 2:19 ` chunfeng yun
0 siblings, 0 replies; 15+ messages in thread
From: chunfeng yun @ 2016-06-14 2:19 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, 2016-06-10 at 12:21 +0300, Felipe Balbi wrote:
> Hi,
>
> Chunfeng Yun <chunfeng.yun@mediatek.com> writes:
> > + - enable-manual-drd : supports manual dual-role switch via sysfs; only used
> > + when receptacle is TYPE-A and also wants to support dual-role mode.
>
> sorry, but this manual-drd can't be accepted. You should rely on a DT
> property for this and you shouldn't expose it to sysfs. Use DebugFS for
> that.
I will make use of debugfs instead
Thanks a lot
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3,1/5] dt-bindings: mt8173-xhci: support host side of dual-role mode
2016-06-13 18:54 ` [PATCH v3,1/5] " Rob Herring
@ 2016-06-14 2:20 ` chunfeng yun
0 siblings, 0 replies; 15+ messages in thread
From: chunfeng yun @ 2016-06-14 2:20 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, 2016-06-13 at 13:54 -0500, Rob Herring wrote:
> On Fri, Jun 10, 2016 at 03:32:38PM +0800, Chunfeng Yun wrote:
> > Some resources, such as IPPC register etc, shared with device
> > driver are moved into common glue layer when xHCI driver is the
> > host side of dual-role mode and they should be changed as optional
> > properties if they are required ones before. For clarity, add
> > a new part of binding to support host side of dual-role mode.
> >
> > Additionally add optional properties of pinctrl for host only mode
> >
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > ---
> > .../devicetree/bindings/usb/mt8173-xhci.txt | 48 ++++++++++++++++++++
> > 1 file changed, 48 insertions(+)
>
> Acked-by: Rob Herring <robh@kernel.org>
Thank you
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3,4/5] usb: Add MediaTek USB3 DRD Driver
[not found] ` <1465543962-11678-5-git-send-email-chunfeng.yun@mediatek.com>
2016-06-11 21:08 ` [PATCH v3,4/5] usb: " kbuild test robot
2016-06-12 4:14 ` kbuild test robot
@ 2016-08-08 13:10 ` Greg Kroah-Hartman
2016-08-09 8:08 ` chunfeng yun
2 siblings, 1 reply; 15+ messages in thread
From: Greg Kroah-Hartman @ 2016-08-08 13:10 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Jun 10, 2016 at 03:32:41PM +0800, Chunfeng Yun wrote:
> --- /dev/null
> +++ b/drivers/usb/mtu3/Makefile
> @@ -0,0 +1,20 @@
> +
> +#ifeq ($(CONFIG_USB_DEBUG),y)
> + ccflags-y += -DDEBUG
> +#endif
There is no CONFIG_USB_DEBUG in the tree anymore, are you sure you
tested this? :)
thanks,
greg k-h
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3,4/5] usb: Add MediaTek USB3 DRD Driver
2016-08-08 13:10 ` Greg Kroah-Hartman
@ 2016-08-09 8:08 ` chunfeng yun
0 siblings, 0 replies; 15+ messages in thread
From: chunfeng yun @ 2016-08-09 8:08 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On Mon, 2016-08-08 at 15:10 +0200, Greg Kroah-Hartman wrote:
> On Fri, Jun 10, 2016 at 03:32:41PM +0800, Chunfeng Yun wrote:
> > --- /dev/null
> > +++ b/drivers/usb/mtu3/Makefile
> > @@ -0,0 +1,20 @@
> > +
> > +#ifeq ($(CONFIG_USB_DEBUG),y)
> > + ccflags-y += -DDEBUG
> > +#endif
>
> There is no CONFIG_USB_DEBUG in the tree anymore, are you sure you
> tested this? :)
>
Sorry, I just commented it out here and didn't enable it.
I modify it now.
Thank you
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2016-08-09 8:08 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-10 7:32 Add MediaTek USB3 DRD Driver Chunfeng Yun
2016-06-10 7:32 ` [PATCH v3, 1/5] dt-bindings: mt8173-xhci: support host side of dual-role mode Chunfeng Yun
2016-06-13 18:54 ` [PATCH v3,1/5] " Rob Herring
2016-06-14 2:20 ` chunfeng yun
2016-06-10 7:32 ` [PATCH v3,2/5] dt-bindings: mt8173-mtu3: add devicetree bindings Chunfeng Yun
2016-06-10 9:21 ` Felipe Balbi
2016-06-14 2:19 ` chunfeng yun
2016-06-10 7:32 ` [PATCH v3,3/5] usb: xhci-mtk: make IPPC register optional Chunfeng Yun
2016-06-10 7:32 ` [PATCH v3,5/5] arm64: dts: mediatek: add USB3 DRD driver Chunfeng Yun
2016-06-10 9:15 ` Add MediaTek USB3 DRD Driver chunfeng yun
2016-06-10 9:27 ` Felipe Balbi
[not found] ` <1465543962-11678-5-git-send-email-chunfeng.yun@mediatek.com>
2016-06-11 21:08 ` [PATCH v3,4/5] usb: " kbuild test robot
2016-06-12 4:14 ` kbuild test robot
2016-08-08 13:10 ` Greg Kroah-Hartman
2016-08-09 8:08 ` chunfeng yun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).