linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Add MediaTek USB3 DRD Driver
@ 2016-05-10  8:23 Chunfeng Yun
  2016-05-10  8:23 ` [PATCH 1/6] dt-bindings: mt8173-xhci: support host side of dual-role mode Chunfeng Yun
                   ` (4 more replies)
  0 siblings, 5 replies; 20+ messages in thread
From: Chunfeng Yun @ 2016-05-10  8:23 UTC (permalink / raw)
  To: linux-arm-kernel

>From 5e3e992dc3c02eda12f5cf984a18a57f0207333d Mon Sep 17 00:00:00 2001
From: Chunfeng Yun <chunfeng.yun@mediatek.com>
Date: Tue, 10 May 2016 16:04:25 +0800
Subject: [PATCH 0/6] 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.


Chunfeng Yun (6):
  dt-bindings: mt8173-xhci: support host side of dual-role mode
  usb: xhci-mtk: make IPPC register optional
  dt-bindings: mtu3: add devicetree bindings
  usb: Add MediaTek USB3 DRD Driver
  arm64: dts: mediatek: add USB3 DRD driver
  pinctrl: mt8173: set GPIO16 to usb iddig mode

 .../devicetree/bindings/usb/mt8173-xhci.txt        |   48 ++
 Documentation/devicetree/bindings/usb/mtu3.txt     |   86 ++
 arch/arm64/boot/dts/mediatek/mt8173-evb.dts        |   46 +-
 arch/arm64/boot/dts/mediatek/mt8173.dtsi           |   28 +-
 drivers/pinctrl/mediatek/pinctrl-mtk-mt8173.h      |    2 +-
 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                       |  877 +++++++++++++++++++
 drivers/usb/mtu3/mtu3_dr.c                         |  353 ++++++++
 drivers/usb/mtu3/mtu3_dr.h                         |  108 +++
 drivers/usb/mtu3/mtu3_gadget.c                     |  735 ++++++++++++++++
 drivers/usb/mtu3/mtu3_gadget_ep0.c                 |  889 ++++++++++++++++++++
 drivers/usb/mtu3/mtu3_host.c                       |  294 +++++++
 drivers/usb/mtu3/mtu3_hw_regs.h                    |  474 +++++++++++
 drivers/usb/mtu3/mtu3_plat.c                       |  496 +++++++++++
 drivers/usb/mtu3/mtu3_qmu.c                        |  599 +++++++++++++
 drivers/usb/mtu3/mtu3_qmu.h                        |   43 +
 21 files changed, 5587 insertions(+), 15 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/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] 20+ messages in thread

* [PATCH 1/6] dt-bindings: mt8173-xhci: support host side of dual-role mode
  2016-05-10  8:23 Add MediaTek USB3 DRD Driver Chunfeng Yun
@ 2016-05-10  8:23 ` Chunfeng Yun
  2016-05-10  8:23 ` [PATCH 2/6] usb: xhci-mtk: make IPPC register optional Chunfeng Yun
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 20+ messages in thread
From: Chunfeng Yun @ 2016-05-10  8:23 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..542e3fa 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
+ - pinctl-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] 20+ messages in thread

