* [RFC PATCH 0/4] USB support for TQMa8MPxL + MBa8MPxL
@ 2022-06-22 13:04 Alexander Stein
2022-06-22 13:04 ` [RFC PATCH 1/4] dt-bindings: usb: dwc3: Add gfladj-refclk-lpm-sel-quirk Alexander Stein
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Alexander Stein @ 2022-06-22 13:04 UTC (permalink / raw)
To: Greg Kroah-Hartman, Shawn Guo, Sascha Hauer, Fabio Estevam, Felipe Balbi
Cc: Alexander Stein, linux-usb, linux-arm-kernel
Hi everybody,
this is an RFC for USB support on TQMa8MPxL + MBa8MPxL. DT support is currently
in progress at [1]. This series is on top of that.
The DT configuration itself (patch 4) is rather straight forward, but leads to
the following dmesg errors regarding superspeed ports:
> [ 8.549243] hub 2-1:1.0: hub_ext_port_status failed (err = -110)
> [ 22.885263] usb 2-1: Failed to suspend device, error -110
This hardware works fine using the downstream kernel, because for imx8mp this
ITP sync feature is enabled conditionally [2] & [3].
Hacking this into mainline resulted in a working superspeed setup as well. I
also noticed that on some android kernel [4] depending in IP core version either
GCTL.SOFTITPSYNC or GFLADJ.GFLADJ_REFCLK_LPM_SEL is enabled unconditionally.
So I opted for the latter one using some quirk (patch 1-3).
I have to admit I do not know what this is actually about, nor why my setup
does not work without this change or why this fixed my problem. So maybe
someone with more knowledge can say if this is the way to go or what this is
about.
Note: I excluded the DT guys (for now) as this is more about usb internals, the
DT patches are for completeness.
Thanks and best regards,
Alexander
[1] https://patchwork.kernel.org/project/linux-arm-kernel/cover/20220622114949.889274-1-alexander.stein@ew.tq-group.com/
[2] https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/usb/dwc3/dwc3-imx8mp.c?h=lf-5.10.y#n134
[3] https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/usb/dwc3/core.c?h=lf-5.10.y#n333
[4] https://android.googlesource.com/kernel/msm/+/87a6b154766907020cc74c7726e8a68aaa9d7f6b%5E%21/#F0
Alexander Stein (4):
dt-bindings: usb: dwc3: Add gfladj-refclk-lpm-sel-quirk
usb: dwc3: core: add gfladj_refclk_lpm_sel quirk
arm64: dts: imx8mp: Add snps,gfladj-refclk-lpm-sel quirk to USB nodes
arm64: dts: tqma8mpql: add USB support
.../devicetree/bindings/usb/snps,dwc3.yaml | 5 ++
.../freescale/imx8mp-tqma8mpql-mba8mpxl.dts | 68 ++++++++++++++++++-
arch/arm64/boot/dts/freescale/imx8mp.dtsi | 2 +
drivers/usb/dwc3/core.c | 8 ++-
drivers/usb/dwc3/core.h | 2 +
5 files changed, 83 insertions(+), 2 deletions(-)
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [RFC PATCH 1/4] dt-bindings: usb: dwc3: Add gfladj-refclk-lpm-sel-quirk
2022-06-22 13:04 [RFC PATCH 0/4] USB support for TQMa8MPxL + MBa8MPxL Alexander Stein
@ 2022-06-22 13:04 ` Alexander Stein
2022-06-22 13:04 ` [RFC PATCH 2/4] usb: dwc3: core: add gfladj_refclk_lpm_sel quirk Alexander Stein
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Alexander Stein @ 2022-06-22 13:04 UTC (permalink / raw)
To: Greg Kroah-Hartman, Shawn Guo, Sascha Hauer, Fabio Estevam, Felipe Balbi
Cc: Alexander Stein, linux-usb, linux-arm-kernel
This selects SOF/ITP to be running on ref_clk.
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
index d41265ba8ce2..efc755502d0a 100644
--- a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
+++ b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
@@ -234,6 +234,11 @@ properties:
avoid -EPROTO errors with usbhid on some devices (Hikey 970).
type: boolean
+ snps,gfladj-refclk-lpm-sel-quirk:
+ description:
+ When set, run the SOF/ITP counter based on ref_clk.
+ type: boolean
+
snps,is-utmi-l1-suspend:
description:
True when DWC3 asserts output signal utmi_l1_suspend_n, false when
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [RFC PATCH 2/4] usb: dwc3: core: add gfladj_refclk_lpm_sel quirk
2022-06-22 13:04 [RFC PATCH 0/4] USB support for TQMa8MPxL + MBa8MPxL Alexander Stein
2022-06-22 13:04 ` [RFC PATCH 1/4] dt-bindings: usb: dwc3: Add gfladj-refclk-lpm-sel-quirk Alexander Stein
@ 2022-06-22 13:04 ` Alexander Stein
2022-06-22 13:04 ` [RFC PATCH 3/4] arm64: dts: imx8mp: Add snps,gfladj-refclk-lpm-sel quirk to USB nodes Alexander Stein
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Alexander Stein @ 2022-06-22 13:04 UTC (permalink / raw)
To: Greg Kroah-Hartman, Shawn Guo, Sascha Hauer, Fabio Estevam, Felipe Balbi
Cc: Alexander Stein, linux-usb, linux-arm-kernel
This selects the SOF/ITP counter be running on ref_clk. As documented
U2_FREECLK_EXISTS has to be set to 0 as well.
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
drivers/usb/dwc3/core.c | 8 +++++++-
drivers/usb/dwc3/core.h | 2 ++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index cb8742f2a4b0..e000f3898a6a 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -403,6 +403,10 @@ static void dwc3_ref_clk_period(struct dwc3 *dwc)
reg |= FIELD_PREP(DWC3_GFLADJ_REFCLK_FLADJ_MASK, fladj)
| FIELD_PREP(DWC3_GFLADJ_240MHZDECR, decr >> 1)
| FIELD_PREP(DWC3_GFLADJ_240MHZDECR_PLS1, decr & 1);
+
+ if (dwc->gfladj_refclk_lpm_sel)
+ reg |= DWC3_GFLADJ_REFCLK_LPM_SEL;
+
dwc3_writel(dwc->regs, DWC3_GFLADJ, reg);
}
@@ -784,7 +788,7 @@ static int dwc3_phy_setup(struct dwc3 *dwc)
else
reg |= DWC3_GUSB2PHYCFG_ENBLSLPM;
- if (dwc->dis_u2_freeclk_exists_quirk)
+ if (dwc->dis_u2_freeclk_exists_quirk || dwc->gfladj_refclk_lpm_sel)
reg &= ~DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS;
dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
@@ -1519,6 +1523,8 @@ static void dwc3_get_properties(struct dwc3 *dwc)
"snps,dis-tx-ipgap-linecheck-quirk");
dwc->parkmode_disable_ss_quirk = device_property_read_bool(dev,
"snps,parkmode-disable-ss-quirk");
+ dwc->gfladj_refclk_lpm_sel = device_property_read_bool(dev,
+ "snps,gfladj-refclk-lpm-sel-quirk");
dwc->tx_de_emphasis_quirk = device_property_read_bool(dev,
"snps,tx_de_emphasis_quirk");
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 722808d8c0af..92ce2743ccc8 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -391,6 +391,7 @@
#define DWC3_GFLADJ_30MHZ_SDBND_SEL BIT(7)
#define DWC3_GFLADJ_30MHZ_MASK 0x3f
#define DWC3_GFLADJ_REFCLK_FLADJ_MASK GENMASK(21, 8)
+#define DWC3_GFLADJ_REFCLK_LPM_SEL BIT(23)
#define DWC3_GFLADJ_240MHZDECR GENMASK(30, 24)
#define DWC3_GFLADJ_240MHZDECR_PLS1 BIT(31)
@@ -1310,6 +1311,7 @@ struct dwc3 {
unsigned dis_del_phy_power_chg_quirk:1;
unsigned dis_tx_ipgap_linecheck_quirk:1;
unsigned parkmode_disable_ss_quirk:1;
+ unsigned gfladj_refclk_lpm_sel:1;
unsigned tx_de_emphasis_quirk:1;
unsigned tx_de_emphasis:2;
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [RFC PATCH 3/4] arm64: dts: imx8mp: Add snps,gfladj-refclk-lpm-sel quirk to USB nodes
2022-06-22 13:04 [RFC PATCH 0/4] USB support for TQMa8MPxL + MBa8MPxL Alexander Stein
2022-06-22 13:04 ` [RFC PATCH 1/4] dt-bindings: usb: dwc3: Add gfladj-refclk-lpm-sel-quirk Alexander Stein
2022-06-22 13:04 ` [RFC PATCH 2/4] usb: dwc3: core: add gfladj_refclk_lpm_sel quirk Alexander Stein
@ 2022-06-22 13:04 ` Alexander Stein
2022-06-22 13:04 ` [RFC PATCH 4/4] arm64: dts: tqma8mpql: add USB support Alexander Stein
2022-09-05 3:28 ` [RFC PATCH 0/4] USB support for TQMa8MPxL + MBa8MPxL Jun Li
4 siblings, 0 replies; 6+ messages in thread
From: Alexander Stein @ 2022-06-22 13:04 UTC (permalink / raw)
To: Greg Kroah-Hartman, Shawn Guo, Sascha Hauer, Fabio Estevam, Felipe Balbi
Cc: Alexander Stein, linux-usb, linux-arm-kernel
With this set the SOF/ITP counter is based on ref_clk when 2.0 ports are
suspended.
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
arch/arm64/boot/dts/freescale/imx8mp.dtsi | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
index cbfe841fa38b..5f10fa6a3fde 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
@@ -1170,6 +1170,7 @@ usb_dwc3_0: usb@38100000 {
phys = <&usb3_phy0>, <&usb3_phy0>;
phy-names = "usb2-phy", "usb3-phy";
snps,dis-u2-freeclk-exists-quirk;
+ snps,gfladj-refclk-lpm-sel-quirk;
};
};
@@ -1212,6 +1213,7 @@ usb_dwc3_1: usb@38200000 {
phys = <&usb3_phy1>, <&usb3_phy1>;
phy-names = "usb2-phy", "usb3-phy";
snps,dis-u2-freeclk-exists-quirk;
+ snps,gfladj-refclk-lpm-sel-quirk;
};
};
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [RFC PATCH 4/4] arm64: dts: tqma8mpql: add USB support
2022-06-22 13:04 [RFC PATCH 0/4] USB support for TQMa8MPxL + MBa8MPxL Alexander Stein
` (2 preceding siblings ...)
2022-06-22 13:04 ` [RFC PATCH 3/4] arm64: dts: imx8mp: Add snps,gfladj-refclk-lpm-sel quirk to USB nodes Alexander Stein
@ 2022-06-22 13:04 ` Alexander Stein
2022-09-05 3:28 ` [RFC PATCH 0/4] USB support for TQMa8MPxL + MBa8MPxL Jun Li
4 siblings, 0 replies; 6+ messages in thread
From: Alexander Stein @ 2022-06-22 13:04 UTC (permalink / raw)
To: Greg Kroah-Hartman, Shawn Guo, Sascha Hauer, Fabio Estevam, Felipe Balbi
Cc: Alexander Stein, linux-usb, linux-arm-kernel
With last feature bits added, USB is supported on TQMa8MPQL for both host
and DR interface.
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
.../freescale/imx8mp-tqma8mpql-mba8mpxl.dts | 68 ++++++++++++++++++-
1 file changed, 67 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/freescale/imx8mp-tqma8mpql-mba8mpxl.dts b/arch/arm64/boot/dts/freescale/imx8mp-tqma8mpql-mba8mpxl.dts
index 772cbb664b2a..d8947a180318 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp-tqma8mpql-mba8mpxl.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mp-tqma8mpql-mba8mpxl.dts
@@ -272,7 +272,7 @@ &flexcan2 {
&gpio1 {
pinctrl-names = "default";
- pinctrl-0 = <&pinctrl_gpio1>;
+ pinctrl-0 = <&pinctrl_gpio1>, <&pinctrl_usbhub>;
gpio-line-names = "GPO1", "GPO0", "", "GPO3",
"", "", "GPO2", "GPI0",
@@ -282,6 +282,13 @@ &gpio1 {
"", "", "", "",
"", "", "", "",
"", "", "", "";
+
+ usb-hub-reset-hog {
+ gpio-hog;
+ gpios = <11 0>;
+ output-high;
+ line-name = "USB_HUB_RST#";
+ };
};
&gpio2 {
@@ -465,6 +472,52 @@ &usdhc2 {
status = "okay";
};
+&usb3_phy0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_usb0>;
+ status = "okay";
+};
+
+&usb3_0 {
+ fsl,over-current-active-low;
+ status = "okay";
+};
+
+&usb_dwc3_0 {
+ /* dual role is implemented, but not a full featured OTG */
+ hnp-disable;
+ srp-disable;
+ adp-disable;
+ dr_mode = "otg";
+ usb-role-switch;
+ role-switch-default-mode = "peripheral";
+ status = "okay";
+
+ connector {
+ compatible = "gpio-usb-b-connector", "usb-b-connector";
+ type = "micro";
+ label = "X29";
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_usbcon0>;
+ id-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
+ };
+};
+
+&usb3_phy1 {
+ status = "okay";
+};
+
+&usb3_1 {
+ fsl,disable-port-power-control;
+ fsl,permanently-attached;
+ status = "okay";
+};
+
+&usb_dwc3_1 {
+ dr_mode = "host";
+ status = "okay";
+};
+
&iomuxc {
pinctrl_backlight: backlightgrp {
fsl,pins = <MX8MP_IOMUXC_SAI5_RXFS__GPIO3_IO19 0x14>;
@@ -672,6 +725,19 @@ pinctrl_uart4: uart4grp {
<MX8MP_IOMUXC_UART4_TXD__UART4_DCE_TX 0x140>;
};
+ pinctrl_usbcon0: usb0congrp {
+ fsl,pins = <MX8MP_IOMUXC_GPIO1_IO10__GPIO1_IO10 0x1c0>;
+ };
+
+ pinctrl_usb0: usb0grp {
+ fsl,pins = <MX8MP_IOMUXC_GPIO1_IO13__USB1_OTG_OC 0x1c0>,
+ <MX8MP_IOMUXC_GPIO1_IO12__USB1_OTG_PWR 0x1c0>;
+ };
+
+ pinctrl_usbhub: usbhubgrp {
+ fsl,pins = <MX8MP_IOMUXC_GPIO1_IO11__GPIO1_IO11 0x10>;
+ };
+
pinctrl_usdhc2: usdhc2grp {
fsl,pins = <MX8MP_IOMUXC_SD2_CLK__USDHC2_CLK 0x192>,
<MX8MP_IOMUXC_SD2_CMD__USDHC2_CMD 0x1d2>,
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [RFC PATCH 0/4] USB support for TQMa8MPxL + MBa8MPxL
2022-06-22 13:04 [RFC PATCH 0/4] USB support for TQMa8MPxL + MBa8MPxL Alexander Stein
` (3 preceding siblings ...)
2022-06-22 13:04 ` [RFC PATCH 4/4] arm64: dts: tqma8mpql: add USB support Alexander Stein
@ 2022-09-05 3:28 ` Jun Li
4 siblings, 0 replies; 6+ messages in thread
From: Jun Li @ 2022-09-05 3:28 UTC (permalink / raw)
To: Alexander Stein
Cc: Greg Kroah-Hartman, Shawn Guo, Sascha Hauer, Fabio Estevam,
Felipe Balbi, Linux USB List, linux-arm-kernel, Li Jun,
linux-imx
Hi Alexander,
Alexander Stein <alexander.stein@ew.tq-group.com> 于2022年6月22日周三 21:13写道:
>
> Hi everybody,
>
> this is an RFC for USB support on TQMa8MPxL + MBa8MPxL. DT support is currently
> in progress at [1]. This series is on top of that.
> The DT configuration itself (patch 4) is rather straight forward, but leads to
> the following dmesg errors regarding superspeed ports:
> > [ 8.549243] hub 2-1:1.0: hub_ext_port_status failed (err = -110)
> > [ 22.885263] usb 2-1: Failed to suspend device, error -110
>
> This hardware works fine using the downstream kernel, because for imx8mp this
> ITP sync feature is enabled conditionally [2] & [3].
> Hacking this into mainline resulted in a working superspeed setup as well. I
> also noticed that on some android kernel [4] depending in IP core version either
> GCTL.SOFTITPSYNC or GFLADJ.GFLADJ_REFCLK_LPM_SEL is enabled unconditionally.
> So I opted for the latter one using some quirk (patch 1-3).
>
> I have to admit I do not know what this is actually about, nor why my setup
> does not work without this change or why this fixed my problem. So maybe
> someone with more knowledge can say if this is the way to go or what this is
> about.
Found this patch set some late.
Yes, your choice to enable GFLADJ.GFLADJ_REFCLK_LPM_SEL
is the right setting after checking with Synopsys, which can make USB2
with LPM supported devices work as well, as SOFTIPSYNC has below
description:
"If you plan to enable hardware-based LPM or software-based LPM
(PORTPMSC. HLE=1), then you cannot use this feature. Turn off
this feature by setting this bit to '0' and use the
GFLADJ.GFLADJ_REFCLK_LPM_SEL feature."
So could you please remove RFC mark and resume this
topic?
Thanks
Li Jun
>
> Note: I excluded the DT guys (for now) as this is more about usb internals, the
> DT patches are for completeness.
>
> Thanks and best regards,
> Alexander
>
> [1] https://patchwork.kernel.org/project/linux-arm-kernel/cover/20220622114949.889274-1-alexander.stein@ew.tq-group.com/
> [2] https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/usb/dwc3/dwc3-imx8mp.c?h=lf-5.10.y#n134
> [3] https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/usb/dwc3/core.c?h=lf-5.10.y#n333
> [4] https://android.googlesource.com/kernel/msm/+/87a6b154766907020cc74c7726e8a68aaa9d7f6b%5E%21/#F0
>
> Alexander Stein (4):
> dt-bindings: usb: dwc3: Add gfladj-refclk-lpm-sel-quirk
> usb: dwc3: core: add gfladj_refclk_lpm_sel quirk
> arm64: dts: imx8mp: Add snps,gfladj-refclk-lpm-sel quirk to USB nodes
> arm64: dts: tqma8mpql: add USB support
>
> .../devicetree/bindings/usb/snps,dwc3.yaml | 5 ++
> .../freescale/imx8mp-tqma8mpql-mba8mpxl.dts | 68 ++++++++++++++++++-
> arch/arm64/boot/dts/freescale/imx8mp.dtsi | 2 +
> drivers/usb/dwc3/core.c | 8 ++-
> drivers/usb/dwc3/core.h | 2 +
> 5 files changed, 83 insertions(+), 2 deletions(-)
>
> --
> 2.25.1
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-09-05 3:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-22 13:04 [RFC PATCH 0/4] USB support for TQMa8MPxL + MBa8MPxL Alexander Stein
2022-06-22 13:04 ` [RFC PATCH 1/4] dt-bindings: usb: dwc3: Add gfladj-refclk-lpm-sel-quirk Alexander Stein
2022-06-22 13:04 ` [RFC PATCH 2/4] usb: dwc3: core: add gfladj_refclk_lpm_sel quirk Alexander Stein
2022-06-22 13:04 ` [RFC PATCH 3/4] arm64: dts: imx8mp: Add snps,gfladj-refclk-lpm-sel quirk to USB nodes Alexander Stein
2022-06-22 13:04 ` [RFC PATCH 4/4] arm64: dts: tqma8mpql: add USB support Alexander Stein
2022-09-05 3:28 ` [RFC PATCH 0/4] USB support for TQMa8MPxL + MBa8MPxL Jun Li
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).