2024-02-13 15:09:08

by Nícolas F. R. A. Prado

[permalink] [raw]
Subject: [PATCH v2 0/2] arm64: dts: mediatek: mt8186: Fixes for ssusb hang using defconfig

Two fixes in ssusb components (the power domain and usb controller) to
allow them to successfully probe and the mt8186 to boot using the
upstream defconfig.

Signed-off-by: Nícolas F. R. A. Prado <[email protected]>
---
Changes in v2:
- Moved the XHCI clock from the power domain to the mtu3 node and to a
separate commit
- Link to v1: https://lore.kernel.org/r/20240212-mt8186-ssusb-domain-clk-fix-v1-1-26cb98746aa3@collabora.com

---
Nícolas F. R. A. Prado (2):
arm64: dts: mediatek: mt8186: Add missing clocks to ssusb power domains
arm64: dts: mediatek: mt8186: Add missing xhci clock to usb controllers

arch/arm64/boot/dts/mediatek/mt8186.dtsi | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
---
base-commit: 2ae0a045e6814c8c1d676d6153c605a65746aa29
change-id: 20240212-mt8186-ssusb-domain-clk-fix-a691eec834fd

Best regards,
--
Nícolas F. R. A. Prado <[email protected]>



2024-02-13 15:09:16

by Nícolas F. R. A. Prado

[permalink] [raw]
Subject: [PATCH v2 1/2] arm64: dts: mediatek: mt8186: Add missing clocks to ssusb power domains

The ssusb power domains currently don't list any clocks, despite
depending on some, and thus rely on the bootloader leaving the required
clocks on in order to work.

When booting with the upstream arm64 defconfig, the power domain
controller will defer probe until modules have loaded since it has an
indirect dependency on CONFIG_MTK_CMDQ, which is configured as a module.
However at the point where modules are loaded, unused clocks are also
disabled, causing the ssusb domains to fail to be enabled and
consequently the controller to fail probe:

mtk-power-controller 10006000.syscon:power-controller: /soc/syscon@10006000/power-controller/power-domain@4: failed to power on domain: -110
mtk-power-controller: probe of 10006000.syscon:power-controller failed with error -110

Add the missing clocks for the ssusb power domains so that they can
successfully probe without relying on the bootloader state.