* [PATCH 2/6] usb: xhci-mtk: make IPPC register optional
  2016-05-10  8:23 Add MediaTek USB3 DRD Driver Chunfeng Yun
  2016-05-10  8:23 ` [PATCH 1/6] dt-bindings: mt8173-xhci: support host side of dual-role mode Chunfeng Yun
@ 2016-05-10  8:23 ` Chunfeng Yun
  2016-05-10  8:23 ` [PATCH 3/6] dt-bindings: mtu3: add devicetree bindings Chunfeng Yun
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 20+ messages in thread
From: Chunfeng Yun @ 2016-05-10  8:23 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] 20+ messages in thread

* [PATCH 3/6] dt-bindings: mtu3: add devicetree bindings
  2016-05-10  8:23 Add MediaTek USB3 DRD Driver Chunfeng Yun
  2016-05-10  8:23 ` [PATCH 1/6] dt-bindings: mt8173-xhci: support host side of dual-role mode Chunfeng Yun
  2016-05-10  8:23 ` [PATCH 2/6] usb: xhci-mtk: make IPPC register optional Chunfeng Yun
@ 2016-05-10  8:23 ` Chunfeng Yun
  2016-05-11 14:54   ` Rob Herring
  2016-05-10  8:23 ` [PATCH 5/6] arm64: dts: mediatek: add USB3 DRD driver Chunfeng Yun
  2016-05-10  8:23 ` [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode Chunfeng Yun
  4 siblings, 1 reply; 20+ messages in thread
From: Chunfeng Yun @ 2016-05-10  8:23 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>
---
 Documentation/devicetree/bindings/usb/mtu3.txt |   86 ++++++++++++++++++++++++
 1 file changed, 86 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/mtu3.txt

diff --git a/Documentation/devicetree/bindings/usb/mtu3.txt b/Documentation/devicetree/bindings/usb/mtu3.txt
new file mode 100644
index 0000000..ff142a5
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/mtu3.txt
@@ -0,0 +1,86 @@
+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
+ - 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".
+ - mediatek,enable-manual-drd : supports manual dual-role switch by sysfs
+	interface; only used when receptacle is TYPE-A and also wants to support
+	dual-role mode.
+
+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] 20+ messages in thread

* [PATCH 5/6] arm64: dts: mediatek: add USB3 DRD driver
  2016-05-10  8:23 Add MediaTek USB3 DRD Driver Chunfeng Yun
                   ` (2 preceding siblings ...)
  2016-05-10  8:23 ` [PATCH 3/6] dt-bindings: mtu3: add devicetree bindings Chunfeng Yun
@ 2016-05-10  8:23 ` Chunfeng Yun
  2016-05-10  8:23 ` [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode Chunfeng Yun
  4 siblings, 0 replies; 20+ messages in thread
From: Chunfeng Yun @ 2016-05-10  8:23 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 eab7efc..34821db 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -548,11 +548,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>,
@@ -560,10 +563,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] 20+ messages in thread

* [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode
  2016-05-10  8:23 Add MediaTek USB3 DRD Driver Chunfeng Yun
                   ` (3 preceding siblings ...)
  2016-05-10  8:23 ` [PATCH 5/6] arm64: dts: mediatek: add USB3 DRD driver Chunfeng Yun
@ 2016-05-10  8:23 ` Chunfeng Yun
  2016-05-11 11:56   ` Linus Walleij
  4 siblings, 1 reply; 20+ messages in thread
From: Chunfeng Yun @ 2016-05-10  8:23 UTC (permalink / raw)
  To: linux-arm-kernel

the default mode of GPIO16 pin is gpio, when set EINT16 to
IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be
fixed when set its default mode as usb iddig.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/pinctrl/mediatek/pinctrl-mtk-mt8173.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-mt8173.h b/drivers/pinctrl/mediatek/pinctrl-mtk-mt8173.h
index 13e5b68..9b018fd 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-mt8173.h
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-mt8173.h
@@ -201,7 +201,7 @@ static const struct mtk_desc_pin mtk_pins_mt8173[] = {
 	MTK_PIN(
 		PINCTRL_PIN(16, "IDDIG"),
 		NULL, "mt8173",
-		MTK_EINT_FUNCTION(0, 16),
+		MTK_EINT_FUNCTION(1, 16),
 		MTK_FUNCTION(0, "GPIO16"),
 		MTK_FUNCTION(1, "IDDIG"),
 		MTK_FUNCTION(2, "CMFLASH"),
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode
  2016-05-10  8:23 ` [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode Chunfeng Yun
@ 2016-05-11 11:56   ` Linus Walleij
  2016-05-11 18:32     ` Hongzhou Yang
  0 siblings, 1 reply; 20+ messages in thread
From: Linus Walleij @ 2016-05-11 11:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, May 10, 2016 at 10:23 AM, Chunfeng Yun
<chunfeng.yun@mediatek.com> wrote:

> the default mode of GPIO16 pin is gpio, when set EINT16 to
> IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be
> fixed when set its default mode as usb iddig.
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>

This looks like it can be merged orthogonally to all the
other patches, but I don't understand the patch or if it
is correct.

Hongzhou/Yingjoe, can either of you review this patch?

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 3/6] dt-bindings: mtu3: add devicetree bindings
  2016-05-10  8:23 ` [PATCH 3/6] dt-bindings: mtu3: add devicetree bindings Chunfeng Yun
@ 2016-05-11 14:54   ` Rob Herring
  2016-05-12  7:24     ` chunfeng yun
  0 siblings, 1 reply; 20+ messages in thread
From: Rob Herring @ 2016-05-11 14:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, May 10, 2016 at 04:23:31PM +0800, Chunfeng Yun wrote:
> add a DT binding doc for MediaTek USB3 DRD driver
> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
>  Documentation/devicetree/bindings/usb/mtu3.txt |   86 ++++++++++++++++++++++++
>  1 file changed, 86 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/usb/mtu3.txt
> 
> diff --git a/Documentation/devicetree/bindings/usb/mtu3.txt b/Documentation/devicetree/bindings/usb/mtu3.txt
> new file mode 100644
> index 0000000..ff142a5
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/mtu3.txt
> @@ -0,0 +1,86 @@
> +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

How many?

> + - 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
> + - 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".

There is a standard wake-up source binding. That assumes asserting the 
device's irq (or one of the irqs) will cause wake-up.

The syscon-wakeup should probably get implemented as a stacked 
irqdomain.

> + - mediatek,enable-manual-drd : supports manual dual-role switch by sysfs
> +	interface; only used when receptacle is TYPE-A and also wants to support
> +	dual-role mode.

sysfs is a Linux detail that doesn't apply to the binding. Does the 
property mean "the IP block supports or doesn't support switching"  or 
"I want to enable switching feature". Only the former belongs in DT.

As far as the sysfs interface, it should be generic, not Mediatek 
specific.

> +
> +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

Is XHCI really a sub-block? It seems mostly independent.

> +
> +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	[flat|nested] 20+ messages in thread

* [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode
  2016-05-11 11:56   ` Linus Walleij
