dt-bindings: usb: dwc3: Document ST STM32MP2 DWC3 xHCI USB controller
Subsystems (4)
PATCH v5 1/2 dt-bindings: usb: dwc3: Document ST STM32MP2 DWC3 xHCI USB controller
The ST STM32MP2 SoC contains single instance of DWC3 USB controller with glue logic wrapper around it controlled by syscon. Document the glue logic and DWC3 controller.
---
Cc: Alexandre Torgue <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Thinh Nguyen <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: Fix up Sob/Cdb lines
V3: - Document maximum-speed
- Switch resets to maxItems: 1
- Drop label from example
- Use generic over-current-active-low
- Use ref: snps,dwc3-common.yaml and drop generic dr_mode/maximum-speed/phys/phy-names
V4: - Split this from series arm64: dts: phy: st: usb: Add STM32MP2 USB support
https://lore.kernel.org/all/[email protected]/ V5: No change --- .../bindings/usb/st,stm32mp25-dwc3.yaml | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/st,stm32mp25-dwc3.yaml
Documentation/devicetree/bindings/usb/st,stm32mp25-dwc3.yaml new file +97 -0
@@ -0,0 +1,97 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/st,stm32mp25-dwc3.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: STMicroelectronics STM32 MPU DWC3 USB SoC controller + +description: + The STM32 MPU DWC3 USB SoC controller block supports both + Host(SS/HS/FS/LS) and Device(SS/HS/FS) mode operation + +maintainers: + - Fabrice Gasnier <[email protected]> + - Marek Vasut <[email protected]> + +allOf: + - $ref: snps,dwc3-common.yaml# + +properties: + compatible: + const: st,stm32mp25-dwc3 + + reg: + maxItems: 1 + + access-controllers: + maxItems: 1 + + clocks: + minItems: 3 + maxItems: 3 + + clock-names: + items: + - const: ref + - const: bus_early + - const: suspend + + interrupts: + maxItems: 1 + + resets: + maxItems: 1 + + over-current-active-low: + type: boolean + description: Over-Current signal polarity is active-low + + st,syscfg: + $ref: /schemas/types.yaml#/definitions/phandle-array + description: Phandle to system configuration controller. + items: + - items: + - description: phandle to syscfg + - description: USB3DR control offset within syscfg + + st,enable-port-power-control: + type: boolean + description: Enable Host-Mode Port Power Control (bit-3 of capability param HCCPARAMS) + + st,vbusen-active-low: + type: boolean + description: VBUS-ENABLE signal polarity is active-low + +required: + - compatible + - reg + - clocks + - clock-names + - interrupts + - phys + - phy-names + - resets + - st,syscfg + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/clock/st,stm32mp25-rcc.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/reset/st,stm32mp25-rcc.h> + + usb@48300000 { + compatible = "st,stm32mp25-dwc3"; + reg = <0x48300000 0x100000>; + clocks = <&rcc CK_KER_USB2PHY2>, <&rcc CK_BUS_USB3DR>, <&rcc CK_KER_USB2PHY2>; + clock-names = "ref", "bus_early", "suspend"; + interrupts = <GIC_SPI 228 IRQ_TYPE_LEVEL_HIGH>; + phys = <&usb2_phy>, <&usb3_phy>; + phy-names = "usb2-phy", "usb3-phy"; + resets = <&rcc USB3DR_R>; + over-current-active-low; + st,syscfg = <&syscfg 0x4800>; + st,vbusen-active-low; + };
Signature · 1 line
2.53.0
PATCH v5 2/2 usb: dwc3: dwc3-generic-plat: Add ST STM32MP2 DWC3 xHCI USB controller glue
The ST STM32MP2 SoC contains one instance of DWC3 USB controller with glue logic wrapper around it controlled by syscon. Extend the generic DWC3 platform driver with ST STM32MP2 glue logic specifics.
---
Cc: Alexandre Torgue <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Thinh Nguyen <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: No change
V3: - Use generic over-current-active-low
V4: - Include bitfield.h
- Split this from series arm64: dts: phy: st: usb: Add STM32MP2 USB support
https://lore.kernel.org/all/[email protected]/
V5: - Reorder usb2only_conf to improve readability
- Drop superfluous !!
- Add AB from Thinh
--- drivers/usb/dwc3/dwc3-generic-plat.c | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
drivers/usb/dwc3/dwc3-generic-plat.c +46 -0
@@ -7,6 +7,7 @@* Inspired by dwc3-qcom.c and dwc3-of-simple.c */ +#include <linux/bitfield.h> #include <linux/clk.h> #include <linux/platform_device.h> #include <linux/reset.h>
@@ -22,6 +23,12 @@#define EIC7700_HSP_AXI_LP_XM_CSYSREQ BIT(0)#define EIC7700_HSP_AXI_LP_XS_CSYSREQ BIT(16) +#define STM32MP2_USB3DRCR_HOST_PORT_POWER_CONTROL_PRESENT BIT(0) +#define STM32MP2_USB3DRCR_OVRCUR_POLARITY BIT(1) +#define STM32MP2_USB3DRCR_VBUSEN_POLARITY BIT(2) +#define STM32MP2_USB3DRCR_USB2ONLYH BIT(3) +#define STM32MP2_USB3DRCR_USB2ONLYD BIT(4) +struct dwc3_generic {struct device *dev;struct dwc3 dwc;
@@ -85,6 +92,39 @@ static int dwc3_spacemit_k1_init(struct dwc3_generic *dwc3g)return 0 ; } +static int dwc3_stm32mp25_init (struct dwc3_generic *dwc3g) +{ +struct device *dev = dwc3g->dev; +bool ovrcur_polarity_low =device_property_read_bool (dev,"over-current-active-low" ); +bool prt_pwr_ctrl =device_property_read_bool (dev,"st,enable-port-power-control" ); +bool vbusen_polarity_low =device_property_read_bool (dev,"st,vbusen-active-low" ); +bool usb2only_conf = false; +struct regmap *regmap; +u32 drcr; + +if (device_property_match_string (dev,"phy-names" ,"usb3-phy" ) <0 ) + usb2only_conf = true; + + regmap =syscon_regmap_lookup_by_phandle_args (dev->of_node,"st,syscfg" ,1 , &drcr); +if (IS_ERR (regmap)) +return dev_err_probe (dev,PTR_ERR (regmap),"No st,syscfg phandle specified\n" ); + +return regmap_update_bits (regmap, drcr, +STM32MP2_USB3DRCR_HOST_PORT_POWER_CONTROL_PRESENT | +STM32MP2_USB3DRCR_OVRCUR_POLARITY | +STM32MP2_USB3DRCR_VBUSEN_POLARITY | +STM32MP2_USB3DRCR_USB2ONLYD | +STM32MP2_USB3DRCR_USB2ONLYH , +FIELD_PREP (STM32MP2_USB3DRCR_HOST_PORT_POWER_CONTROL_PRESENT , + prt_pwr_ctrl) | +FIELD_PREP (STM32MP2_USB3DRCR_OVRCUR_POLARITY , + ovrcur_polarity_low) | +FIELD_PREP (STM32MP2_USB3DRCR_VBUSEN_POLARITY , + vbusen_polarity_low) | +FIELD_PREP (STM32MP2_USB3DRCR_USB2ONLYD , usb2only_conf) | +FIELD_PREP (STM32MP2_USB3DRCR_USB2ONLYH , usb2only_conf)); +} +static int dwc3_generic_probe (struct platform_device *pdev) {const struct dwc3_generic_config *plat_config;
@@ -231,12 +271,18 @@ static const struct dwc3_generic_config eic7700_dwc3 = { .properties = DWC3_DEFAULT_PROPERTIES, }; +static const struct dwc3_generic_config stm32mp25_dwc3 = { + .init = dwc3_stm32mp25_init, + .properties =DWC3_DEFAULT_PROPERTIES , +}; +static const struct of_device_id dwc3_generic_of_match[] = { { .compatible ="spacemit,k1-dwc3" , &spacemit_k1_dwc3}, { .compatible ="spacemit,k3-dwc3" , }, { .compatible ="fsl,ls1028a-dwc3" , &fsl_ls1028_dwc3}, { .compatible ="eswin,eic7700-dwc3" , &eic7700_dwc3}, { .compatible ="starfive,jhb100-dwc3" , }, + { .compatible ="st,stm32mp25-dwc3" , &stm32mp25_dwc3 }, {/* sentinel */ } };MODULE_DEVICE_TABLE (of, dwc3_generic_of_match);
Signature · 1 line
2.53.0
Re: [PATCH v5 2/2] usb: dwc3: dwc3-generic-plat: Add ST STM32MP2 DWC3 xHCI USB controller glue
Quoted 6 lines · Marek Vasut
The ST STM32MP2 SoC contains one instance of DWC3 USB controller with glue logic wrapper around it controlled by syscon. Extend the generic DWC3 platform driver with ST STM32MP2 glue logic specifics.
Acked-by Thinh Nguyen <[email protected]>Signed-off-by Marek Vasut <[email protected]>
Hi Marek,
You can add my:
BR,
Fabrice
Quoted 113 lines
---
Cc: Alexandre Torgue <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Thinh Nguyen <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: No change
V3: - Use generic over-current-active-low
V4: - Includebitfield.h
- Split this from series arm64: dts: phy: st: usb: Add STM32MP2 USB support
https://lore.kernel.org/all/[email protected]/
V5: - Reorderusb2only_confto improve readability
- Drop superfluous !!
- Add AB from Thinh--- drivers/usb/dwc3/dwc3-generic-plat.c | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)drivers/usb/dwc3/dwc3-generic-plat.c +46
-0@@ -7,6 +7,7 @@* Inspired by dwc3-qcom.c and dwc3-of-simple.c */ +#include <linux/bitfield.h> #include <linux/clk.h> #include <linux/platform_device.h> #include <linux/reset.h> @@ -22,6 +23,12 @@#define EIC7700_HSP_AXI_LP_XM_CSYSREQ BIT(0)#define EIC7700_HSP_AXI_LP_XS_CSYSREQ BIT(16) +#define STM32MP2_USB3DRCR_HOST_PORT_POWER_CONTROL_PRESENT BIT(0) +#define STM32MP2_USB3DRCR_OVRCUR_POLARITY BIT(1) +#define STM32MP2_USB3DRCR_VBUSEN_POLARITY BIT(2) +#define STM32MP2_USB3DRCR_USB2ONLYH BIT(3) +#define STM32MP2_USB3DRCR_USB2ONLYD BIT(4) +struct dwc3_generic {struct device *dev;struct dwc3 dwc;@@ -85,6 +92,39 @@ static int dwc3_spacemit_k1_init(struct dwc3_generic *dwc3g)return 0 ; } +static int dwc3_stm32mp25_init (struct dwc3_generic *dwc3g) +{ +struct device *dev = dwc3g->dev; +bool ovrcur_polarity_low =device_property_read_bool (dev,"over-current-active-low" ); +bool prt_pwr_ctrl =device_property_read_bool (dev,"st,enable-port-power-control" ); +bool vbusen_polarity_low =device_property_read_bool (dev,"st,vbusen-active-low" ); +bool usb2only_conf = false; +struct regmap *regmap; +u32 drcr; + +if (device_property_match_string (dev,"phy-names" ,"usb3-phy" ) <0 ) + usb2only_conf = true; + + regmap =syscon_regmap_lookup_by_phandle_args (dev->of_node,"st,syscfg" ,1 , &drcr); +if (IS_ERR (regmap)) +return dev_err_probe (dev,PTR_ERR (regmap),"No st,syscfg phandle specified\n" ); + +return regmap_update_bits (regmap, drcr, +STM32MP2_USB3DRCR_HOST_PORT_POWER_CONTROL_PRESENT | +STM32MP2_USB3DRCR_OVRCUR_POLARITY | +STM32MP2_USB3DRCR_VBUSEN_POLARITY | +STM32MP2_USB3DRCR_USB2ONLYD | +STM32MP2_USB3DRCR_USB2ONLYH , +FIELD_PREP (STM32MP2_USB3DRCR_HOST_PORT_POWER_CONTROL_PRESENT , + prt_pwr_ctrl) | +FIELD_PREP (STM32MP2_USB3DRCR_OVRCUR_POLARITY , + ovrcur_polarity_low) | +FIELD_PREP (STM32MP2_USB3DRCR_VBUSEN_POLARITY , + vbusen_polarity_low) | +FIELD_PREP (STM32MP2_USB3DRCR_USB2ONLYD , usb2only_conf) | +FIELD_PREP (STM32MP2_USB3DRCR_USB2ONLYH , usb2only_conf)); +} +static int dwc3_generic_probe (struct platform_device *pdev) {const struct dwc3_generic_config *plat_config;@@ -231,12 +271,18 @@ static const struct dwc3_generic_config eic7700_dwc3 = { .properties = DWC3_DEFAULT_PROPERTIES, }; +static const struct dwc3_generic_config stm32mp25_dwc3 = { + .init = dwc3_stm32mp25_init, + .properties =DWC3_DEFAULT_PROPERTIES , +}; +static const struct of_device_id dwc3_generic_of_match[] = { { .compatible ="spacemit,k1-dwc3" , &spacemit_k1_dwc3}, { .compatible ="spacemit,k3-dwc3" , }, { .compatible ="fsl,ls1028a-dwc3" , &fsl_ls1028_dwc3}, { .compatible ="eswin,eic7700-dwc3" , &eic7700_dwc3}, { .compatible ="starfive,jhb100-dwc3" , }, + { .compatible ="st,stm32mp25-dwc3" , &stm32mp25_dwc3 }, {/* sentinel */ } };MODULE_DEVICE_TABLE (of, dwc3_generic_of_match);
Quoted 11 lines · Marek Vasut
The ST STM32MP2 SoC contains single instance of DWC3 USB controller with glue logic wrapper around it controlled by syscon. Document the glue logic and DWC3 controller.
Co-developed-by Pankaj Dev <[email protected]>Signed-off-by Pankaj Dev <[email protected]>Co-developed-by Clément Le Goffic <[email protected]>Signed-off-by Clément Le Goffic <[email protected]>Co-developed-by Gatien Chevallier <[email protected]>Signed-off-by Gatien Chevallier <[email protected]>Signed-off-by Marek Vasut <[email protected]>
Hi Markek,
You can add my:
BR,
Fabrice
Quoted 134 lines
---
Cc: Alexandre Torgue <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Thinh Nguyen <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: Fix up Sob/Cdb lines
V3: - Document maximum-speed
- Switch resets to maxItems: 1
- Drop label from example
- Use generic over-current-active-low
- Use ref: snps,dwc3-common.yaml and drop generic dr_mode/maximum-speed/phys/phy-names
V4: - Split this from series arm64: dts: phy: st: usb: Add STM32MP2 USB supporthttps://lore.kernel.org/all/[email protected]/ V5: No change --- .../bindings/usb/st,stm32mp25-dwc3.yaml | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/st,stm32mp25-dwc3.yamlDocumentation/devicetree/bindings/usb/st,stm32mp25-dwc3.yaml new file +97
-0@@ -0,0 +1,97 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/st,stm32mp25-dwc3.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: STMicroelectronics STM32 MPU DWC3 USB SoC controller + +description: + The STM32 MPU DWC3 USB SoC controller block supports both + Host(SS/HS/FS/LS) and Device(SS/HS/FS) mode operation + +maintainers: + - Fabrice Gasnier <[email protected]> + - Marek Vasut <[email protected]> + +allOf: + - $ref: snps,dwc3-common.yaml# + +properties: + compatible: + const: st,stm32mp25-dwc3 + + reg: + maxItems: 1 + + access-controllers: + maxItems: 1 + + clocks: + minItems: 3 + maxItems: 3 + + clock-names: + items: + - const: ref + - const: bus_early + - const: suspend + + interrupts: + maxItems: 1 + + resets: + maxItems: 1 + + over-current-active-low: + type: boolean + description: Over-Current signal polarity is active-low + + st,syscfg: + $ref: /schemas/types.yaml#/definitions/phandle-array + description: Phandle to system configuration controller. + items: + - items: + - description: phandle to syscfg + - description: USB3DR control offset within syscfg + + st,enable-port-power-control: + type: boolean + description: Enable Host-Mode Port Power Control (bit-3 of capability param HCCPARAMS) + + st,vbusen-active-low: + type: boolean + description: VBUS-ENABLE signal polarity is active-low + +required: + - compatible + - reg + - clocks + - clock-names + - interrupts + - phys + - phy-names + - resets + - st,syscfg + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/clock/st,stm32mp25-rcc.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/reset/st,stm32mp25-rcc.h> + + usb@48300000 { + compatible = "st,stm32mp25-dwc3"; + reg = <0x48300000 0x100000>; + clocks = <&rcc CK_KER_USB2PHY2>, <&rcc CK_BUS_USB3DR>, <&rcc CK_KER_USB2PHY2>; + clock-names = "ref", "bus_early", "suspend"; + interrupts = <GIC_SPI 228 IRQ_TYPE_LEVEL_HIGH>; + phys = <&usb2_phy>, <&usb3_phy>; + phy-names = "usb2-phy", "usb3-phy"; + resets = <&rcc USB3DR_R>; + over-current-active-low; + st,syscfg = <&syscfg 0x4800>; + st,vbusen-active-low; + };
Quoted 35 lines · Marek Vasut
The ST STM32MP2 SoC contains single instance of DWC3 USB controller with glue logic wrapper around it controlled by syscon. Document the glue logic and DWC3 controller.
Co-developed-by Pankaj Dev <[email protected]>Signed-off-by Pankaj Dev <[email protected]>Co-developed-by Clément Le Goffic <[email protected]>Signed-off-by Clément Le Goffic <[email protected]>Co-developed-by Gatien Chevallier <[email protected]>Signed-off-by Gatien Chevallier <[email protected]>Signed-off-by Marek Vasut <[email protected]>---
Cc: Alexandre Torgue <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Thinh Nguyen <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: Fix up Sob/Cdb lines
V3: - Document maximum-speed
- Switch resets to maxItems: 1
- Drop label from example
- Use generic over-current-active-low
- Use ref: snps,dwc3-common.yaml and drop generic dr_mode/maximum-speed/phys/phy-names
V4: - Split this from series arm64: dts: phy: st: usb: Add STM32MP2 USB support
Quoted 6 lines
https://lore.kernel.org/all/[email protected]/ V5: No change --- .../bindings/usb/st,stm32mp25-dwc3.yaml | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/st,stm32mp25-dwc3.yaml
Rob Herring
maintainerQuoted 35 lines · Marek Vasut
The ST STM32MP2 SoC contains single instance of DWC3 USB controller with glue logic wrapper around it controlled by syscon. Document the glue logic and DWC3 controller.
Co-developed-by Pankaj Dev <[email protected]>Signed-off-by Pankaj Dev <[email protected]>Co-developed-by Clément Le Goffic <[email protected]>Signed-off-by Clément Le Goffic <[email protected]>Co-developed-by Gatien Chevallier <[email protected]>Signed-off-by Gatien Chevallier <[email protected]>Signed-off-by Marek Vasut <[email protected]>---
Cc: Alexandre Torgue <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Thinh Nguyen <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: Fix up Sob/Cdb lines
V3: - Document maximum-speed
- Switch resets to maxItems: 1
- Drop label from example
- Use generic over-current-active-low
- Use ref: snps,dwc3-common.yaml and drop generic dr_mode/maximum-speed/phys/phy-names
V4: - Split this from series arm64: dts: phy: st: usb: Add STM32MP2 USB support
Quoted 6 lines
https://lore.kernel.org/all/[email protected]/ V5: No change --- .../bindings/usb/st,stm32mp25-dwc3.yaml | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/st,stm32mp25-dwc3.yaml
I'm picking this up as there's already a .dts user pending for 7.4 and it didn't get picked up in the USB PR.
Rob