2023-04-14 08:46:08

by Fabrice Gasnier

[permalink] [raw]
Subject: [PATCH v2 0/4] usb: dwc2: add optional clock used on stm32mp15

This series introduces an optional utmi clock that is used on stm32mp15,
in particular when using integrated full-speed PHY, managed by GGPIO
register.
A pre-cursor change improves error handling in the platform code.
---
Changes in v2:
- "utmi_clk" renamed "utmi" as per Krzysztof comment on dt-bindings

Fabrice Gasnier (4):
usb: dwc2: improve error handling in __dwc2_lowlevel_hw_enable
dt-bindings: usb: dwc2: add utmi optional clock
usb: dwc2: platform: add support for utmi optional clock
ARM: dts: stm32: add USB OTG UTMI clock on stm32mp151

.../devicetree/bindings/usb/dwc2.yaml | 5 ++-
arch/arm/boot/dts/stm32mp151.dtsi | 4 +-
drivers/usb/dwc2/core.h | 2 +
drivers/usb/dwc2/platform.c | 37 ++++++++++++++++++-
4 files changed, 43 insertions(+), 5 deletions(-)

--
2.25.1


2023-04-14 08:46:14

by Fabrice Gasnier

[permalink] [raw]
Subject: [PATCH v2 4/4] ARM: dts: stm32: add USB OTG UTMI clock on stm32mp151

It's needed on STM32MP15, when using the integrated full-speed PHY. This
clock is an output of USBPHYC, and the HS USBPHYC is not attached as PHY
in this case (managed directly by dwc2 ggpio glue):

&usbotg_hs {
compatible = "st,stm32mp15-fsotg", "snps,dwc2";
pinctrl-names = "default";
pinctrl-0 = <&usbotg_hs_pins_a &usbotg_fs_dp_dm_pins_a>;
vbus-supply = <&vbus_otg>;
status = "okay";
};

USBPHYC clock output must be used, so it can be properly enabled as a
clock provider.

Without this, currently, when the dualport High-Speed USBPHYC isn't
requested by either USBH or OTG, it remains uninitialized when probing
OTG: OTG configured with full-speed PHY isn't properly clocked, resulting
in error log like:
[ 2.383138] dwc2 49000000.usb-otg: dwc2_core_reset: HANG! Soft Reset
timeout GRSTCTL_CSFTRST.

Signed-off-by: Fabrice Gasnier <[email protected]>
---
Changes in v2:
- "utmi_clk" renamed "utmi" as per Krzysztof comment on dt-bindings
---
arch/arm/boot/dts/stm32mp151.dtsi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/stm32mp151.dtsi b/arch/arm/boot/dts/stm32mp151.dtsi
index 4e437d3f2ed6..63f4c78fcc1d 100644
--- a/arch/arm/boot/dts/stm32mp151.dtsi
+++ b/arch/arm/boot/dts/stm32mp151.dtsi
@@ -1130,8 +1130,8 @@ sdmmc3: mmc@48004000 {
usbotg_hs: usb-otg@49000000 {
compatible = "st,stm32mp15-hsotg", "snps,dwc2";
reg = <0x49000000 0x10000>;
- clocks = <&rcc USBO_K>;
- clock-names = "otg";
+ clocks = <&rcc USBO_K>, <&usbphyc>;
+ clock-names = "otg", "utmi";
resets = <&rcc USBO_R>;
reset-names = "dwc2";
interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>;
--
2.25.1