@ 2016-05-11 18:32     ` Hongzhou Yang
  2016-05-12  1:41       ` chunfeng yun
  0 siblings, 1 reply; 20+ messages in thread
From: Hongzhou Yang @ 2016-05-11 18:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 2016-05-11 at 13:56 +0200, Linus Walleij wrote:
> On Tue, May 10, 2016 at 10:23 AM, Chunfeng Yun
> <chunfeng.yun@mediatek.com> wrote:
> 
> > the default mode of GPIO16 pin is gpio, when set EINT16 to
> > IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be
> > fixed when set its default mode as usb iddig.
> >
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> 

Chunfeng, GPIO16 can be used as EINT16 mode, but the pinmux should be 0.
If you want to set its default mode to iddig, you should set it in dts.

Yours,
Hongzhou

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode
  2016-05-11 18:32     ` Hongzhou Yang
@ 2016-05-12  1:41       ` chunfeng yun
  2016-05-12  2:09         ` Hongzhou Yang
  0 siblings, 1 reply; 20+ messages in thread
From: chunfeng yun @ 2016-05-12  1:41 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wed, 2016-05-11 at 11:32 -0700, Hongzhou Yang wrote:
> On Wed, 2016-05-11 at 13:56 +0200, Linus Walleij wrote:
> > On Tue, May 10, 2016 at 10:23 AM, Chunfeng Yun
> > <chunfeng.yun@mediatek.com> wrote:
> > 
> > > the default mode of GPIO16 pin is gpio, when set EINT16 to
> > > IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be
> > > fixed when set its default mode as usb iddig.
> > >
> > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > 
> 
> Chunfeng, GPIO16 can be used as EINT16 mode, but the pinmux should be 0.
> If you want to set its default mode to iddig, you should set it in dts.
> 
I set it in DTS, but it didn't work, because when usb driver requested
IRQ, pinmux was switched back to default mode set by
MTK_EINT_FUNCTION().


> Yours,
> Hongzhou
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode
  2016-05-12  1:41       ` chunfeng yun
@ 2016-05-12  2:09         ` Hongzhou Yang
  2016-05-12  2:55           ` Hongzhou Yang
  0 siblings, 1 reply; 20+ messages in thread
From: Hongzhou Yang @ 2016-05-12  2:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 2016-05-12 at 09:41 +0800, chunfeng yun wrote:
> Hi,
> 
> On Wed, 2016-05-11 at 11:32 -0700, Hongzhou Yang wrote:
> > On Wed, 2016-05-11 at 13:56 +0200, Linus Walleij wrote:
> > > On Tue, May 10, 2016 at 10:23 AM, Chunfeng Yun
> > > <chunfeng.yun@mediatek.com> wrote:
> > > 
> > > > the default mode of GPIO16 pin is gpio, when set EINT16 to
> > > > IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be
> > > > fixed when set its default mode as usb iddig.
> > > >
> > > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > > 
> > 
> > Chunfeng, GPIO16 can be used as EINT16 mode, but the pinmux should be 0.
> > If you want to set its default mode to iddig, you should set it in dts.
> > 
> I set it in DTS, but it didn't work, because when usb driver requested
> IRQ, pinmux was switched back to default mode set by
> MTK_EINT_FUNCTION().
> 

