linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Add MUSB for MT7623
@ 2021-08-03 15:13 Sungbo Eo
  2021-08-03 15:13 ` [PATCH 1/2] dt-bindings: usb: mtk-musb: add MT7623 compatible Sungbo Eo
                   ` (4 more replies)
  0 siblings, 5 replies; 29+ messages in thread
From: Sungbo Eo @ 2021-08-03 15:13 UTC (permalink / raw)
  To: linux-mediatek
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Rob Herring, Matthias Brugger,
	Min Guo, Frank Wunderlich, devicetree, linux-usb,
	linux-arm-kernel, linux-kernel, Sungbo Eo

These patches add support for the MUSB controller on Mediatek MT7623.
Tested on Mercury RUSH-318AC Wi-Fi router.

I got to know this from a BPI-R2 forum post [1], and managed to make it work on OpenWrt snapshot.
I'd like to know if this also works on BPI-R2, I can happily share the details if needed.
And I've just copy & pasted nodes from mt2701, please let me know if I missed some big differences between SoCs...

[1] http://forum.banana-pi.org/t/bpi-r2-otg-port/10551

Sungbo Eo (2):
  dt-bindings: usb: mtk-musb: add MT7623 compatible
  arm: dts: mt7623: add musb device nodes

 .../bindings/usb/mediatek,musb.yaml           |  1 +
 arch/arm/boot/dts/mt7623.dtsi                 | 34 +++++++++++++++++++
 arch/arm/boot/dts/mt7623a.dtsi                |  4 +++
 3 files changed, 39 insertions(+)

-- 
2.32.0


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

* [PATCH 1/2] dt-bindings: usb: mtk-musb: add MT7623 compatible
  2021-08-03 15:13 [PATCH 0/2] Add MUSB for MT7623 Sungbo Eo
@ 2021-08-03 15:13 ` Sungbo Eo
  2021-08-04 15:01   ` Matthias Brugger
  2021-08-03 15:13 ` [PATCH 2/2] arm: dts: mt7623: add musb device nodes Sungbo Eo
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 29+ messages in thread
From: Sungbo Eo @ 2021-08-03 15:13 UTC (permalink / raw)
  To: linux-mediatek
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Rob Herring, Matthias Brugger,
	Min Guo, Frank Wunderlich, devicetree, linux-usb,
	linux-arm-kernel, linux-kernel, Sungbo Eo

Document MT7623 compatible for mtk-musb.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
---
 Documentation/devicetree/bindings/usb/mediatek,musb.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/usb/mediatek,musb.yaml b/Documentation/devicetree/bindings/usb/mediatek,musb.yaml
index 84ddacfdbe9b..03d62d60ce5f 100644
--- a/Documentation/devicetree/bindings/usb/mediatek,musb.yaml
+++ b/Documentation/devicetree/bindings/usb/mediatek,musb.yaml
@@ -19,6 +19,7 @@ properties:
       - enum:
           - mediatek,mt8516-musb
           - mediatek,mt2701-musb
+          - mediatek,mt7623-musb
       - const: mediatek,mtk-musb
 
   reg:
-- 
2.32.0


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

* [PATCH 2/2] arm: dts: mt7623: add musb device nodes
  2021-08-03 15:13 [PATCH 0/2] Add MUSB for MT7623 Sungbo Eo
  2021-08-03 15:13 ` [PATCH 1/2] dt-bindings: usb: mtk-musb: add MT7623 compatible Sungbo Eo
@ 2021-08-03 15:13 ` Sungbo Eo
  2021-08-03 17:15 ` Aw: [PATCH 0/2] Add MUSB for MT7623 Frank Wunderlich
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 29+ messages in thread
From: Sungbo Eo @ 2021-08-03 15:13 UTC (permalink / raw)
  To: linux-mediatek
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Rob Herring, Matthias Brugger,
	Min Guo, Frank Wunderlich, devicetree, linux-usb,
	linux-arm-kernel, linux-kernel, Sungbo Eo

MT7623 has an musb controller that is compatible with the one from MT2701.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
---
 arch/arm/boot/dts/mt7623.dtsi  | 34 ++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/mt7623a.dtsi |  4 ++++
 2 files changed, 38 insertions(+)

diff --git a/arch/arm/boot/dts/mt7623.dtsi b/arch/arm/boot/dts/mt7623.dtsi
index 3c11f7cfcc40..806dc067ec8f 100644
--- a/arch/arm/boot/dts/mt7623.dtsi
+++ b/arch/arm/boot/dts/mt7623.dtsi
@@ -905,6 +905,40 @@ u3port1: usb-phy@1a244900 {
 		};
 	};
 