Fixes: d9e43c1e7a38 ("arm64: dts: mt8186: Add power domains controller")
Signed-off-by: Nícolas F. R. A. Prado <[email protected]>
---
arch/arm64/boot/dts/mediatek/mt8186.dtsi | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8186.dtsi b/arch/arm64/boot/dts/mediatek/mt8186.dtsi
index adaf5e57fac5..e0e5721d6b53 100644
--- a/arch/arm64/boot/dts/mediatek/mt8186.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8186.dtsi
@@ -931,11 +931,17 @@ power-domain@MT8186_POWER_DOMAIN_CSIRX_TOP {

power-domain@MT8186_POWER_DOMAIN_SSUSB {
reg = <MT8186_POWER_DOMAIN_SSUSB>;
+ clocks = <&topckgen CLK_TOP_USB_TOP>,
+ <&infracfg_ao CLK_INFRA_AO_SSUSB_TOP_REF>;
+ clock-names = "sys_ck", "ref_ck";
#power-domain-cells = <0>;
};

power-domain@MT8186_POWER_DOMAIN_SSUSB_P1 {
reg = <MT8186_POWER_DOMAIN_SSUSB_P1>;
+ clocks = <&infracfg_ao CLK_INFRA_AO_SSUSB_TOP_P1_SYS>,
+ <&infracfg_ao CLK_INFRA_AO_SSUSB_TOP_P1_REF>;
+ clock-names = "sys_ck", "ref_ck";
#power-domain-cells = <0>;
};


--
2.43.0


2024-02-13 15:10:09

by Nícolas F. R. A. Prado

[permalink] [raw]
Subject: [PATCH v2 2/2] arm64: dts: mediatek: mt8186: Add missing xhci clock to usb controllers

The mtu3 usb controllers don't list the xhci clock, though they require
it, and thus rely on the bootloader leaving it on in order to work.

When booting with the upstream arm64 defconfig, the usb controllers will
defer probe until modules have loaded since they have an indirect
dependency on CONFIG_MTK_CMDQ, which is configured as a module. However
at the point where modules are loaded, unused clocks are also disabled,
causing the usb controllers to probe without the xhci clock enabled and
fail to probe:

mtu3 11201000.usb: clks of sts1 are not stable!
mtu3 11201000.usb: device enable failed -110
mtu3 11201000.usb: mtu3 hw init failed:-110
mtu3 11201000.usb: failed to initialize gadget
mtu3: probe of 11201000.usb failed with error -110

(and same for the one at 11281000)

Add the missing clock for the usb controllers so that they can
successfully probe without relying on the bootloader state.

Fixes: f6c3e61c5486 ("arm64: dts: mediatek: mt8186: Add MTU3 nodes")
Signed-off-by: Nícolas F. R. A. Prado <[email protected]>
---
arch/arm64/boot/dts/mediatek/mt8186.dtsi | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt8186.dtsi b/arch/arm64/boot/dts/mediatek/mt8186.dtsi
index e0e5721d6b53..8c55b7225cf6 100644
--- a/arch/arm64/boot/dts/mediatek/mt8186.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8186.dtsi
@@ -1536,8 +1536,9 @@ ssusb0: usb@11201000 {
clocks = <&topckgen CLK_TOP_USB_TOP>,
<&infracfg_ao CLK_INFRA_AO_SSUSB_TOP_REF>,
<&infracfg_ao CLK_INFRA_AO_SSUSB_TOP_HCLK>,
- <&infracfg_ao CLK_INFRA_AO_ICUSB>;
- clock-names = "sys_ck", "ref_ck", "mcu_ck", "dma_ck";
+ <&infracfg_ao CLK_INFRA_AO_ICUSB>,
+ <&infracfg_ao CLK_INFRA_AO_SSUSB_TOP_XHCI>;
+ clock-names = "sys_ck", "ref_ck", "mcu_ck", "dma_ck", "xhci_ck";
interrupts = <GIC_SPI 303 IRQ_TYPE_LEVEL_HIGH 0>;
phys = <&u2port0 PHY_TYPE_USB2>;
power-domains = <&spm MT8186_POWER_DOMAIN_SSUSB>;
@@ -1601,8 +1602,9 @@ ssusb1: usb@11281000 {
clocks = <&infracfg_ao CLK_INFRA_AO_SSUSB_TOP_P1_SYS>,
<&infracfg_ao CLK_INFRA_AO_SSUSB_TOP_P1_REF>,
<&infracfg_ao CLK_INFRA_AO_SSUSB_TOP_P1_HCLK>,
- <&clk26m>;
- clock-names = "sys_ck", "ref_ck", "mcu_ck", "dma_ck";
+ <&clk26m>,
+ <&infracfg_ao CLK_INFRA_AO_SSUSB_TOP_P1_XHCI>;
+ clock-names = "sys_ck", "ref_ck", "mcu_ck", "dma_ck", "xhci_ck";
interrupts = <GIC_SPI 331 IRQ_TYPE_LEVEL_HIGH 0>;
phys = <&u2port1 PHY_TYPE_USB2>, <&u3port1 PHY_TYPE_USB3>;
power-domains = <&spm MT8186_POWER_DOMAIN_SSUSB_P1>;

--
2.43.0


Subject: Re: [PATCH v2 2/2] arm64: dts: mediatek: mt8186: Add missing xhci clock to usb controllers

Il 13/02/24 16:02, Nícolas F. R. A. Prado ha scritto:
> The mtu3 usb controllers don't list the xhci clock, though they require
> it, and thus rely on the bootloader leaving it on in order to work.
>
> When booting with the upstream arm64 defconfig, the usb controllers will
> defer probe until modules have loaded since they have an indirect
> dependency on CONFIG_MTK_CMDQ, which is configured as a module. However
> at the point where modules are loaded, unused clocks are also disabled,
> causing the usb controllers to probe without the xhci clock enabled and
> fail to probe:
>
> mtu3 11201000.usb: clks of sts1 are not stable!
> mtu3 11201000.usb: device enable failed -110
> mtu3 11201000.usb: mtu3 hw init failed:-110
> mtu3 11201000.usb: failed to initialize gadget
> mtu3: probe of 11201000.usb failed with error -110
>
> (and same for the one at 11281000)
>
> Add the missing clock for the usb controllers so that they can
> successfully probe without relying on the bootloader state.
>
> Fixes: f6c3e61c5486 ("arm64: dts: mediatek: mt8186: Add MTU3 nodes")
> Signed-off-by: Nícolas F. R. A. Prado <[email protected]>

Reviewed-by: AngeloGioacchino Del Regno <[email protected]>


Subject: Re: [PATCH v2 1/2] arm64: dts: mediatek: mt8186: Add missing clocks to ssusb power domains

Il 13/02/24 16:02, Nícolas F. R. A. Prado ha scritto:
> The ssusb power domains currently don't list any clocks, despite
> depending on some, and thus rely on the bootloader leaving the required
> clocks on in order to work.
>
> When booting with the upstream arm64 defconfig, the power domain
> controller will defer probe until modules have loaded since it has an
> indirect dependency on CONFIG_MTK_CMDQ, which is configured as a module.
> However at the point where modules are loaded, unused clocks are also
> disabled, causing the ssusb domains to fail to be enabled and
> consequently the controller to fail probe:
>
> mtk-power-controller 10006000.syscon:power-controller: /soc/syscon@10006000/power-controller/power-domain@4: failed to power on domain: -110
> mtk-power-controller: probe of 10006000.syscon:power-controller failed with error -110
>
> Add the missing clocks for the ssusb power domains so that they can
> successfully probe without relying on the bootloader state.
>
> Fixes: d9e43c1e7a38 ("arm64: dts: mt8186: Add power domains controller")
> Signed-off-by: Nícolas F. R. A. Prado <[email protected]>

Reviewed-by: AngeloGioacchino Del Regno <[email protected]>