After confirmed, there are something wrong with data sheet and pinmux
table, and GPIO16 can only receive interrupt by mode 1. So

Acked-by: Hongzhou Yang <hongzhou.yang@mediatek.com>

Yours,
Hongzhou

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode
  2016-05-12  2:09         ` Hongzhou Yang
@ 2016-05-12  2:55           ` Hongzhou Yang
  2016-05-24 10:58             ` Linus Walleij
  2016-11-23 18:32             ` Matthias Brugger
  0 siblings, 2 replies; 20+ messages in thread
From: Hongzhou Yang @ 2016-05-12  2:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 2016-05-11 at 19:09 -0700, Hongzhou Yang wrote:
> On Thu, 2016-05-12 at 09:41 +0800, chunfeng yun wrote:
> > Hi,
> > 
> > On Wed, 2016-05-11 at 11:32 -0700, Hongzhou Yang wrote:
> > > On Wed, 2016-05-11 at 13:56 +0200, Linus Walleij wrote:
> > > > On Tue, May 10, 2016 at 10:23 AM, Chunfeng Yun
> > > > <chunfeng.yun@mediatek.com> wrote:
> > > > 
> > > > > the default mode of GPIO16 pin is gpio, when set EINT16 to
> > > > > IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be
> > > > > fixed when set its default mode as usb iddig.
> > > > >
> > > > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > > > 
> > > 
> > > Chunfeng, GPIO16 can be used as EINT16 mode, but the pinmux should be 0.
> > > If you want to set its default mode to iddig, you should set it in dts.
> > > 
> > I set it in DTS, but it didn't work, because when usb driver requested
> > IRQ, pinmux was switched back to default mode set by
> > MTK_EINT_FUNCTION().
> > 
> 
> After confirmed, there are something wrong with data sheet and pinmux
> table, and GPIO16 can only receive interrupt by mode 1. So
> 
> Acked-by: Hongzhou Yang <hongzhou.yang@mediatek.com>
> 

Linus,

We find there are some other pins still have the same problem, so please
hold on it. Sorry for so much noise.

Thanks,
Hongzhou

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 3/6] dt-bindings: mtu3: add devicetree bindings
  2016-05-11 14:54   ` Rob Herring
@ 2016-05-12  7:24     ` chunfeng yun
  2016-05-12 23:02       ` Alan Cooper
  0 siblings, 1 reply; 20+ messages in thread
From: chunfeng yun @ 2016-05-12  7:24 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wed, 2016-05-11 at 09:54 -0500, Rob Herring wrote:
> On Tue, May 10, 2016 at 04:23:31PM +0800, Chunfeng Yun wrote:
> > add a DT binding doc for MediaTek USB3 DRD driver
> > 
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > ---
> >  Documentation/devicetree/bindings/usb/mtu3.txt |   86 ++++++++++++++++++++++++
> >  1 file changed, 86 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/usb/mtu3.txt
> > 
> > diff --git a/Documentation/devicetree/bindings/usb/mtu3.txt b/Documentation/devicetree/bindings/usb/mtu3.txt
> > new file mode 100644
> > index 0000000..ff142a5
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/usb/mtu3.txt
> > @@ -0,0 +1,86 @@
> > +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
> 
> How many?
It depends on implementation; there are two phys on mt8173 platform

> 
> > + - 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
> > + - 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".
> 
> There is a standard wake-up source binding. That assumes asserting the 
> device's irq (or one of the irqs) will cause wake-up.
> 
> The syscon-wakeup should probably get implemented as a stacked 
> irqdomain.
> 
Syscon-wakeup is used to control which usb wakeup mode we want to use,
such as ip sleep(usb suspend/resume signal), or line state(changes of D
+/-). And it doesn't trigger device's interrupt, so can't implement
device's irq to wake up system.

> > + - mediatek,enable-manual-drd : supports manual dual-role switch by sysfs
> > +	interface; only used when receptacle is TYPE-A and also wants to support
> > +	dual-role mode.
> 
> sysfs is a Linux detail that doesn't apply to the binding. Does the 
> property mean "the IP block supports or doesn't support switching"  or 
> "I want to enable switching feature". Only the former belongs in DT.
> 
It is the former case, and has little relation with sysfs interface.
I will modify it later, sorry for my unclear description. 

> As far as the sysfs interface, it should be generic, not Mediatek 
> specific.
> 
> > +
> > +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
> 
> Is XHCI really a sub-block? It seems mostly independent.
Yes, the mtk's usb3 controller contains three parts: mu3d IP, xHCI IP
and IPPC (IP power and control).

> 
> > +
> > +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	[flat|nested] 20+ messages in thread

* [PATCH 3/6] dt-bindings: mtu3: add devicetree bindings
  2016-05-12  7:24     ` chunfeng yun
