Skip to contentSkip to conversation

dt-bindings: usb: mtk-xhci: add support 'resets' property

PATCH In review Chunfeng Yun 4 participants 12 messages May 23, 2022 – Jun 2, 2022

Subsystems (5)
lore
Share & tools
lore

Chunfeng Yun

author maintainer
#0 lore raw

PATCH 1/4 dt-bindings: usb: mtk-xhci: add support 'resets' property

Add 'resets' property to support IP reset usually by top pericfg.

---
 Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml +3 -0
index 084d7135b2d9..892718459d25 100644
@@ -113,6 +113,9 @@ properties:
   vbus-supply:
     description: Regulator of USB VBUS5v
 
+  resets:
+    maxItems: 1
+
   usb3-lpm-capable: true
 
   usb2-lpm-disable: true
Signature · 1 line
2.18.0
author maintainer
#1 lore raw

PATCH 2/4 dt-bindings: usb: mtu3: add support 'resets' property

Add 'resets' property to support IP reset usually by top pericfg.

---
 Documentation/devicetree/bindings/usb/mediatek,mtu3.yaml | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/usb/mediatek,mtu3.yaml +3 -0
index df766f8de872..208d3f780b2a 100644
@@ -106,6 +106,9 @@ properties:
   maximum-speed:
     enum: [super-speed-plus, super-speed, high-speed, full-speed]
 
+  resets:
+    maxItems: 1
+
   "#address-cells":
     enum: [1, 2]
 
Signature · 1 line
2.18.0
author maintainer
#4 lore raw

PATCH 3/4 usb: xhci-mtk: add support optional controller reset

In reply to Chunfeng Yun

Add support controller reset via a reset-controller usually in infracfg, it's different with the software reset by IPPC which only used to reset MAC, and it will also reset IPPC meanwhile.

---
 drivers/usb/host/xhci-mtk.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/usb/host/xhci-mtk.c +7 -0
index b1045f534a4b..01705e559c42 100644
@@ -18,6 +18,7 @@
 #include <linux/pm_wakeirq.h>
 #include <linux/regmap.h>
 #include <linux/regulator/consumer.h>
+#include <linux/reset.h>
 
 #include "xhci.h"
 #include "xhci-mtk.h"
@@ -550,6 +551,12 @@ static int xhci_mtk_probe(struct platform_device *pdev)
 	if (ret)
 		goto disable_ldos;
 
+	ret = device_reset_optional(dev);
+	if (ret) {
+		dev_err_probe(dev, ret, "failed to reset controller\n");
+		goto disable_clk;
+	}
+
 	hcd = usb_create_hcd(driver, dev, dev_name(dev));
 	if (!hcd) {
 		ret = -ENOMEM;
Signature · 1 line
2.18.0
maintainer Reviewed-by on v1 3/4
#5 lore raw

Re: [PATCH 3/4] usb: xhci-mtk: add support optional controller reset

Il 23/05/22 11:04, Chunfeng Yun ha scritto:

Quoted 5 lines

Add support controller reset via a reset-controller usually in infracfg, it's different with the software reset by IPPC which only used to reset MAC, and it will also reset IPPC meanwhile.

author maintainer
#6 lore raw

PATCH 4/4 usb: mtu3: add support controller reset

In reply to Chunfeng Yun

Add support controller reset via a reset-controller usually in infracfg, it's different with the software reset by IPPC which only used to reset MAC, and it will also reset IPPC meanwhile.

---
 drivers/usb/mtu3/mtu3_plat.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/usb/mtu3/mtu3_plat.c +7 -0
index 4309ed939178..d14494b30064 100644
@@ -13,6 +13,7 @@
 #include <linux/of_irq.h>
 #include <linux/platform_device.h>
 #include <linux/pm_wakeirq.h>
+#include <linux/reset.h>
 
 #include "mtu3.h"
 #include "mtu3_dr.h"
@@ -345,6 +346,12 @@ static int mtu3_probe(struct platform_device *pdev)
 		dev_info(dev, "wakeup irq %d\n", ssusb->wakeup_irq);
 	}
 
+	ret = device_reset_optional(dev);
+	if (ret) {
+		dev_err_probe(dev, ret, "failed to reset controller\n");
+		goto comm_exit;
+	}
+
 	ssusb_ip_sw_reset(ssusb);
 
 	if (IS_ENABLED(CONFIG_USB_MTU3_HOST))
Signature · 1 line
2.18.0
maintainer Reviewed-by on v1 4/4
#7 lore raw

Re: [PATCH 4/4] usb: mtu3: add support controller reset

Il 23/05/22 11:04, Chunfeng Yun ha scritto:

Quoted 5 lines

Add support controller reset via a reset-controller usually in infracfg, it's different with the software reset by IPPC which only used to reset MAC, and it will also reset IPPC meanwhile.

#8 lore raw
In reply to Chunfeng Yun
Quoted 14 lines · Chunfeng Yun

Add 'resets' property to support IP reset usually by top pericfg.

---
 Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml | 3 +++
 1 file changed, 3 insertions(+)
(quoted diff) +0 -0

xhci.yaml b/Documentation/devicetree/bindings/usb/mediatek,mtk- xhci.yaml
index 084d7135b2d9..892718459d25 100644

Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml properties: · line 121

Quoted 9 lines
Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml +3 -0
@@ -113,6 +113,9 @@ properties:
   vbus-supply:
     description: Regulator of USB VBUS5v
 
+  resets:
+    maxItems: 1
+
   usb3-lpm-capable: true
 
   usb2-lpm-disable: true

Hello Chunfeng,

Which soc we will use this reset?
I am upstreaming another series for system clock reset. I think you should add how to use for this series base on [1].

[1]:
https://lore.kernel.org/linux-clk/[email protected]/T/#m5b6abb9bd2109e4ed9a1a3eeee6e7976892cb8c2

BRs,
Rex

author maintainer
#9 lore raw

Hi Rex-BC,

Quoted 24 lines · Rex-BC Chen
Quoted 23 lines · Chunfeng Yun

Add 'resets' property to support IP reset usually by top pericfg.

---
 Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml | 3
+++
 1 file changed, 3 insertions(+)
(quoted diff) +0 -0

xhci.yaml b/Documentation/devicetree/bindings/usb/mediatek,mtk- xhci.yaml
index 084d7135b2d9..892718459d25 100644

Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml +3 -0
@@ -113,6 +113,9 @@ properties:
   vbus-supply:
     description: Regulator of USB VBUS5v
 
+  resets:
+    maxItems: 1
+
   usb3-lpm-capable: true
 
Quoted 5 lines

Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml properties: · line 121

Quoted 1 line
Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml +0 -0
   usb2-lpm-disable: true

Hello Chunfeng,

Which soc we will use this reset?

This is common for all SoCs, can use it if there is a reset controller driver supported.

Quoted 1 line

I am upstreaming another series for system clock reset.

That's good

Quoted 1 line

I think you should add how to use for this series base on [1].

Currently I test it on mt8195 based on ti-syscon reset driver, luckly this is transparent for our usb controller drivers;

I could add patches to use this 'resets' property on mt8195/8186 if the below series are applied.

Thanks

Quoted 3 lines

[1]:

https://lore.kernel.org/linux-clk/[email protected]/T/#m5b6abb9bd2109e4ed9a1a3eeee6e7976892cb8c2

Quoted 4 lines

BRs,
Rex