+	usb3: usb@11200000 {
+		compatible = "mediatek,mt7623-musb",
+			     "mediatek,mtk-musb";
+		reg = <0 0x11200000 0 0x1000>;
+		interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
+		interrupt-names = "mc";
+		phys = <&u2port2 PHY_TYPE_USB2>;
+		dr_mode = "otg";
+		clocks = <&pericfg CLK_PERI_USB0>,
+			 <&pericfg CLK_PERI_USB0_MCU>,
+			 <&pericfg CLK_PERI_USB_SLV>;
+		clock-names = "main","mcu","univpll";
+		power-domains = <&scpsys MT2701_POWER_DOMAIN_IFR_MSC>;
+		status = "disabled";
+	};
+
+	u2phy1: t-phy@11210000 {
+		compatible = "mediatek,mt7623-tphy",
+			     "mediatek,generic-tphy-v1";
+		reg = <0 0x11210000 0 0x0800>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+		status = "okay";
+
+		u2port2: usb-phy@1a1c4800 {
+			reg = <0 0x11210800 0 0x0100>;
+			clocks = <&topckgen CLK_TOP_USB_PHY48M>;
+			clock-names = "ref";
+			#phy-cells = <1>;
+			status = "okay";
+		};
+	};
+
 	ethsys: syscon@1b000000 {
 		compatible = "mediatek,mt7623-ethsys",
 			     "mediatek,mt2701-ethsys",
diff --git a/arch/arm/boot/dts/mt7623a.dtsi b/arch/arm/boot/dts/mt7623a.dtsi
index 0735a1fb8ad9..c10ce6f4ab27 100644
--- a/arch/arm/boot/dts/mt7623a.dtsi
+++ b/arch/arm/boot/dts/mt7623a.dtsi
@@ -42,3 +42,7 @@ &usb1 {
 &usb2 {
 	power-domains = <&scpsys MT7623A_POWER_DOMAIN_HIF>;
 };
+
+&usb3 {
+	power-domains = <&scpsys MT7623A_POWER_DOMAIN_IFR_MSC>;
+};
-- 
2.32.0


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

* Aw: [PATCH 0/2] Add MUSB for MT7623
  2021-08-03 15:13 [PATCH 0/2] Add MUSB for MT7623 Sungbo Eo
  2021-08-03 15:13 ` [PATCH 1/2] dt-bindings: usb: mtk-musb: add MT7623 compatible Sungbo Eo
  2021-08-03 15:13 ` [PATCH 2/2] arm: dts: mt7623: add musb device nodes Sungbo Eo
@ 2021-08-03 17:15 ` Frank Wunderlich
  2021-08-04  0:14   ` Sungbo Eo
  2021-08-04 15:01 ` Matthias Brugger
  2021-08-08 12:38 ` [PATCH v2 " Sungbo Eo
  4 siblings, 1 reply; 29+ messages in thread
From: Frank Wunderlich @ 2021-08-03 17:15 UTC (permalink / raw)
  To: Sungbo Eo
  Cc: linux-mediatek, Chunfeng Yun, Greg Kroah-Hartman, Rob Herring,
	Matthias Brugger, Min Guo, devicetree, linux-usb,
	linux-arm-kernel, linux-kernel, Sungbo Eo

Hi,

> Gesendet: Dienstag, 03. August 2021 um 17:13 Uhr
> Von: "Sungbo Eo" <mans0n@gorani.run>
> An: linux-mediatek@lists.infradead.org
> Cc: "Chunfeng Yun" <chunfeng.yun@mediatek.com>, "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>, "Rob Herring" <robh+dt@kernel.org>, "Matthias Brugger" <matthias.bgg@gmail.com>, "Min Guo" <min.guo@mediatek.com>, "Frank Wunderlich" <frank-w@public-files.de>, devicetree@vger.kernel.org, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "Sungbo Eo" <mans0n@gorani.run>
> Betreff: [PATCH 0/2] Add MUSB for MT7623
>
> These patches add support for the MUSB controller on Mediatek MT7623.
> Tested on Mercury RUSH-318AC Wi-Fi router.
>
> I got to know this from a BPI-R2 forum post [1], and managed to make it work on OpenWrt snapshot.
> I'd like to know if this also works on BPI-R2, I can happily share the details if needed.
> And I've just copy & pasted nodes from mt2701, please let me know if I missed some big differences between SoCs...
>
> [1] http://forum.banana-pi.org/t/bpi-r2-otg-port/10551

thanks for working on it. do both otg-roles (host/client) work on your device?

unfortunately at least host-mode does not work (do not know how to test client mode). i guess because iddig and vusb nodes are missing.

i took your Patchset and enabled the usb-node for bpi-r2.

+&usb3 {
+       status = "okay";
+};

and added these config-symbols:

+CONFIG_USB_CONN_GPIO=y
+CONFIG_USB_MUSB_HDRC=y
+CONFIG_USB_MUSB_MEDIATEK=y
+CONFIG_NOP_USB_XCEIV=y
+CONFIG_USB_CONFIGFS=y
+#CONFIG_USB_CONFIGFS_MASS_STORAGE=y
+#CONFIG_PHY_MTK_TPHY=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_MUSB_DUAL_ROLE=y
+CONFIG_USB_INVENTRA_DMA=y

btw. imho otg-node should be named usb0 as other dts (kernel 4.4) also use usb0, else i think it's confusing.

in my last attempt i had these below usb-node in boards devicetree:

+       usb_vbus: regulator@0 {
+               compatible = "regulator-fixed";
+               regulator-name = "usb_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               gpio = <&pio 237 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       connector{
+               compatible = "gpio-usb-b-connector", "usb-b-connector";
+               type = "micro";
+               id-gpios = <&pio 44 GPIO_ACTIVE_HIGH>;
+               vbus-supply = <&usb_vbus>;
+       };

after adding these i see the connection of otg-cable with usb-stick in dmesg:

[   53.656304] usb-conn-gpio 11200000.usb:connector: repeated rot
[   53.696324] usb-conn-gpio 11200000.usb:connector: repeated role: host

but usb-stick is not powered (led of the stick is off) and of course i see no mass-storage device.

and now i'm back on the traceback on power down i've reported Author of musb driver some time ago

[  156.785185] WARNING: CPU: 0 PID: 1 at drivers/power/reset/mt6323-poweroff.c:4
[  156.795156] Unable to power off system

[  156.884496] [<c0cca1ec>] (warn_slowpath_fmt) from [<c090562c>] (mt6323_do_pw)
[  156.893203]  r8:c3296d40 r7:00000024 r6:0ccccb60 r5:c10fe3d8 r4:00000000
[  156.900030] [<c09054b0>] (mt6323_do_pwroff) from [<c010ba68>] (machine_power)
[  156.908558]  r8:fee1dead r7:c1312590 r6:92f61d00 r5:00000000 r4:4321fedc
[  156.915385] [<c010ba34>] (machine_power_off) from [<c01524bc>] (kernel_power)

i guess it's related to the usb_vbus.

regards Frank


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

* Re: Aw: [PATCH 0/2] Add MUSB for MT7623
  2021-08-03 17:15 ` Aw: [PATCH 0/2] Add MUSB for MT7623 Frank Wunderlich
@ 2021-08-04  0:14   ` Sungbo Eo
  2021-08-04  8:11     ` Aw: " Frank Wunderlich
  2021-08-04 11:33     ` Frank Wunderlich
  0 siblings, 2 replies; 29+ messages in thread
From: Sungbo Eo @ 2021-08-04  0:14 UTC (permalink / raw)
  To: Frank Wunderlich
  Cc: linux-mediatek, Chunfeng Yun, Greg Kroah-Hartman, Rob Herring,
	Matthias Brugger, Min Guo, devicetree, linux-usb,
	linux-arm-kernel, linux-kernel

Hi Frank,

On 2021-08-04 02:15, Frank Wunderlich wrote:
> Hi,
> 
>> Gesendet: Dienstag, 03. August 2021 um 17:13 Uhr
>> Von: "Sungbo Eo" <mans0n@gorani.run>
>> An: linux-mediatek@lists.infradead.org
>> Cc: "Chunfeng Yun" <chunfeng.yun@mediatek.com>, "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>, "Rob Herring" <robh+dt@kernel.org>, "Matthias Brugger" <matthias.bgg@gmail.com>, "Min Guo" <min.guo@mediatek.com>, "Frank Wunderlich" <frank-w@public-files.de>, devicetree@vger.kernel.org, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "Sungbo Eo" <mans0n@gorani.run>
>> Betreff: [PATCH 0/2] Add MUSB for MT7623
>>
>> These patches add support for the MUSB controller on Mediatek MT7623.
>> Tested on Mercury RUSH-318AC Wi-Fi router.
>>
>> I got to know this from a BPI-R2 forum post [1], and managed to make it work on OpenWrt snapshot.
>> I'd like to know if this also works on BPI-R2, I can happily share the details if needed.
>> And I've just copy & pasted nodes from mt2701, please let me know if I missed some big differences between SoCs...
>>
>> [1] http://forum.banana-pi.org/t/bpi-r2-otg-port/10551
> 
> thanks for working on it. do both otg-roles (host/client) work on your device?

Yes, I tested it with host mode and device mode.
I also tried manual role-switch via sysfs and it worked with some prior setup.
Note that my device has a USB Type-A connector and not micro B, so I can't help with id pin stuff...

> 
> unfortunately at least host-mode does not work (do not know how to test client mode). i guess because iddig and vusb nodes are missing.
> 
> i took your Patchset and enabled the usb-node for bpi-r2.
> 
> +&usb3 {
> +       status = "okay";
> +};
> 
> and added these config-symbols:
> 
> +CONFIG_USB_CONN_GPIO=y
> +CONFIG_USB_MUSB_HDRC=y
> +CONFIG_USB_MUSB_MEDIATEK=y
> +CONFIG_NOP_USB_XCEIV=y
> +CONFIG_USB_CONFIGFS=y
> +#CONFIG_USB_CONFIGFS_MASS_STORAGE=y
> +#CONFIG_PHY_MTK_TPHY=y
> +CONFIG_USB_GADGET=y
> +CONFIG_USB_MUSB_DUAL_ROLE=y
> +CONFIG_USB_INVENTRA_DMA=y
> 
> btw. imho otg-node should be named usb0 as other dts (kernel 4.4) also use usb0, else i think it's confusing.

You certainly have a point. I'll follow your suggestion. Thanks!

> 
> in my last attempt i had these below usb-node in boards devicetree:
> 
> +       usb_vbus: regulator@0 {
> +               compatible = "regulator-fixed";
> +               regulator-name = "usb_vbus";
> +               regulator-min-microvolt = <5000000>;
> +               regulator-max-microvolt = <5000000>;
> +               gpio = <&pio 237 GPIO_ACTIVE_HIGH>;
> +               enable-active-high;
> +       };
> +
> +       connector{
> +               compatible = "gpio-usb-b-connector", "usb-b-connector";
> +               type = "micro";
> +               id-gpios = <&pio 44 GPIO_ACTIVE_HIGH>;
> +               vbus-supply = <&usb_vbus>;
> +       };
> 
> after adding these i see the connection of otg-cable with usb-stick in dmesg:
> 
> [   53.656304] usb-conn-gpio 11200000.usb:connector: repeated rot
> [   53.696324] usb-conn-gpio 11200000.usb:connector: repeated role: host
> 
> but usb-stick is not powered (led of the stick is off) and of course i see no mass-storage device.

I observed the same symptom (but different error log).

[    2.722253] musb-hdrc musb-hdrc.1.auto: VBUS_ERROR in a_idle (80, <SessEnd), retry #0, port1 00000104

In my case adding `regulator-always-on;` in the regulator node solved the problem temporarily.
But after that I switched to relying on pinctrl.

+&pio {
+       musb_pins: musb {
+               pins-musb {
+                       pinmux = <MT7623_PIN_237_EXT_SDIO2_FUNC_DRV_VBUS>;
+               };
+       };
+};
+
+&usb3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&musb_pins>;
+       status = "okay";
+
+       dr_mode = "host";
+
+       connector {
+               compatible = "usb-a-connector";
+       };
+};

root@OpenWrt:~# lsusb -t
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=musb-hdrc/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=, Driver=usb-storage, 480M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/1p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/1p, 480M

I tested device mode with legacy CDC composite device module.
You can also take more complicated configfs approach, though.
https://elinux.org/images/e/ef/USB_Gadget_Configfs_API_0.pdf

+       dr_mode = "host";
-       dr_mode = "peripheral";

root@OpenWrt:/# insmod g_cdc
[   64.565254] using random self ethernet address
[   64.569711] using random host ethernet address
[   64.575966] usb0: HOST MAC 26:36:2d:e5:8f:6f
[   64.580501] usb0: MAC 92:d7:f9:c7:88:01
[   64.584409] g_cdc gadget: CDC Composite Gadget, version: King Kamehameha Day 2008
[   64.592454] g_cdc gadget: g_cdc ready

I also tried usb-role-switch,

-       dr_mode = "host";
+       usb-role-switch;

After boot the initial mode of musb is "none", and it did not turn vbus on even if I set it to host mode.
Later I found out that I need to load any gadget driver before setting it to host mode.

# echo peripheral > /sys/devices/platform/11200000.usb/musb-hdrc.1.auto/mode
# insmod g_cdc
# echo host > /sys/devices/platform/11200000.usb/musb-hdrc.1.auto/mode

That's all I know. Please let me know if I skipped some details.
Thanks.

> 
> and now i'm back on the traceback on power down i've reported Author of musb driver some time ago
> 
> [  156.785185] WARNING: CPU: 0 PID: 1 at drivers/power/reset/mt6323-poweroff.c:4
> [  156.795156] Unable to power off system
> 
> [  156.884496] [<c0cca1ec>] (warn_slowpath_fmt) from [<c090562c>] (mt6323_do_pw)
> [  156.893203]  r8:c3296d40 r7:00000024 r6:0ccccb60 r5:c10fe3d8 r4:00000000
> [  156.900030] [<c09054b0>] (mt6323_do_pwroff) from [<c010ba68>] (machine_power)
> [  156.908558]  r8:fee1dead r7:c1312590 r6:92f61d00 r5:00000000 r4:4321fedc
> [  156.915385] [<c010ba34>] (machine_power_off) from [<c01524bc>] (kernel_power)
> 
> i guess it's related to the usb_vbus.
> 
> regards Frank
> 

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

* Aw: Re:  [PATCH 0/2] Add MUSB for MT7623
  2021-08-04  0:14   ` Sungbo Eo
@ 2021-08-04  8:11     ` Frank Wunderlich
  2021-08-05  1:34       ` Sungbo Eo
  2021-08-04 11:33     ` Frank Wunderlich
  1 sibling, 1 reply; 29+ messages in thread
From: Frank Wunderlich @ 2021-08-04  8:11 UTC (permalink / raw)
  To: Sungbo Eo
  Cc: linux-mediatek, Chunfeng Yun, Greg Kroah-Hartman, Rob Herring,
	Matthias Brugger, Min Guo, devicetree, linux-usb,
	linux-arm-kernel, linux-kernel

> Gesendet: Mittwoch, 04. August 2021 um 02:14 Uhr
> Von: "Sungbo Eo" <mans0n@gorani.run>

> > thanks for working on it. do both otg-roles (host/client) work on your device?
>
> Yes, I tested it with host mode and device mode.
> I also tried manual role-switch via sysfs and it worked with some prior setup.
> Note that my device has a USB Type-A connector and not micro B, so I can't help with id pin stuff...

> > but usb-stick is not powered (led of the stick is off) and of course i see no mass-storage device.
>
> I observed the same symptom (but different error log).
>
> [    2.722253] musb-hdrc musb-hdrc.1.auto: VBUS_ERROR in a_idle (80, <SessEnd), retry #0, port1 00000104
>
> In my case adding `regulator-always-on;` in the regulator node solved the problem temporarily.
> But after that I switched to relying on pinctrl.

i've found out that usb-stick is powered if i first connect otg-cable and then the stick to the cable...regulator always on does not change anything for me (only supporess "disabling vusb" message on boot). traceback on poweroff is still there.

role switch happen on inserting stick into cable, not before (insert cable into r2) as i expected.

need to figure out which CONFIG options i need to get USB-Stick as mass storage working.

i wonder why it works on your board without the vusb/connector subnodes

> +&pio {
> +       musb_pins: musb {
> +               pins-musb {
> +                       pinmux = <MT7623_PIN_237_EXT_SDIO2_FUNC_DRV_VBUS>;
> +               };
> +       };
> +};

imho it's the same gpio used for regulator, right? whats the difference?
i tried this instead of the regulator-node => not powered (cable first, then stick).

> +&usb3 {
> +       pinctrl-names = "default";
> +       pinctrl-0 = <&musb_pins>;
> +       status = "okay";
> +
> +       dr_mode = "host";
> +
> +       connector {
> +               compatible = "usb-a-connector";
> +       };
> +};
>
> root@OpenWrt:~# lsusb -t
> /:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=musb-hdrc/1p, 480M
>     |__ Port 1: Dev 2, If 0, Class=, Driver=usb-storage, 480M
> /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/1p, 5000M
> /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/1p, 480M
>
> I tested device mode with legacy CDC composite device module.
> You can also take more complicated configfs approach, though.
> https://elinux.org/images/e/ef/USB_Gadget_Configfs_API_0.pdf
>
> +       dr_mode = "host";
> -       dr_mode = "peripheral";
>
> root@OpenWrt:/# insmod g_cdc
> [   64.565254] using random self ethernet address
> [   64.569711] using random host ethernet address
> [   64.575966] usb0: HOST MAC 26:36:2d:e5:8f:6f
> [   64.580501] usb0: MAC 92:d7:f9:c7:88:01
> [   64.584409] g_cdc gadget: CDC Composite Gadget, version: King Kamehameha Day 2008
> [   64.592454] g_cdc gadget: g_cdc ready
>
> I also tried usb-role-switch,
>
> -       dr_mode = "host";
> +       usb-role-switch;
>
> After boot the initial mode of musb is "none", and it did not turn vbus on even if I set it to host mode.
> Later I found out that I need to load any gadget driver before setting it to host mode.
>
> # echo peripheral > /sys/devices/platform/11200000.usb/musb-hdrc.1.auto/mode
> # insmod g_cdc
> # echo host > /sys/devices/platform/11200000.usb/musb-hdrc.1.auto/mode
>
> That's all I know. Please let me know if I skipped some details.
> Thanks.
>
> >
> > and now i'm back on the traceback on power down i've reported Author of musb driver some time ago
> >
> > [  156.785185] WARNING: CPU: 0 PID: 1 at drivers/power/reset/mt6323-poweroff.c:4
> > [  156.795156] Unable to power off system
> >
> > [  156.884496] [<c0cca1ec>] (warn_slowpath_fmt) from [<c090562c>] (mt6323_do_pw)
> > [  156.893203]  r8:c3296d40 r7:00000024 r6:0ccccb60 r5:c10fe3d8 r4:00000000
> > [  156.900030] [<c09054b0>] (mt6323_do_pwroff) from [<c010ba68>] (machine_power)
> > [  156.908558]  r8:fee1dead r7:c1312590 r6:92f61d00 r5:00000000 r4:4321fedc
> > [  156.915385] [<c010ba34>] (machine_power_off) from [<c01524bc>] (kernel_power)
> >
> > i guess it's related to the usb_vbus.
> >
> > regards Frank
> >
>

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

* Aw: Re:  [PATCH 0/2] Add MUSB for MT7623
  2021-08-04  0:14   ` Sungbo Eo
  2021-08-04  8:11     ` Aw: " Frank Wunderlich
@ 2021-08-04 11:33     ` Frank Wunderlich
  1 sibling, 0 replies; 29+ messages in thread
From: Frank Wunderlich @ 2021-08-04 11:33 UTC (permalink / raw)
  To: Sungbo Eo, Min Guo
  Cc: linux-mediatek, Chunfeng Yun, Greg Kroah-Hartman, Rob Herring,
	Matthias Brugger, devicetree, linux-usb, linux-arm-kernel,
	linux-kernel

Hi,

another strange thing is, after some bootups (i boot kernel from tftp, but also on full power cycle),
musb-driver maps musb-hdrc.4.auto instead of #1

root@bpi-r2:~# dmesg | grep musb
[    5.502914] musb-hdrc musb-hdrc.4.auto: MUSB HDRC host driver
[    5.508782] musb-hdrc musb-hdrc.4.auto: new USB bus registered, assigned bus number 5

and then nothing works (no roleswitch, no power which does not work with pinctl / without regulator).
It's hard to test if things working before, do no more work if device is named differently.

maybe Min Guo can help here?

after bootup mode is b_idle in my case (currently do not change if i connect otg cable)

root@bpi-r2:~# cat /sys/devices/platform/11200000.usb/musb-hdrc.4.auto/mode
b_idle

regards Frank

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

* Re: [PATCH 0/2] Add MUSB for MT7623
  2021-08-03 15:13 [PATCH 0/2] Add MUSB for MT7623 Sungbo Eo
                   ` (2 preceding siblings ...)
  2021-08-03 17:15 ` Aw: [PATCH 0/2] Add MUSB for MT7623 Frank Wunderlich
@ 2021-08-04 15:01 ` Matthias Brugger
  2021-08-05  1:36   ` Sungbo Eo
  2021-08-08 12:38 ` [PATCH v2 " Sungbo Eo
  4 siblings, 1 reply; 29+ messages in thread
From: Matthias Brugger @ 2021-08-04 15:01 UTC (permalink / raw)
  To: Sungbo Eo, linux-mediatek
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Rob Herring, Min Guo,
	Frank Wunderlich, devicetree, linux-usb, linux-arm-kernel,
	linux-kernel

Hi Sungbo,

On 03/08/2021 17:13, Sungbo Eo wrote:
> These patches add support for the MUSB controller on Mediatek MT7623.
> Tested on Mercury RUSH-318AC Wi-Fi router.
> 

Nice to see you are working on Mediatek devices.
Are you planning to add the device tree for the router to the kernel? I'd be
happy to see them submitted.

Regards,
Matthias

> I got to know this from a BPI-R2 forum post [1], and managed to make it work on OpenWrt snapshot.
> I'd like to know if this also works on BPI-R2, I can happily share the details if needed.
> And I've just copy & pasted nodes from mt2701, please let me know if I missed some big differences between SoCs...
> 
> [1] http://forum.banana-pi.org/t/bpi-r2-otg-port/10551
> 
> Sungbo Eo (2):
>   dt-bindings: usb: mtk-musb: add MT7623 compatible
>   arm: dts: mt7623: add musb device nodes
> 
>  .../bindings/usb/mediatek,musb.yaml           |  1 +
>  arch/arm/boot/dts/mt7623.dtsi                 | 34 +++++++++++++++++++
>  arch/arm/boot/dts/mt7623a.dtsi                |  4 +++
>  3 files changed, 39 insertions(+)
> 

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

* Re: [PATCH 1/2] dt-bindings: usb: mtk-musb: add MT7623 compatible
  2021-08-03 15:13 ` [PATCH 1/2] dt-bindings: usb: mtk-musb: add MT7623 compatible Sungbo Eo
@ 2021-08-04 15:01   ` Matthias Brugger
  0 siblings, 0 replies; 29+ messages in thread
From: Matthias Brugger @ 2021-08-04 15:01 UTC (permalink / raw)
  To: Sungbo Eo, linux-mediatek
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Rob Herring, Min Guo,
	Frank Wunderlich, devicetree, linux-usb, linux-arm-kernel,
	linux-kernel



On 03/08/2021 17:13, Sungbo Eo wrote:
> Document MT7623 compatible for mtk-musb.
> 
> Signed-off-by: Sungbo Eo <mans0n@gorani.run>

Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>

> ---
>  Documentation/devicetree/bindings/usb/mediatek,musb.yaml | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/usb/mediatek,musb.yaml b/Documentation/devicetree/bindings/usb/mediatek,musb.yaml
> index 84ddacfdbe9b..03d62d60ce5f 100644
> --- a/Documentation/devicetree/bindings/usb/mediatek,musb.yaml
> +++ b/Documentation/devicetree/bindings/usb/mediatek,musb.yaml
> @@ -19,6 +19,7 @@ properties:
>        - enum:
>            - mediatek,mt8516-musb
>            - mediatek,mt2701-musb
> +          - mediatek,mt7623-musb
>        - const: mediatek,mtk-musb
>  
>    reg:
> 

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

* Re: Aw: Re: [PATCH 0/2] Add MUSB for MT7623
  2021-08-04  8:11     ` Aw: " Frank Wunderlich
@ 2021-08-05  1:34       ` Sungbo Eo
  0 siblings, 0 replies; 29+ messages in thread
From: Sungbo Eo @ 2021-08-05  1:34 UTC (permalink / raw)
  To: Frank Wunderlich
  Cc: linux-mediatek, Chunfeng Yun, Greg Kroah-Hartman, Rob Herring,
	Matthias Brugger, Min Guo, devicetree, linux-usb,
	linux-arm-kernel, linux-kernel

On 2021-08-04 17:11, Frank Wunderlich wrote:
>> Gesendet: Mittwoch, 04. August 2021 um 02:14 Uhr
>> Von: "Sungbo Eo" <mans0n@gorani.run>
> 
>>> thanks for working on it. do both otg-roles (host/client) work on your device?
>>
>> Yes, I tested it with host mode and device mode.
>> I also tried manual role-switch via sysfs and it worked with some prior setup.
>> Note that my device has a USB Type-A connector and not micro B, so I can't help with id pin stuff...
> 
>>> but usb-stick is not powered (led of the stick is off) and of course i see no mass-storage device.
>>
>> I observed the same symptom (but different error log).
>>
>> [    2.722253] musb-hdrc musb-hdrc.1.auto: VBUS_ERROR in a_idle (80, <SessEnd), retry #0, port1 00000104
>>
>> In my case adding `regulator-always-on;` in the regulator node solved the problem temporarily.
>> But after that I switched to relying on pinctrl.
> 
> i've found out that usb-stick is powered if i first connect otg-cable and then the stick to the cable...regulator always on does not change anything for me (only supporess "disabling vusb" message on boot). traceback on poweroff is still there.

I tried to reproduce your usb-conn-gpio message on my machine but I failed.
Probably because my USB port does not have ID pin...

Currently OpenWrt does not enable CONFIG_POWER_RESET_MT6323 so I was not aware of the poweroff error.
After I enabled it I got the same error and I could not resolve it... I'd better disable it for now.

> 
> role switch happen on inserting stick into cable, not before (insert cable into r2) as i expected.
> 
> need to figure out which CONFIG options i need to get USB-Stick as mass storage working.

Do you mean that vbus turns on but your usb stick is not detected?
Does that change if you use `dr_mode = "host"`?

> 
> i wonder why it works on your board without the vusb/connector subnodes

Do you mean vbus subnode in musb or vusb subnode in pmic?
I've never used vusb node, it did not affect me in any way.
When I used usb_vbus regulator node to enable vbus line, it did not turn on the line unless I added `regulator-always-on`...
It seems the connector node is not really required for me.

> 
>> +&pio {
>> +       musb_pins: musb {
>> +               pins-musb {
>> +                       pinmux = <MT7623_PIN_237_EXT_SDIO2_FUNC_DRV_VBUS>;
>> +               };
>> +       };
>> +};
> 
> imho it's the same gpio used for regulator, right? whats the difference?
> i tried this instead of the regulator-node => not powered (cable first, then stick).

I don't really know how it does work, but for me it does turn on vbus in host mode and turn it off in device mode.
I imagined DRV_VBUS setup will make the musb controller itself (and not kernel) control the line as needed, but it's just my guess.

> 
>> +&usb3 {
>> +       pinctrl-names = "default";
>> +       pinctrl-0 = <&musb_pins>;
>> +       status = "okay";
>> +
>> +       dr_mode = "host";
>> +
>> +       connector {
>> +               compatible = "usb-a-connector";
>> +       };
>> +};
>>
>> root@OpenWrt:~# lsusb -t
>> /:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=musb-hdrc/1p, 480M
>>     |__ Port 1: Dev 2, If 0, Class=, Driver=usb-storage, 480M
>> /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/1p, 5000M
>> /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/1p, 480M
>>

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

* Re: [PATCH 0/2] Add MUSB for MT7623
  2021-08-04 15:01 ` Matthias Brugger
@ 2021-08-05  1:36   ` Sungbo Eo
  0 siblings, 0 replies; 29+ messages in thread
From: Sungbo Eo @ 2021-08-05  1:36 UTC (permalink / raw)
  To: Matthias Brugger, linux-mediatek
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Rob Herring, Min Guo,
	Frank Wunderlich, devicetree, linux-usb, linux-arm-kernel,
	linux-kernel

Hi Matthias,
Thanks for your kind review.

On 2021-08-05 00:01, Matthias Brugger wrote:
> Hi Sungbo,
> 
> On 03/08/2021 17:13, Sungbo Eo wrote:
>> These patches add support for the MUSB controller on Mediatek MT7623.
>> Tested on Mercury RUSH-318AC Wi-Fi router.
>>
> 
> Nice to see you are working on Mediatek devices.
> Are you planning to add the device tree for the router to the kernel? I'd be
> happy to see them submitted.

Actually I've never thought about it.
My router device is not for public sale, and the device might have been
locked up in recent versions, so I don't think anyone can ever use it
for that specific model.
Come to think of it, I've tried another model before, which is more in
public, I might submit its device tree if it gets ready someday.

Thanks.

> 
> Regards,
> Matthias
> 
>> I got to know this from a BPI-R2 forum post [1], and managed to make it work on OpenWrt snapshot.
>> I'd like to know if this also works on BPI-R2, I can happily share the details if needed.
>> And I've just copy & pasted nodes from mt2701, please let me know if I missed some big differences between SoCs...
>>
>> [1] http://forum.banana-pi.org/t/bpi-r2-otg-port/10551
>>
>> Sungbo Eo (2):
>>   dt-bindings: usb: mtk-musb: add MT7623 compatible
>>   arm: dts: mt7623: add musb device nodes
>>
>>  .../bindings/usb/mediatek,musb.yaml           |  1 +
>>  arch/arm/boot/dts/mt7623.dtsi                 | 34 +++++++++++++++++++
>>  arch/arm/boot/dts/mt7623a.dtsi                |  4 +++
>>  3 files changed, 39 insertions(+)
>>

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

* [PATCH v2 0/2] Add MUSB for MT7623
  2021-08-03 15:13 [PATCH 0/2] Add MUSB for MT7623 Sungbo Eo
                   ` (3 preceding siblings ...)
  2021-08-04 15:01 ` Matthias Brugger
@ 2021-08-08 12:38 ` Sungbo Eo
  2021-08-08 12:38   ` [PATCH v2 1/2] dt-bindings: usb: mtk-musb: add MT7623 compatible Sungbo Eo
                     ` (2 more replies)
  4 siblings, 3 replies; 29+ messages in thread
From: Sungbo Eo @ 2021-08-08 12:38 UTC (permalink / raw)
  To: linux-mediatek
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Rob Herring, Matthias Brugger,
	Min Guo, Frank Wunderlich, devicetree, linux-usb,
	linux-arm-kernel, linux-kernel, Sungbo Eo

These patches add support for the MUSB controller on Mediatek MT7623.
Tested on Mercury RUSH-318AC Wi-Fi router.

v2:
* dt-bindings
  * add reviewed by Matthias
* DTS
  * rename usb3 label to usb0
  * move usb0 & u2phy1 nodes to the right sorted place
  * disable u2phy1 by default
  * correct u2port2 node name to match its reg address

Sungbo Eo (2):
  dt-bindings: usb: mtk-musb: add MT7623 compatible
  arm: dts: mt7623: add musb device nodes

 .../bindings/usb/mediatek,musb.yaml           |  1 +
 arch/arm/boot/dts/mt7623.dtsi                 | 34 +++++++++++++++++++
 arch/arm/boot/dts/mt7623a.dtsi                |  4 +++
 3 files changed, 39 insertions(+)

-- 
2.32.0


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

* [PATCH v2 1/2] dt-bindings: usb: mtk-musb: add MT7623 compatible
  2021-08-08 12:38 ` [PATCH v2 " Sungbo Eo
@ 2021-08-08 12:38   ` Sungbo Eo
  2021-08-13 20:49     ` Rob Herring
  2021-08-08 12:38   ` [PATCH v2 2/2] arm: dts: mt7623: add musb device nodes Sungbo Eo
  2021-08-22  4:13   ` [PATCH v3 0/1] Add MUSB for MT7623 Sungbo Eo
  2 siblings, 1 reply; 29+ messages in thread
From: Sungbo Eo @ 2021-08-08 12:38 UTC (permalink / raw)
  To: linux-mediatek
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Rob Herring, Matthias Brugger,
	Min Guo, Frank Wunderlich, devicetree, linux-usb,
	linux-arm-kernel, linux-kernel, Sungbo Eo

Document MT7623 compatible for mtk-musb.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
---
v2:
* add reviewed by Matthias
---
 Documentation/devicetree/bindings/usb/mediatek,musb.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/usb/mediatek,musb.yaml b/Documentation/devicetree/bindings/usb/mediatek,musb.yaml
index 84ddacfdbe9b..03d62d60ce5f 100644
--- a/Documentation/devicetree/bindings/usb/mediatek,musb.yaml
+++ b/Documentation/devicetree/bindings/usb/mediatek,musb.yaml
@@ -19,6 +19,7 @@ properties:
       - enum:
           - mediatek,mt8516-musb
           - mediatek,mt2701-musb
+          - mediatek,mt7623-musb
       - const: mediatek,mtk-musb
 
   reg:
-- 
2.32.0


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

* [PATCH v2 2/2] arm: dts: mt7623: add musb device nodes
  2021-08-08 12:38 ` [PATCH v2 " Sungbo Eo
  2021-08-08 12:38   ` [PATCH v2 1/2] dt-bindings: usb: mtk-musb: add MT7623 compatible Sungbo Eo
@ 2021-08-08 12:38   ` Sungbo Eo
  2021-08-13 20:48     ` Rob Herring
  2021-08-22  4:13   ` [PATCH v3 0/1] Add MUSB for MT7623 Sungbo Eo
  2 siblings, 1 reply; 29+ messages in thread
From: Sungbo Eo @ 2021-08-08 12:38 UTC (permalink / raw)
  To: linux-mediatek
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Rob Herring, Matthias Brugger,
	Min Guo, Frank Wunderlich, devicetree, linux-usb,
	linux-arm-kernel, linux-kernel, Sungbo Eo

MT7623 has an musb controller that is compatible with the one from MT2701.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
---
v2:
* rename usb3 label to usb0
* move usb0 & u2phy1 nodes to the right sorted place
* disable u2phy1 by default
* correct u2port2 node name to match its reg address
---
 arch/arm/boot/dts/mt7623.dtsi  | 34 ++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/mt7623a.dtsi |  4 ++++
 2 files changed, 38 insertions(+)

diff --git a/arch/arm/boot/dts/mt7623.dtsi b/arch/arm/boot/dts/mt7623.dtsi
index 3c11f7cfcc40..790d74439cc6 100644
--- a/arch/arm/boot/dts/mt7623.dtsi
+++ b/arch/arm/boot/dts/mt7623.dtsi
@@ -585,6 +585,40 @@ spi2: spi@11017000 {
 		status = "disabled";
 	};
 
+	usb0: usb@11200000 {
+		compatible = "mediatek,mt7623-musb",
+			     "mediatek,mtk-musb";
+		reg = <0 0x11200000 0 0x1000>;
+		interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
+		interrupt-names = "mc";
+		phys = <&u2port2 PHY_TYPE_USB2>;
+		dr_mode = "otg";
+		clocks = <&pericfg CLK_PERI_USB0>,
+			 <&pericfg CLK_PERI_USB0_MCU>,
+			 <&pericfg CLK_PERI_USB_SLV>;
+		clock-names = "main","mcu","univpll";
+		power-domains = <&scpsys MT2701_POWER_DOMAIN_IFR_MSC>;
+		status = "disabled";
+	};
+
+	u2phy1: t-phy@11210000 {
+		compatible = "mediatek,mt7623-tphy",
+			     "mediatek,generic-tphy-v1";
+		reg = <0 0x11210000 0 0x0800>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+		status = "disabled";
+
+		u2port2: usb-phy@11210800 {
+			reg = <0 0x11210800 0 0x0100>;
+			clocks = <&topckgen CLK_TOP_USB_PHY48M>;
+			clock-names = "ref";
+			#phy-cells = <1>;
+			status = "okay";
+		};
+	};
+
 	audsys: clock-controller@11220000 {
 		compatible = "mediatek,mt7623-audsys",
 			     "mediatek,mt2701-audsys",
diff --git a/arch/arm/boot/dts/mt7623a.dtsi b/arch/arm/boot/dts/mt7623a.dtsi
index 0735a1fb8ad9..d304b62d24b5 100644
--- a/arch/arm/boot/dts/mt7623a.dtsi
+++ b/arch/arm/boot/dts/mt7623a.dtsi
@@ -35,6 +35,10 @@ &scpsys {
 	clock-names = "ethif";
 };
 
+&usb0 {
+	power-domains = <&scpsys MT7623A_POWER_DOMAIN_IFR_MSC>;
+};
+
 &usb1 {
 	power-domains = <&scpsys MT7623A_POWER_DOMAIN_HIF>;
 };
-- 
2.32.0


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

* Re: [PATCH v2 2/2] arm: dts: mt7623: add musb device nodes
  2021-08-08 12:38   ` [PATCH v2 2/2] arm: dts: mt7623: add musb device nodes Sungbo Eo
@ 2021-08-13 20:48     ` Rob Herring
  0 siblings, 0 replies; 29+ messages in thread
From: Rob Herring @ 2021-08-13 20:48 UTC (permalink / raw)
  To: Sungbo Eo
  Cc: linux-mediatek, Chunfeng Yun, Greg Kroah-Hartman,
	Matthias Brugger, Min Guo, Frank Wunderlich, devicetree,
	linux-usb, linux-arm-kernel, linux-kernel

On Sun, Aug 08, 2021 at 09:38:40PM +0900, Sungbo Eo wrote:
> MT7623 has an musb controller that is compatible with the one from MT2701.
> 
> Signed-off-by: Sungbo Eo <mans0n@gorani.run>
> ---
> v2:
> * rename usb3 label to usb0
> * move usb0 & u2phy1 nodes to the right sorted place
> * disable u2phy1 by default
> * correct u2port2 node name to match its reg address
> ---
>  arch/arm/boot/dts/mt7623.dtsi  | 34 ++++++++++++++++++++++++++++++++++
>  arch/arm/boot/dts/mt7623a.dtsi |  4 ++++
>  2 files changed, 38 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/mt7623.dtsi b/arch/arm/boot/dts/mt7623.dtsi
> index 3c11f7cfcc40..790d74439cc6 100644
> --- a/arch/arm/boot/dts/mt7623.dtsi
> +++ b/arch/arm/boot/dts/mt7623.dtsi
> @@ -585,6 +585,40 @@ spi2: spi@11017000 {
>  		status = "disabled";
>  	};
>  
> +	usb0: usb@11200000 {
> +		compatible = "mediatek,mt7623-musb",
> +			     "mediatek,mtk-musb";
> +		reg = <0 0x11200000 0 0x1000>;
> +		interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
> +		interrupt-names = "mc";
> +		phys = <&u2port2 PHY_TYPE_USB2>;
> +		dr_mode = "otg";
> +		clocks = <&pericfg CLK_PERI_USB0>,
> +			 <&pericfg CLK_PERI_USB0_MCU>,
> +			 <&pericfg CLK_PERI_USB_SLV>;
> +		clock-names = "main","mcu","univpll";
> +		power-domains = <&scpsys MT2701_POWER_DOMAIN_IFR_MSC>;
> +		status = "disabled";
> +	};
> +
> +	u2phy1: t-phy@11210000 {
> +		compatible = "mediatek,mt7623-tphy",
> +			     "mediatek,generic-tphy-v1";
> +		reg = <0 0x11210000 0 0x0800>;
> +		#address-cells = <2>;
> +		#size-cells = <2>;
> +		ranges;
> +		status = "disabled";
> +
> +		u2port2: usb-phy@11210800 {
> +			reg = <0 0x11210800 0 0x0100>;
> +			clocks = <&topckgen CLK_TOP_USB_PHY48M>;
> +			clock-names = "ref";
> +			#phy-cells = <1>;
> +			status = "okay";

Enabled is the default and doesn't really make sense here given the 
parent is disabled. Drop.

> +		};
> +	};
> +
>  	audsys: clock-controller@11220000 {
>  		compatible = "mediatek,mt7623-audsys",
>  			     "mediatek,mt2701-audsys",
> diff --git a/arch/arm/boot/dts/mt7623a.dtsi b/arch/arm/boot/dts/mt7623a.dtsi
> index 0735a1fb8ad9..d304b62d24b5 100644
> --- a/arch/arm/boot/dts/mt7623a.dtsi
> +++ b/arch/arm/boot/dts/mt7623a.dtsi
> @@ -35,6 +35,10 @@ &scpsys {
>  	clock-names = "ethif";
>  };
>  
> +&usb0 {
> +	power-domains = <&scpsys MT7623A_POWER_DOMAIN_IFR_MSC>;
> +};
> +
>  &usb1 {
>  	power-domains = <&scpsys MT7623A_POWER_DOMAIN_HIF>;
>  };
> -- 
> 2.32.0
> 
> 

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

* Re: [PATCH v2 1/2] dt-bindings: usb: mtk-musb: add MT7623 compatible
  2021-08-08 12:38   ` [PATCH v2 1/2] dt-bindings: usb: mtk-musb: add MT7623 compatible Sungbo Eo
@ 2021-08-13 20:49     ` Rob Herring
  0 siblings, 0 replies; 29+ messages in thread
From: Rob Herring @ 2021-08-13 20:49 UTC (permalink / raw)
  To: Sungbo Eo
  Cc: devicetree, linux-arm-kernel, Rob Herring, Matthias Brugger,
	Chunfeng Yun, linux-usb, Greg Kroah-Hartman, linux-mediatek,
	Min Guo, Frank Wunderlich, linux-kernel

On Sun, 08 Aug 2021 21:38:39 +0900, Sungbo Eo wrote:
> Document MT7623 compatible for mtk-musb.
> 
> Signed-off-by: Sungbo Eo <mans0n@gorani.run>
> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
> ---
> v2:
> * add reviewed by Matthias
> ---
>  Documentation/devicetree/bindings/usb/mediatek,musb.yaml | 1 +
>  1 file changed, 1 insertion(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

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

* [PATCH v3 0/1] Add MUSB for MT7623
  2021-08-08 12:38 ` [PATCH v2 " Sungbo Eo
  2021-08-08 12:38   ` [PATCH v2 1/2] dt-bindings: usb: mtk-musb: add MT7623 compatible Sungbo Eo
  2021-08-08 12:38   ` [PATCH v2 2/2] arm: dts: mt7623: add musb device nodes Sungbo Eo
@ 2021-08-22  4:13   ` Sungbo Eo
  2021-08-22  4:13     ` [PATCH v3 1/1] arm: dts: mt7623: add musb device nodes Sungbo Eo
  2021-08-30 15:59     ` [PATCH v4 0/2] Add MUSB for MT7623 Sungbo Eo
  2 siblings, 2 replies; 29+ messages in thread
From: Sungbo Eo @ 2021-08-22  4:13 UTC (permalink / raw)
  To: linux-mediatek
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Rob Herring, Matthias Brugger,
	Min Guo, Frank Wunderlich, devicetree, linux-usb,
	linux-arm-kernel, linux-kernel, Sungbo Eo

These patches add support for the MUSB controller on Mediatek MT7623.
Tested on Mercury RUSH-318AC Wi-Fi router.

v3:
* dt-bindings
  * remove the queued patch
* DTS
  * remove unnecessary status=okay from u2port2

v2:
* dt-bindings
  * add reviewed by Matthias
* DTS
  * rename usb3 label to usb0
  * move usb0 & u2phy1 nodes to the right sorted place
  * disable u2phy1 by default
  * correct u2port2 node name to match its reg address

Sungbo Eo (1):
  arm: dts: mt7623: add musb device nodes

 arch/arm/boot/dts/mt7623.dtsi  | 33 +++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/mt7623a.dtsi |  4 ++++
 2 files changed, 37 insertions(+)

-- 
2.33.0


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

* [PATCH v3 1/1] arm: dts: mt7623: add musb device nodes
  2021-08-22  4:13   ` [PATCH v3 0/1] Add MUSB for MT7623 Sungbo Eo
@ 2021-08-22  4:13     ` Sungbo Eo
  2021-08-30 15:17       ` Aw: " Frank Wunderlich
  2021-08-30 15:59     ` [PATCH v4 0/2] Add MUSB for MT7623 Sungbo Eo
  1 sibling, 1 reply; 29+ messages in thread
From: Sungbo Eo @ 2021-08-22  4:13 UTC (permalink / raw)
  To: linux-mediatek
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Rob Herring, Matthias Brugger,
	Min Guo, Frank Wunderlich, devicetree, linux-usb,
	linux-arm-kernel, linux-kernel, Sungbo Eo

MT7623 has an musb controller that is compatible with the one from MT2701.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
---
v3:
* remove unnecessary status=okay from u2port2

v2:
* rename usb3 label to usb0
* move usb0 & u2phy1 nodes to the right sorted place
* disable u2phy1 by default
* correct u2port2 node name to match its reg address
---
 arch/arm/boot/dts/mt7623.dtsi  | 33 +++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/mt7623a.dtsi |  4 ++++
 2 files changed, 37 insertions(+)

diff --git a/arch/arm/boot/dts/mt7623.dtsi b/arch/arm/boot/dts/mt7623.dtsi
index 3c11f7cfcc40..21c8a291b74e 100644
--- a/arch/arm/boot/dts/mt7623.dtsi
+++ b/arch/arm/boot/dts/mt7623.dtsi
@@ -585,6 +585,39 @@ spi2: spi@11017000 {
 		status = "disabled";
 	};
 
+	usb0: usb@11200000 {
+		compatible = "mediatek,mt7623-musb",
+			     "mediatek,mtk-musb";
+		reg = <0 0x11200000 0 0x1000>;
+		interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
+		interrupt-names = "mc";
+		phys = <&u2port2 PHY_TYPE_USB2>;
+		dr_mode = "otg";
+		clocks = <&pericfg CLK_PERI_USB0>,
+			 <&pericfg CLK_PERI_USB0_MCU>,
+			 <&pericfg CLK_PERI_USB_SLV>;
+		clock-names = "main","mcu","univpll";
+		power-domains = <&scpsys MT2701_POWER_DOMAIN_IFR_MSC>;
+		status = "disabled";
+	};
+
+	u2phy1: t-phy@11210000 {
+		compatible = "mediatek,mt7623-tphy",
+			     "mediatek,generic-tphy-v1";
+		reg = <0 0x11210000 0 0x0800>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+		status = "disabled";
+
+		u2port2: usb-phy@11210800 {
+			reg = <0 0x11210800 0 0x0100>;
+			clocks = <&topckgen CLK_TOP_USB_PHY48M>;
+			clock-names = "ref";
+			#phy-cells = <1>;
+		};
+	};
+
 	audsys: clock-controller@11220000 {
 		compatible = "mediatek,mt7623-audsys",
 			     "mediatek,mt2701-audsys",
diff --git a/arch/arm/boot/dts/mt7623a.dtsi b/arch/arm/boot/dts/mt7623a.dtsi
index 0735a1fb8ad9..d304b62d24b5 100644
--- a/arch/arm/boot/dts/mt7623a.dtsi
+++ b/arch/arm/boot/dts/mt7623a.dtsi
@@ -35,6 +35,10 @@ &scpsys {
 	clock-names = "ethif";
 };
 
+&usb0 {
+	power-domains = <&scpsys MT7623A_POWER_DOMAIN_IFR_MSC>;
+};
+
 &usb1 {
 	power-domains = <&scpsys MT7623A_POWER_DOMAIN_HIF>;
 };
-- 
2.33.0


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

* Aw: [PATCH v3 1/1] arm: dts: mt7623: add musb device nodes
  2021-08-22  4:13     ` [PATCH v3 1/1] arm: dts: mt7623: add musb device nodes Sungbo Eo
@ 2021-08-30 15:17       ` Frank Wunderlich
  0 siblings, 0 replies; 29+ messages in thread
From: Frank Wunderlich @ 2021-08-30 15:17 UTC (permalink / raw)
  To: Sungbo Eo
  Cc: linux-mediatek, Chunfeng Yun, Greg Kroah-Hartman, Rob Herring,
	Matthias Brugger, Min Guo, devicetree, linux-usb,
	linux-arm-kernel, linux-kernel, Sungbo Eo

Tested-by: Frank Wunderlich <frank-w@public-files.de>

after adding nodes for r2
https://patchwork.kernel.org/project/linux-mediatek/patch/20210830145958.108605-1-linux@fw-web.de/

regards Frank


> Gesendet: Sonntag, 22. August 2021 um 06:13 Uhr
> Von: "Sungbo Eo" <mans0n@gorani.run>
> An: linux-mediatek@lists.infradead.org
> Cc: "Chunfeng Yun" <chunfeng.yun@mediatek.com>, "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>, "Rob Herring" <robh+dt@kernel.org>, "Matthias Brugger" <matthias.bgg@gmail.com>, "Min Guo" <min.guo@mediatek.com>, "Frank Wunderlich" <frank-w@public-files.de>, devicetree@vger.kernel.org, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "Sungbo Eo" <mans0n@gorani.run>
> Betreff: [PATCH v3 1/1] arm: dts: mt7623: add musb device nodes
>
> MT7623 has an musb controller that is compatible with the one from MT2701.
>
> Signed-off-by: Sungbo Eo <mans0n@gorani.run>
> ---
> v3:
> * remove unnecessary status=okay from u2port2
>
> v2:
> * rename usb3 label to usb0
> * move usb0 & u2phy1 nodes to the right sorted place
> * disable u2phy1 by default
> * correct u2port2 node name to match its reg address
> ---
>  arch/arm/boot/dts/mt7623.dtsi  | 33 +++++++++++++++++++++++++++++++++
>  arch/arm/boot/dts/mt7623a.dtsi |  4 ++++
>  2 files changed, 37 insertions(+)
>
> diff --git a/arch/arm/boot/dts/mt7623.dtsi b/arch/arm/boot/dts/mt7623.dtsi
> index 3c11f7cfcc40..21c8a291b74e 100644
> --- a/arch/arm/boot/dts/mt7623.dtsi
> +++ b/arch/arm/boot/dts/mt7623.dtsi
> @@ -585,6 +585,39 @@ spi2: spi@11017000 {
>  		status = "disabled";
>  	};
>
> +	usb0: usb@11200000 {
> +		compatible = "mediatek,mt7623-musb",
> +			     "mediatek,mtk-musb";
> +		reg = <0 0x11200000 0 0x1000>;
> +		interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
> +		interrupt-names = "mc";
> +		phys = <&u2port2 PHY_TYPE_USB2>;
> +		dr_mode = "otg";
> +		clocks = <&pericfg CLK_PERI_USB0>,
> +			 <&pericfg CLK_PERI_USB0_MCU>,
> +			 <&pericfg CLK_PERI_USB_SLV>;
> +		clock-names = "main","mcu","univpll";
> +		power-domains = <&scpsys MT2701_POWER_DOMAIN_IFR_MSC>;
> +		status = "disabled";
> +	};
> +
> +	u2phy1: t-phy@11210000 {
> +		compatible = "mediatek,mt7623-tphy",
> +			     "mediatek,generic-tphy-v1";
> +		reg = <0 0x11210000 0 0x0800>;
> +		#address-cells = <2>;
> +		#size-cells = <2>;
> +		ranges;
> +		status = "disabled";
> +
> +		u2port2: usb-phy@11210800 {
> +			reg = <0 0x11210800 0 0x0100>;
> +			clocks = <&topckgen CLK_TOP_USB_PHY48M>;
> +			clock-names = "ref";
> +			#phy-cells = <1>;
> +		};
> +	};
> +
>  	audsys: clock-controller@11220000 {
>  		compatible = "mediatek,mt7623-audsys",
>  			     "mediatek,mt2701-audsys",
> diff --git a/arch/arm/boot/dts/mt7623a.dtsi b/arch/arm/boot/dts/mt7623a.dtsi
> index 0735a1fb8ad9..d304b62d24b5 100644
> --- a/arch/arm/boot/dts/mt7623a.dtsi
> +++ b/arch/arm/boot/dts/mt7623a.dtsi
> @@ -35,6 +35,10 @@ &scpsys {
>  	clock-names = "ethif";
>  };
>
> +&usb0 {
> +	power-domains = <&scpsys MT7623A_POWER_DOMAIN_IFR_MSC>;
> +};
> +
>  &usb1 {
>  	power-domains = <&scpsys MT7623A_POWER_DOMAIN_HIF>;
>  };
> --
> 2.33.0
>
>

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

* [PATCH v4 0/2] Add MUSB for MT7623
  2021-08-22  4:13   ` [PATCH v3 0/1] Add MUSB for MT7623 Sungbo Eo
  2021-08-22  4:13     ` [PATCH v3 1/1] arm: dts: mt7623: add musb device nodes Sungbo Eo
@ 2021-08-30 15:59     ` Sungbo Eo
  2021-08-30 15:59       ` [PATCH v4 1/2] arm: dts: mt7623: add musb device nodes Sungbo Eo
  2021-08-30 15:59       ` [PATCH v4 2/2] usb: musb: mediatek: Expose role-switch control to userspace Sungbo Eo
  1 sibling, 2 replies; 29+ messages in thread
From: Sungbo Eo @ 2021-08-30 15:59 UTC (permalink / raw)
  To: linux-mediatek
  Cc: Rob Herring, Matthias Brugger, Bin Liu, Greg Kroah-Hartman,
	Frank Wunderlich, devicetree, linux-usb, linux-arm-kernel,
	linux-kernel, Sungbo Eo

These patches add support for the MUSB controller on Mediatek MT7623.
Tested on Mercury RUSH-318AC Wi-Fi router.

v4:
* DTS
  * add tested by Frank
* musb
  * add userspace control flag patch

v3:
* dt-bindings
  * remove the queued patch
* DTS
  * remove unnecessary status=okay from u2port2

v2:
* dt-bindings
  * add reviewed by Matthias
* DTS
  * rename usb3 label to usb0
  * move usb0 & u2phy1 nodes to the right sorted place
  * disable u2phy1 by default
  * correct u2port2 node name to match its reg address

Sungbo Eo (2):
  arm: dts: mt7623: add musb device nodes
  usb: musb: mediatek: Expose role-switch control to userspace

 arch/arm/boot/dts/mt7623.dtsi  | 33 +++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/mt7623a.dtsi |  4 ++++
 drivers/usb/musb/mediatek.c    |  1 +
 3 files changed, 38 insertions(+)

-- 
2.33.0


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

* [PATCH v4 1/2] arm: dts: mt7623: add musb device nodes
  2021-08-30 15:59     ` [PATCH v4 0/2] Add MUSB for MT7623 Sungbo Eo
@ 2021-08-30 15:59       ` Sungbo Eo
  2021-08-31  6:27         ` Chunfeng Yun (云春峰)
                           ` (2 more replies)
  2021-08-30 15:59       ` [PATCH v4 2/2] usb: musb: mediatek: Expose role-switch control to userspace Sungbo Eo
  1 sibling, 3 replies; 29+ messages in thread
From: Sungbo Eo @ 2021-08-30 15:59 UTC (permalink / raw)
  To: linux-mediatek
  Cc: Rob Herring, Matthias Brugger, Bin Liu, Greg Kroah-Hartman,
	Frank Wunderlich, devicetree, linux-usb, linux-arm-kernel,
	linux-kernel, Sungbo Eo

MT7623 has an musb controller that is compatible with the one from MT2701.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
---
v4:
* add tested by Frank

v3:
* remove unnecessary status=okay from u2port2

v2:
* rename usb3 label to usb0
* move usb0 & u2phy1 nodes to the right sorted place
* disable u2phy1 by default
* correct u2port2 node name to match its reg address
---
 arch/arm/boot/dts/mt7623.dtsi  | 33 +++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/mt7623a.dtsi |  4 ++++
 2 files changed, 37 insertions(+)

diff --git a/arch/arm/boot/dts/mt7623.dtsi b/arch/arm/boot/dts/mt7623.dtsi
index 3c11f7cfcc40..21c8a291b74e 100644
--- a/arch/arm/boot/dts/mt7623.dtsi
+++ b/arch/arm/boot/dts/mt7623.dtsi
@@ -585,6 +585,39 @@ spi2: spi@11017000 {
 		status = "disabled";
 	};
 
+	usb0: usb@11200000 {
+		compatible = "mediatek,mt7623-musb",
+			     "mediatek,mtk-musb";
+		reg = <0 0x11200000 0 0x1000>;
+		interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
+		interrupt-names = "mc";
+		phys = <&u2port2 PHY_TYPE_USB2>;
+		dr_mode = "otg";
+		clocks = <&pericfg CLK_PERI_USB0>,
+			 <&pericfg CLK_PERI_USB0_MCU>,
+			 <&pericfg CLK_PERI_USB_SLV>;
+		clock-names = "main","mcu","univpll";
+		power-domains = <&scpsys MT2701_POWER_DOMAIN_IFR_MSC>;
+		status = "disabled";
+	};
+
+	u2phy1: t-phy@11210000 {
+		compatible = "mediatek,mt7623-tphy",
+			     "mediatek,generic-tphy-v1";
+		reg = <0 0x11210000 0 0x0800>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+		status = "disabled";
+
+		u2port2: usb-phy@11210800 {
+			reg = <0 0x11210800 0 0x0100>;
+			clocks = <&topckgen CLK_TOP_USB_PHY48M>;
+			clock-names = "ref";
+			#phy-cells = <1>;
+		};
+	};
+
 	audsys: clock-controller@11220000 {
 		compatible = "mediatek,mt7623-audsys",
 			     "mediatek,mt2701-audsys",
diff --git a/arch/arm/boot/dts/mt7623a.dtsi b/arch/arm/boot/dts/mt7623a.dtsi
index 0735a1fb8ad9..d304b62d24b5 100644
--- a/arch/arm/boot/dts/mt7623a.dtsi
+++ b/arch/arm/boot/dts/mt7623a.dtsi
@@ -35,6 +35,10 @@ &scpsys {
 	clock-names = "ethif";
 };
 
+&usb0 {
+	power-domains = <&scpsys MT7623A_POWER_DOMAIN_IFR_MSC>;
+};
+
 &usb1 {
 	power-domains = <&scpsys MT7623A_POWER_DOMAIN_HIF>;
 };
-- 
2.33.0


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

* [PATCH v4 2/2] usb: musb: mediatek: Expose role-switch control to userspace
  2021-08-30 15:59     ` [PATCH v4 0/2] Add MUSB for MT7623 Sungbo Eo
  2021-08-30 15:59       ` [PATCH v4 1/2] arm: dts: mt7623: add musb device nodes Sungbo Eo
@ 2021-08-30 15:59       ` Sungbo Eo
  2021-08-31  6:15         ` Chunfeng Yun (云春峰)
  1 sibling, 1 reply; 29+ messages in thread
From: Sungbo Eo @ 2021-08-30 15:59 UTC (permalink / raw)
  To: linux-mediatek
  Cc: Rob Herring, Matthias Brugger, Bin Liu, Greg Kroah-Hartman,
	Frank Wunderlich, devicetree, linux-usb, linux-arm-kernel,
	linux-kernel, Sungbo Eo

The allow_userspace_control flag enables manual role-switch from userspace.
Turn this feature on like several other USB DRD controller drivers.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
---
 drivers/usb/musb/mediatek.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/musb/mediatek.c b/drivers/usb/musb/mediatek.c
index 6b92d037d8fc..f5d97eb84cb5 100644
--- a/drivers/usb/musb/mediatek.c
+++ b/drivers/usb/musb/mediatek.c
@@ -185,6 +185,7 @@ static int mtk_otg_switch_init(struct mtk_glue *glue)
 
 	role_sx_desc.set = musb_usb_role_sx_set;
 	role_sx_desc.get = musb_usb_role_sx_get;
+	role_sx_desc.allow_userspace_control = true;
 	role_sx_desc.fwnode = dev_fwnode(glue->dev);
 	role_sx_desc.driver_data = glue;
 	glue->role_sw = usb_role_switch_register(glue->dev, &role_sx_desc);
-- 
2.33.0


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

* Re: [PATCH v4 2/2] usb: musb: mediatek: Expose role-switch control to userspace
  2021-08-30 15:59       ` [PATCH v4 2/2] usb: musb: mediatek: Expose role-switch control to userspace Sungbo Eo
@ 2021-08-31  6:15         ` Chunfeng Yun (云春峰)
  0 siblings, 0 replies; 29+ messages in thread
From: Chunfeng Yun (云春峰) @ 2021-08-31  6:15 UTC (permalink / raw)
  To: linux-mediatek, mans0n
  Cc: b-liu, linux-kernel, robh+dt, linux-usb, devicetree, frank-w,
	linux-arm-kernel, gregkh, matthias.bgg

On Tue, 2021-08-31 at 00:59 +0900, Sungbo Eo wrote:
> The allow_userspace_control flag enables manual role-switch from
> userspace.
> Turn this feature on like several other USB DRD controller drivers.
> 
> Signed-off-by: Sungbo Eo <mans0n@gorani.run>
> Tested-by: Frank Wunderlich <frank-w@public-files.de>
> ---
>  drivers/usb/musb/mediatek.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/musb/mediatek.c
> b/drivers/usb/musb/mediatek.c
> index 6b92d037d8fc..f5d97eb84cb5 100644
> --- a/drivers/usb/musb/mediatek.c
> +++ b/drivers/usb/musb/mediatek.c
> @@ -185,6 +185,7 @@ static int mtk_otg_switch_init(struct mtk_glue
> *glue)
>  
>  	role_sx_desc.set = musb_usb_role_sx_set;
>  	role_sx_desc.get = musb_usb_role_sx_get;
> +	role_sx_desc.allow_userspace_control = true;
>  	role_sx_desc.fwnode = dev_fwnode(glue->dev);
>  	role_sx_desc.driver_data = glue;
>  	glue->role_sw = usb_role_switch_register(glue->dev,
> &role_sx_desc);

Acked-by: Chunfeng Yun <chunfeng.yun@mediatek.com>

Thanks

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

* Re: [PATCH v4 1/2] arm: dts: mt7623: add musb device nodes
  2021-08-30 15:59       ` [PATCH v4 1/2] arm: dts: mt7623: add musb device nodes Sungbo Eo
@ 2021-08-31  6:27         ` Chunfeng Yun (云春峰)
  2021-08-31  8:59           ` Frank Wunderlich
  2021-09-20 10:48         ` Aw: " Frank Wunderlich
  2021-09-20 12:01         ` Matthias Brugger
  2 siblings, 1 reply; 29+ messages in thread
From: Chunfeng Yun (云春峰) @ 2021-08-31  6:27 UTC (permalink / raw)
  To: linux-mediatek, mans0n
  Cc: b-liu, linux-kernel, robh+dt, linux-usb, devicetree, frank-w,
	linux-arm-kernel, gregkh, matthias.bgg

On Tue, 2021-08-31 at 00:59 +0900, Sungbo Eo wrote:
> MT7623 has an musb controller that is compatible with the one from
> MT2701.
> 
> Signed-off-by: Sungbo Eo <mans0n@gorani.run>
> Tested-by: Frank Wunderlich <frank-w@public-files.de>
> ---
> v4:
> * add tested by Frank
> 
> v3:
> * remove unnecessary status=okay from u2port2
> 
> v2:
> * rename usb3 label to usb0
> * move usb0 & u2phy1 nodes to the right sorted place
> * disable u2phy1 by default
> * correct u2port2 node name to match its reg address
> ---
>  arch/arm/boot/dts/mt7623.dtsi  | 33
> +++++++++++++++++++++++++++++++++
>  arch/arm/boot/dts/mt7623a.dtsi |  4 ++++
>  2 files changed, 37 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/mt7623.dtsi
> b/arch/arm/boot/dts/mt7623.dtsi
> index 3c11f7cfcc40..21c8a291b74e 100644
> --- a/arch/arm/boot/dts/mt7623.dtsi
> +++ b/arch/arm/boot/dts/mt7623.dtsi
> @@ -585,6 +585,39 @@ spi2: spi@11017000 {
>  		status = "disabled";
>  	};
>  
> +	usb0: usb@11200000 {
> +		compatible = "mediatek,mt7623-musb",
> +			     "mediatek,mtk-musb";
> +		reg = <0 0x11200000 0 0x1000>;
> +		interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
> +		interrupt-names = "mc";
> +		phys = <&u2port2 PHY_TYPE_USB2>;
> +		dr_mode = "otg";
> +		clocks = <&pericfg CLK_PERI_USB0>,
> +			 <&pericfg CLK_PERI_USB0_MCU>,
> +			 <&pericfg CLK_PERI_USB_SLV>;
> +		clock-names = "main","mcu","univpll";
> +		power-domains = <&scpsys MT2701_POWER_DOMAIN_IFR_MSC>;
> +		status = "disabled";
> +	};
> +
> +	u2phy1: t-phy@11210000 {
> +		compatible = "mediatek,mt7623-tphy",
> +			     "mediatek,generic-tphy-v1";
> +		reg = <0 0x11210000 0 0x0800>;
> +		#address-cells = <2>;
> +		#size-cells = <2>;
> +		ranges;
> +		status = "disabled";
> +
> +		u2port2: usb-phy@11210800 {
> +			reg = <0 0x11210800 0 0x0100>;
> +			clocks = <&topckgen CLK_TOP_USB_PHY48M>;
> +			clock-names = "ref";
> +			#phy-cells = <1>;
> +		};
> +	};
> +
>  	audsys: clock-controller@11220000 {
>  		compatible = "mediatek,mt7623-audsys",
>  			     "mediatek,mt2701-audsys",
> diff --git a/arch/arm/boot/dts/mt7623a.dtsi
> b/arch/arm/boot/dts/mt7623a.dtsi
> index 0735a1fb8ad9..d304b62d24b5 100644
> --- a/arch/arm/boot/dts/mt7623a.dtsi
> +++ b/arch/arm/boot/dts/mt7623a.dtsi
> @@ -35,6 +35,10 @@ &scpsys {
>  	clock-names = "ethif";
>  };
>  
> +&usb0 {
> +	power-domains = <&scpsys MT7623A_POWER_DOMAIN_IFR_MSC>;
> +};
> +
>  &usb1 {
>  	power-domains = <&scpsys MT7623A_POWER_DOMAIN_HIF>;
>  };

Is the dt-binding patch applied? 
It's better to put it into this series due to the new
compatible "mediatek,mt7623-musb" is used for the first time.

Reviewed-by: Chunfeng Yun <chunfeng.yun@mediatek.com>

Thanks a lot





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

* Re: [PATCH v4 1/2] arm: dts: mt7623: add musb device nodes
  2021-08-31  6:27         ` Chunfeng Yun (云春峰)
@ 2021-08-31  8:59           ` Frank Wunderlich
  2021-08-31 11:02             ` Sungbo Eo
  0 siblings, 1 reply; 29+ messages in thread
From: Frank Wunderlich @ 2021-08-31  8:59 UTC (permalink / raw)
  To: linux-mediatek, Chunfeng Yun (云春峰),
	linux-mediatek, mans0n
  Cc: b-liu, linux-kernel, robh+dt, linux-usb, devicetree,
	linux-arm-kernel, gregkh, matthias.bgg

Am 31. August 2021 08:27:18 MESZ schrieb "Chunfeng Yun (云春峰)" <Chunfeng.Yun@mediatek.com>:

>Is the dt-binding patch applied? 
>It's better to put it into this series due to the new
>compatible "mediatek,mt7623-musb" is used for the first time.
>
>Reviewed-by: Chunfeng Yun <chunfeng.yun@mediatek.com>

Hi,

I don't see [1] (ack from rob) in [2]/[3]

@sungbo: please leave dt-bindings patch in series.
You need no new version only for adding tags (acked,tested or reviewed).
Only for code-changes,but then add tags from previous versions.

Imho it is better to take my musb patch [4]
into the series as well to make depency cleaner

[1] https://patchwork.kernel.org/project/linux-mediatek/patch/20210808123840.176738-2-mans0n@gorani.run/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git/log/?h=for-next
[3] https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux.git/log/?h=for-next
[4] https://patchwork.kernel.org/project/linux-mediatek/patch/20210830145958.108605-1-linux@fw-web.de/
regards Frank

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

* Re: [PATCH v4 1/2] arm: dts: mt7623: add musb device nodes
  2021-08-31  8:59           ` Frank Wunderlich
@ 2021-08-31 11:02             ` Sungbo Eo
  2021-08-31 11:08               ` Aw: " Frank Wunderlich
  0 siblings, 1 reply; 29+ messages in thread
From: Sungbo Eo @ 2021-08-31 11:02 UTC (permalink / raw)
  To: frank-w, linux-mediatek, Chunfeng Yun (云春峰)
  Cc: b-liu, linux-kernel, robh+dt, linux-usb, devicetree,
	linux-arm-kernel, gregkh, matthias.bgg

On 2021-08-31 17:59, Frank Wunderlich wrote:
> Am 31. August 2021 08:27:18 MESZ schrieb "Chunfeng Yun (云春峰)" <Chunfeng.Yun@mediatek.com>:
> 
>> Is the dt-binding patch applied? 
>> It's better to put it into this series due to the new
>> compatible "mediatek,mt7623-musb" is used for the first time.
>>
>> Reviewed-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> 
> Hi,
> 
> I don't see [1] (ack from rob) in [2]/[3]

You can find it here.
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/log/?h=usb-next

> 
> @sungbo: please leave dt-bindings patch in series.

I'll keep it for a while, then.

> You need no new version only for adding tags (acked,tested or reviewed).
> Only for code-changes,but then add tags from previous versions.

Got it. Thanks for the tip. :)

> 
> Imho it is better to take my musb patch [4]
> into the series as well to make depency cleaner

Okay, I'll take it in the next version.

Thanks.

> 
> [1] https://patchwork.kernel.org/project/linux-mediatek/patch/20210808123840.176738-2-mans0n@gorani.run/
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git/log/?h=for-next
> [3] https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux.git/log/?h=for-next
> [4] https://patchwork.kernel.org/project/linux-mediatek/patch/20210830145958.108605-1-linux@fw-web.de/
> regards Frank
> 

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

* Aw: Re: [PATCH v4 1/2] arm: dts: mt7623: add musb device nodes
  2021-08-31 11:02             ` Sungbo Eo
@ 2021-08-31 11:08               ` Frank Wunderlich
  0 siblings, 0 replies; 29+ messages in thread
From: Frank Wunderlich @ 2021-08-31 11:08 UTC (permalink / raw)
  To: Sungbo Eo
  Cc: linux-mediatek, Chunfeng Yun (云春峰),
	b-liu, linux-kernel, robh+dt, linux-usb, devicetree,
	linux-arm-kernel, gregkh, matthias.bgg

> Gesendet: Dienstag, 31. August 2021 um 13:02 Uhr
> Von: "Sungbo Eo" <mans0n@gorani.run>
> On 2021-08-31 17:59, Frank Wunderlich wrote:
> > Am 31. August 2021 08:27:18 MESZ schrieb "Chunfeng Yun (云春峰)" <Chunfeng.Yun@mediatek.com>:

> > I don't see [1] (ack from rob) in [2]/[3]
> 
> You can find it here.
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/log/?h=usb-next
> 
> > 
> > @sungbo: please leave dt-bindings patch in series.
> 
> I'll keep it for a while, then.

ok, then it is not needed again...have not searched in usb-tree.

> > You need no new version only for adding tags (acked,tested or reviewed).
> > Only for code-changes,but then add tags from previous versions.
> 
> Got it. Thanks for the tip. :)
> 
> > Imho it is better to take my musb patch [4]
> > into the series as well to make depency cleaner
> 
> Okay, I'll take it in the next version.

okay, if dt-bindings is already in usb-tree wait what maintainers (matthias/rob) says about adding my patch to a new version of your series or if this is clear now :)

> > [1] https://patchwork.kernel.org/project/linux-mediatek/patch/20210808123840.176738-2-mans0n@gorani.run/
> > [2] https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git/log/?h=for-next
> > [3] https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux.git/log/?h=for-next
> > [4] https://patchwork.kernel.org/project/linux-mediatek/patch/20210830145958.108605-1-linux@fw-web.de/
> > regards Frank
> > 
>

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

* Aw: [PATCH v4 1/2] arm: dts: mt7623: add musb device nodes
  2021-08-30 15:59       ` [PATCH v4 1/2] arm: dts: mt7623: add musb device nodes Sungbo Eo
  2021-08-31  6:27         ` Chunfeng Yun (云春峰)
@ 2021-09-20 10:48         ` Frank Wunderlich
  2021-09-20 12:01         ` Matthias Brugger
  2 siblings, 0 replies; 29+ messages in thread
From: Frank Wunderlich @ 2021-09-20 10:48 UTC (permalink / raw)
  To: Sungbo Eo, Matthias Brugger
  Cc: linux-mediatek, Rob Herring, Matthias Brugger, Bin Liu,
	Greg Kroah-Hartman, devicetree, linux-usb, linux-arm-kernel,
	linux-kernel, Sungbo Eo

Hi,

just a gentle ping for this patch (second part is already merged to usb-tree) and my followup for bpi-r2

https://patchwork.kernel.org/project/linux-mediatek/patch/20210830145958.108605-1-linux@fw-web.de/

regards Frank


> Gesendet: Montag, 30. August 2021 um 17:59 Uhr
> Von: "Sungbo Eo" <mans0n@gorani.run>
> An: linux-mediatek@lists.infradead.org
> Cc: "Rob Herring" <robh+dt@kernel.org>, "Matthias Brugger" <matthias.bgg@gmail.com>, "Bin Liu" <b-liu@ti.com>, "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>, "Frank Wunderlich" <frank-w@public-files.de>, devicetree@vger.kernel.org, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "Sungbo Eo" <mans0n@gorani.run>
> Betreff: [PATCH v4 1/2] arm: dts: mt7623: add musb device nodes
>
> MT7623 has an musb controller that is compatible with the one from MT2701.
>
> Signed-off-by: Sungbo Eo <mans0n@gorani.run>
> Tested-by: Frank Wunderlich <frank-w@public-files.de>
> ---
> v4:
> * add tested by Frank
>
> v3:
> * remove unnecessary status=okay from u2port2
>
> v2:
> * rename usb3 label to usb0
> * move usb0 & u2phy1 nodes to the right sorted place
> * disable u2phy1 by default
> * correct u2port2 node name to match its reg address
> ---
>  arch/arm/boot/dts/mt7623.dtsi  | 33 +++++++++++++++++++++++++++++++++
>  arch/arm/boot/dts/mt7623a.dtsi |  4 ++++
>  2 files changed, 37 insertions(+)
>
> diff --git a/arch/arm/boot/dts/mt7623.dtsi b/arch/arm/boot/dts/mt7623.dtsi
> index 3c11f7cfcc40..21c8a291b74e 100644
> --- a/arch/arm/boot/dts/mt7623.dtsi
> +++ b/arch/arm/boot/dts/mt7623.dtsi
> @@ -585,6 +585,39 @@ spi2: spi@11017000 {
>  		status = "disabled";
>  	};
>
> +	usb0: usb@11200000 {
> +		compatible = "mediatek,mt7623-musb",
> +			     "mediatek,mtk-musb";
> +		reg = <0 0x11200000 0 0x1000>;
> +		interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
> +		interrupt-names = "mc";
> +		phys = <&u2port2 PHY_TYPE_USB2>;
> +		dr_mode = "otg";
> +		clocks = <&pericfg CLK_PERI_USB0>,
> +			 <&pericfg CLK_PERI_USB0_MCU>,
> +			 <&pericfg CLK_PERI_USB_SLV>;
> +		clock-names = "main","mcu","univpll";
> +		power-domains = <&scpsys MT2701_POWER_DOMAIN_IFR_MSC>;
> +		status = "disabled";
> +	};
> +
> +	u2phy1: t-phy@11210000 {
> +		compatible = "mediatek,mt7623-tphy",
> +			     "mediatek,generic-tphy-v1";
> +		reg = <0 0x11210000 0 0x0800>;
> +		#address-cells = <2>;
> +		#size-cells = <2>;
> +		ranges;
> +		status = "disabled";
> +
> +		u2port2: usb-phy@11210800 {
> +			reg = <0 0x11210800 0 0x0100>;
> +			clocks = <&topckgen CLK_TOP_USB_PHY48M>;
> +			clock-names = "ref";
> +			#phy-cells = <1>;
> +		};
> +	};
> +
>  	audsys: clock-controller@11220000 {
>  		compatible = "mediatek,mt7623-audsys",
>  			     "mediatek,mt2701-audsys",
> diff --git a/arch/arm/boot/dts/mt7623a.dtsi b/arch/arm/boot/dts/mt7623a.dtsi
> index 0735a1fb8ad9..d304b62d24b5 100644
> --- a/arch/arm/boot/dts/mt7623a.dtsi
> +++ b/arch/arm/boot/dts/mt7623a.dtsi
> @@ -35,6 +35,10 @@ &scpsys {
>  	clock-names = "ethif";
>  };
>
> +&usb0 {
> +	power-domains = <&scpsys MT7623A_POWER_DOMAIN_IFR_MSC>;
> +};
> +
>  &usb1 {
>  	power-domains = <&scpsys MT7623A_POWER_DOMAIN_HIF>;
>  };
> --
> 2.33.0
>
>
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
>

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

* Re: [PATCH v4 1/2] arm: dts: mt7623: add musb device nodes
  2021-08-30 15:59       ` [PATCH v4 1/2] arm: dts: mt7623: add musb device nodes Sungbo Eo
  2021-08-31  6:27         ` Chunfeng Yun (云春峰)
  2021-09-20 10:48         ` Aw: " Frank Wunderlich
@ 2021-09-20 12:01         ` Matthias Brugger
  2 siblings, 0 replies; 29+ messages in thread
From: Matthias Brugger @ 2021-09-20 12:01 UTC (permalink / raw)
  To: Sungbo Eo, linux-mediatek
  Cc: Rob Herring, Bin Liu, Greg Kroah-Hartman, Frank Wunderlich,
	devicetree, linux-usb, linux-arm-kernel, linux-kernel



On 30/08/2021 17:59, Sungbo Eo wrote:
> MT7623 has an musb controller that is compatible with the one from MT2701.
> 
> Signed-off-by: Sungbo Eo <mans0n@gorani.run>
> Tested-by: Frank Wunderlich <frank-w@public-files.de>

Applied to v5.15-next/dts32

Thanks

> ---
> v4:
> * add tested by Frank
> 
> v3:
> * remove unnecessary status=okay from u2port2
> 
> v2:
> * rename usb3 label to usb0
> * move usb0 & u2phy1 nodes to the right sorted place
> * disable u2phy1 by default
> * correct u2port2 node name to match its reg address
> ---
>   arch/arm/boot/dts/mt7623.dtsi  | 33 +++++++++++++++++++++++++++++++++
>   arch/arm/boot/dts/mt7623a.dtsi |  4 ++++
>   2 files changed, 37 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/mt7623.dtsi b/arch/arm/boot/dts/mt7623.dtsi
> index 3c11f7cfcc40..21c8a291b74e 100644
> --- a/arch/arm/boot/dts/mt7623.dtsi
> +++ b/arch/arm/boot/dts/mt7623.dtsi
> @@ -585,6 +585,39 @@ spi2: spi@11017000 {
>   		status = "disabled";
>   	};
>   
> +	usb0: usb@11200000 {
> +		compatible = "mediatek,mt7623-musb",
> +			     "mediatek,mtk-musb";
> +		reg = <0 0x11200000 0 0x1000>;
> +		interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
> +		interrupt-names = "mc";
> +		phys = <&u2port2 PHY_TYPE_USB2>;
> +		dr_mode = "otg";
> +		clocks = <&pericfg CLK_PERI_USB0>,
> +			 <&pericfg CLK_PERI_USB0_MCU>,
> +			 <&pericfg CLK_PERI_USB_SLV>;
> +		clock-names = "main","mcu","univpll";
> +		power-domains = <&scpsys MT2701_POWER_DOMAIN_IFR_MSC>;
> +		status = "disabled";
> +	};
> +
> +	u2phy1: t-phy@11210000 {
> +		compatible = "mediatek,mt7623-tphy",
> +			     "mediatek,generic-tphy-v1";
> +		reg = <0 0x11210000 0 0x0800>;
> +		#address-cells = <2>;
> +		#size-cells = <2>;
> +		ranges;
> +		status = "disabled";
> +
> +		u2port2: usb-phy@11210800 {
> +			reg = <0 0x11210800 0 0x0100>;
> +			clocks = <&topckgen CLK_TOP_USB_PHY48M>;
> +			clock-names = "ref";
> +			#phy-cells = <1>;
> +		};
> +	};
> +
>   	audsys: clock-controller@11220000 {
>   		compatible = "mediatek,mt7623-audsys",
>   			     "mediatek,mt2701-audsys",
> diff --git a/arch/arm/boot/dts/mt7623a.dtsi b/arch/arm/boot/dts/mt7623a.dtsi
> index 0735a1fb8ad9..d304b62d24b5 100644
> --- a/arch/arm/boot/dts/mt7623a.dtsi
> +++ b/arch/arm/boot/dts/mt7623a.dtsi
> @@ -35,6 +35,10 @@ &scpsys {
>   	clock-names = "ethif";
>   };
>   
> +&usb0 {
> +	power-domains = <&scpsys MT7623A_POWER_DOMAIN_IFR_MSC>;
> +};
> +
>   &usb1 {
>   	power-domains = <&scpsys MT7623A_POWER_DOMAIN_HIF>;
>   };
> 

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

end of thread, other threads:[~2021-09-20 12:01 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-03 15:13 [PATCH 0/2] Add MUSB for MT7623 Sungbo Eo
2021-08-03 15:13 ` [PATCH 1/2] dt-bindings: usb: mtk-musb: add MT7623 compatible Sungbo Eo
2021-08-04 15:01   ` Matthias Brugger
2021-08-03 15:13 ` [PATCH 2/2] arm: dts: mt7623: add musb device nodes Sungbo Eo
2021-08-03 17:15 ` Aw: [PATCH 0/2] Add MUSB for MT7623 Frank Wunderlich
2021-08-04  0:14   ` Sungbo Eo
2021-08-04  8:11     ` Aw: " Frank Wunderlich
2021-08-05  1:34       ` Sungbo Eo
2021-08-04 11:33     ` Frank Wunderlich
2021-08-04 15:01 ` Matthias Brugger
2021-08-05  1:36   ` Sungbo Eo
2021-08-08 12:38 ` [PATCH v2 " Sungbo Eo
2021-08-08 12:38   ` [PATCH v2 1/2] dt-bindings: usb: mtk-musb: add MT7623 compatible Sungbo Eo
2021-08-13 20:49     ` Rob Herring
2021-08-08 12:38   ` [PATCH v2 2/2] arm: dts: mt7623: add musb device nodes Sungbo Eo
2021-08-13 20:48     ` Rob Herring
2021-08-22  4:13   ` [PATCH v3 0/1] Add MUSB for MT7623 Sungbo Eo
2021-08-22  4:13     ` [PATCH v3 1/1] arm: dts: mt7623: add musb device nodes Sungbo Eo
2021-08-30 15:17       ` Aw: " Frank Wunderlich
2021-08-30 15:59     ` [PATCH v4 0/2] Add MUSB for MT7623 Sungbo Eo
2021-08-30 15:59       ` [PATCH v4 1/2] arm: dts: mt7623: add musb device nodes Sungbo Eo
2021-08-31  6:27         ` Chunfeng Yun (云春峰)
2021-08-31  8:59           ` Frank Wunderlich
2021-08-31 11:02             ` Sungbo Eo
2021-08-31 11:08               ` Aw: " Frank Wunderlich
2021-09-20 10:48         ` Aw: " Frank Wunderlich
2021-09-20 12:01         ` Matthias Brugger
2021-08-30 15:59       ` [PATCH v4 2/2] usb: musb: mediatek: Expose role-switch control to userspace Sungbo Eo
2021-08-31  6:15         ` 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).