@ 2016-05-12 23:02       ` Alan Cooper
  2016-05-13  2:00         ` chunfeng yun
  0 siblings, 1 reply; 20+ messages in thread
From: Alan Cooper @ 2016-05-12 23:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, May 12, 2016 at 3:24 AM, chunfeng yun <chunfeng.yun@mediatek.com> wrote:
>> > + - mediatek,enable-manual-drd : supports manual dual-role switch by sysfs
>> > +   interface; only used when receptacle is TYPE-A and also wants to support
>> > +   dual-role mode.
>>
>> sysfs is a Linux detail that doesn't apply to the binding. Does the
>> property mean "the IP block supports or doesn't support switching"  or
>> "I want to enable switching feature". Only the former belongs in DT.
>>
> It is the former case, and has little relation with sysfs interface.
> I will modify it later, sorry for my unclear description.

Could the property name be just "enable-manual-drd" instead of
"mediatek,enable-manual-drd"? I expect to have to add this
functionality to our USB driver in the near future.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 3/6] dt-bindings: mtu3: add devicetree bindings
  2016-05-12 23:02       ` Alan Cooper
@ 2016-05-13  2:00         ` chunfeng yun
  2016-05-13  3:09           ` Rob Herring
  0 siblings, 1 reply; 20+ messages in thread
From: chunfeng yun @ 2016-05-13  2:00 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Thu, 2016-05-12 at 19:02 -0400, Alan Cooper wrote:
> On Thu, May 12, 2016 at 3:24 AM, chunfeng yun <chunfeng.yun@mediatek.com> wrote:
> >> > + - mediatek,enable-manual-drd : supports manual dual-role switch by sysfs
> >> > +   interface; only used when receptacle is TYPE-A and also wants to support
> >> > +   dual-role mode.
> >>
> >> sysfs is a Linux detail that doesn't apply to the binding. Does the
> >> property mean "the IP block supports or doesn't support switching"  or
> >> "I want to enable switching feature". Only the former belongs in DT.
> >>
> > It is the former case, and has little relation with sysfs interface.
> > I will modify it later, sorry for my unclear description.
> 
> Could the property name be just "enable-manual-drd" instead of
> "mediatek,enable-manual-drd"? I expect to have to add this
> functionality to our USB driver in the near future.

Do you mean provide some APIs to in common USB driver?

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 3/6] dt-bindings: mtu3: add devicetree bindings
  2016-05-13  2:00         ` chunfeng yun
@ 2016-05-13  3:09           ` Rob Herring
  2016-05-13  3:19             ` chunfeng yun
  0 siblings, 1 reply; 20+ messages in thread
From: Rob Herring @ 2016-05-13  3:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, May 12, 2016 at 9:00 PM, chunfeng yun <chunfeng.yun@mediatek.com> wrote:
> Hi,
>
> On Thu, 2016-05-12 at 19:02 -0400, Alan Cooper wrote:
>> On Thu, May 12, 2016 at 3:24 AM, chunfeng yun <chunfeng.yun@mediatek.com> wrote:
>> >> > + - mediatek,enable-manual-drd : supports manual dual-role switch by sysfs
>> >> > +   interface; only used when receptacle is TYPE-A and also wants to support
>> >> > +   dual-role mode.
>> >>
>> >> sysfs is a Linux detail that doesn't apply to the binding. Does the
>> >> property mean "the IP block supports or doesn't support switching"  or
>> >> "I want to enable switching feature". Only the former belongs in DT.
>> >>
>> > It is the former case, and has little relation with sysfs interface.
>> > I will modify it later, sorry for my unclear description.
>>
>> Could the property name be just "enable-manual-drd" instead of
>> "mediatek,enable-manual-drd"? I expect to have to add this
>> functionality to our USB driver in the near future.
>
> Do you mean provide some APIs to in common USB driver?

Probably, but first just put the property in a common binding doc.

Rob

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 3/6] dt-bindings: mtu3: add devicetree bindings
  2016-05-13  3:09           ` Rob Herring
@ 2016-05-13  3:19             ` chunfeng yun
  0 siblings, 0 replies; 20+ messages in thread
From: chunfeng yun @ 2016-05-13  3:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 2016-05-12 at 22:09 -0500, Rob Herring wrote:
> On Thu, May 12, 2016 at 9:00 PM, chunfeng yun <chunfeng.yun@mediatek.com> wrote:
> > Hi,
> >
> > On Thu, 2016-05-12 at 19:02 -0400, Alan Cooper wrote:
> >> On Thu, May 12, 2016 at 3:24 AM, chunfeng yun <chunfeng.yun@mediatek.com> wrote:
> >> >> > + - mediatek,enable-manual-drd : supports manual dual-role switch by sysfs
> >> >> > +   interface; only used when receptacle is TYPE-A and also wants to support
> >> >> > +   dual-role mode.
> >> >>
> >> >> sysfs is a Linux detail that doesn't apply to the binding. Does the
> >> >> property mean "the IP block supports or doesn't support switching"  or
> >> >> "I want to enable switching feature". Only the former belongs in DT.
> >> >>
> >> > It is the former case, and has little relation with sysfs interface.
> >> > I will modify it later, sorry for my unclear description.
> >>
> >> Could the property name be just "enable-manual-drd" instead of
> >> "mediatek,enable-manual-drd"? I expect to have to add this
> >> functionality to our USB driver in the near future.
> >
> > Do you mean provide some APIs to in common USB driver?
> 
> Probably, but first just put the property in a common binding doc.
> 
Ok, I modify it later

Thanks.

> Rob

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode
  2016-05-12  2:55           ` Hongzhou Yang
@ 2016-05-24 10:58             ` Linus Walleij
  2016-11-23 18:32             ` Matthias Brugger
  1 sibling, 0 replies; 20+ messages in thread
From: Linus Walleij @ 2016-05-24 10:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, May 12, 2016 at 4:55 AM, Hongzhou Yang
<hongzhou.yang@mediatek.com> wrote:

> We find there are some other pins still have the same problem, so please
> hold on it. Sorry for so much noise.

It's OK. Get me a big patch fixing it all when you're combed through
things and we can apply it for fixes/stable.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode
  2016-05-12  2:55           ` Hongzhou Yang
  2016-05-24 10:58             ` Linus Walleij
@ 2016-11-23 18:32             ` Matthias Brugger
  2016-12-01  0:43               ` Hongzhou Yang
  1 sibling, 1 reply; 20+ messages in thread
From: Matthias Brugger @ 2016-11-23 18:32 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Hongzhou,

On 12/05/16 04:55, Hongzhou Yang wrote:
> On Wed, 2016-05-11 at 19:09 -0700, Hongzhou Yang wrote:
>> On Thu, 2016-05-12 at 09:41 +0800, chunfeng yun wrote:
>>> Hi,
>>>
>>> On Wed, 2016-05-11 at 11:32 -0700, Hongzhou Yang wrote:
>>>> On Wed, 2016-05-11 at 13:56 +0200, Linus Walleij wrote:
>>>>> On Tue, May 10, 2016 at 10:23 AM, Chunfeng Yun
>>>>> <chunfeng.yun@mediatek.com> wrote:
>>>>>
>>>>>> the default mode of GPIO16 pin is gpio, when set EINT16 to
>>>>>> IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be
>>>>>> fixed when set its default mode as usb iddig.
>>>>>>
>>>>>> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
>>>>>
>>>>
>>>> Chunfeng, GPIO16 can be used as EINT16 mode, but the pinmux should be 0.
>>>> If you want to set its default mode to iddig, you should set it in dts.
>>>>
>>> I set it in DTS, but it didn't work, because when usb driver requested
>>> IRQ, pinmux was switched back to default mode set by
>>> MTK_EINT_FUNCTION().
>>>
>>
>> After confirmed, there are something wrong with data sheet and pinmux
>> table, and GPIO16 can only receive interrupt by mode 1. So
>>
>> Acked-by: Hongzhou Yang <hongzhou.yang@mediatek.com>
>>
>
> Linus,
>
> We find there are some other pins still have the same problem, so please
> hold on it. Sorry for so much noise.
>

Did you made any progress on this? I didn't see any patch on the mailing 
list.

Regards,
Matthias

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode
  2016-11-23 18:32             ` Matthias Brugger
@ 2016-12-01  0:43               ` Hongzhou Yang
  0 siblings, 0 replies; 20+ messages in thread
From: Hongzhou Yang @ 2016-12-01  0:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 2016-11-23 at 19:32 +0100, Matthias Brugger wrote:
> Hi Hongzhou,
> 
> On 12/05/16 04:55, Hongzhou Yang wrote:
> > On Wed, 2016-05-11 at 19:09 -0700, Hongzhou Yang wrote:
> >> On Thu, 2016-05-12 at 09:41 +0800, chunfeng yun wrote:
> >>> Hi,
> >>>
> >>> On Wed, 2016-05-11 at 11:32 -0700, Hongzhou Yang wrote:
> >>>> On Wed, 2016-05-11 at 13:56 +0200, Linus Walleij wrote:
> >>>>> On Tue, May 10, 2016 at 10:23 AM, Chunfeng Yun
> >>>>> <chunfeng.yun@mediatek.com> wrote:
> >>>>>
> >>>>>> the default mode of GPIO16 pin is gpio, when set EINT16 to
> >>>>>> IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be
> >>>>>> fixed when set its default mode as usb iddig.
> >>>>>>
> >>>>>> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> >>>>>
> >>>>
> >>>> Chunfeng, GPIO16 can be used as EINT16 mode, but the pinmux should be 0.
> >>>> If you want to set its default mode to iddig, you should set it in dts.
> >>>>
> >>> I set it in DTS, but it didn't work, because when usb driver requested
> >>> IRQ, pinmux was switched back to default mode set by
> >>> MTK_EINT_FUNCTION().
> >>>
> >>
> >> After confirmed, there are something wrong with data sheet and pinmux
> >> table, and GPIO16 can only receive interrupt by mode 1. So
> >>
> >> Acked-by: Hongzhou Yang <hongzhou.yang@mediatek.com>
> >>
> >
> > Linus,
> >
> > We find there are some other pins still have the same problem, so please
> > hold on it. Sorry for so much noise.
> >
> 
> Did you made any progress on this? I didn't see any patch on the mailing 
> list.
> 
> Regards,
> Matthias

Hi Matthias,

Sorry for the late reply.

I have double confirmed with HW designer, other special EINTs are
built-in and they are using internal signal, they are not triggered 
by GPIO, only GPIO16 should set to mode 1.

And, Chunfeng already re-sent this patch.

Thank you very much.

Yours,
Hongzhou

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2016-12-01  0:43 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-10  8:23 Add MediaTek USB3 DRD Driver Chunfeng Yun
2016-05-10  8:23 ` [PATCH 1/6] dt-bindings: mt8173-xhci: support host side of dual-role mode Chunfeng Yun
2016-05-10  8:23 ` [PATCH 2/6] usb: xhci-mtk: make IPPC register optional Chunfeng Yun
2016-05-10  8:23 ` [PATCH 3/6] dt-bindings: mtu3: add devicetree bindings Chunfeng Yun
2016-05-11 14:54   ` Rob Herring
2016-05-12  7:24     ` chunfeng yun
2016-05-12 23:02       ` Alan Cooper
2016-05-13  2:00         ` chunfeng yun
2016-05-13  3:09           ` Rob Herring
2016-05-13  3:19             ` chunfeng yun
2016-05-10  8:23 ` [PATCH 5/6] arm64: dts: mediatek: add USB3 DRD driver Chunfeng Yun
2016-05-10  8:23 ` [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode Chunfeng Yun
2016-05-11 11:56   ` Linus Walleij
2016-05-11 18:32     ` Hongzhou Yang
2016-05-12  1:41       ` chunfeng yun
2016-05-12  2:09         ` Hongzhou Yang
2016-05-12  2:55           ` Hongzhou Yang
2016-05-24 10:58             ` Linus Walleij
2016-11-23 18:32             ` Matthias Brugger
2016-12-01  0:43               ` Hongzhou Yang

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).