Skip to contentSkip to conversation

usb: dwc2: combine platform specific data for Intel Agilex and Stratix10

PATCH In review Meng Li 2 participants 4 messages Jul 17, 2023

Subsystems (4)
lore
Share & tools
lore

Meng Li

author
#0 lore raw

PATCH 1/1 usb: dwc2: combine platform specific data for Intel Agilex and Stratix10

Intel Stratix10 is very the same with Agilex platform, the DWC2 IP on the Stratix platform also does not support clock-gating. So, based on commit 3d8d3504d233("usb: dwc2: Add platform specific data for Intel's Agilex"), combine platform specific data for Intel Agilex and Stratix10 together. In additional, in order to avoid breaking the old device tree, keep compatible string "intel,socfpga-agilex-hsotg" unchanged.

---
 Documentation/devicetree/bindings/usb/dwc2.yaml   | 2 ++
 arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi | 4 ++--
 drivers/usb/dwc2/params.c                         | 6 ++++--
 3 files changed, 8 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/usb/dwc2.yaml +2 -0
index dc4988c0009c..c98ca98d5033 100644
@@ -51,6 +51,7 @@ properties:
               - amlogic,meson-gxbb-usb
               - amlogic,meson-g12a-usb
               - intel,socfpga-agilex-hsotg
+              - intel,socfpga-hsotg
           - const: snps,dwc2
       - const: amcc,dwc-otg
       - const: apm,apm82181-dwc-otg
@@ -64,6 +65,7 @@ properties:
           - const: snps,dwc2
       - const: samsung,s3c6400-hsotg
       - const: intel,socfpga-agilex-hsotg
+      - const: intel,socfpga-hsotg
 
   reg:
     maxItems: 1
arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +2 -2
index ea788a920eab..c5a51636f657 100644
@@ -490,7 +490,7 @@ usbphy0: usbphy@0 {
 		};
 
 		usb0: usb@ffb00000 {
-			compatible = "snps,dwc2";
+			compatible = "intel,socfpga-hsotg", "snps,dwc2";
 			reg = <0xffb00000 0x40000>;
 			interrupts = <0 93 4>;
 			phys = <&usbphy0>;
@@ -504,7 +504,7 @@ usb0: usb@ffb00000 {
 		};
 
 		usb1: usb@ffb40000 {
-			compatible = "snps,dwc2";
+			compatible = "intel,socfpga-hsotg", "snps,dwc2";
 			reg = <0xffb40000 0x40000>;
 			interrupts = <0 94 4>;
 			phys = <&usbphy0>;
drivers/usb/dwc2/params.c +4 -2
index 8eab5f38b110..6bb27a24e9e1 100644
@@ -93,7 +93,7 @@ static void dwc2_set_s3c6400_params(struct dwc2_hsotg *hsotg)
 	p->phy_utmi_width = 8;
 }
 
-static void dwc2_set_socfpga_agilex_params(struct dwc2_hsotg *hsotg)
+static void dwc2_set_socfpga_params(struct dwc2_hsotg *hsotg)
 {
 	struct dwc2_core_params *p = &hsotg->params;
 
@@ -266,7 +266,9 @@ const struct of_device_id dwc2_of_match_table[] = {
 	{ .compatible = "st,stm32mp15-hsotg",
 	  .data = dwc2_set_stm32mp15_hsotg_params },
 	{ .compatible = "intel,socfpga-agilex-hsotg",
-	  .data = dwc2_set_socfpga_agilex_params },
+	  .data = dwc2_set_socfpga_params },
+	{ .compatible = "intel,socfpga-hsotg",
+	  .data = dwc2_set_socfpga_params },
 	{},
 };
 MODULE_DEVICE_TABLE(of, dwc2_of_match_table);
Signature · 1 line
2.34.1
#1 lore raw
Quoted 10 lines · Meng Li

Intel Stratix10 is very the same with Agilex platform, the DWC2 IP on the Stratix platform also does not support clock-gating. So, based on commit 3d8d3504d233("usb: dwc2: Add platform specific data for Intel's Agilex"), combine platform specific data for Intel Agilex and Stratix10 together. In additional, in order to avoid breaking the old device tree, keep compatible string "intel,socfpga-agilex-hsotg" unchanged.

---
 Documentation/devicetree/bindings/usb/dwc2.yaml   | 2 ++

Bindings are always separate patch.

Quoted 1 line
 arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi | 4 ++--

As DTS is.

Documentation/devicetree/bindings/usb/dwc2.yaml properties: · line 54

Quoted 12 lines
 drivers/usb/dwc2/params.c                         | 6 ++++--
 3 files changed, 8 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/usb/dwc2.yaml +1 -0
index dc4988c0009c..c98ca98d5033 100644
@@ -51,6 +51,7 @@ properties:
               - amlogic,meson-gxbb-usb
               - amlogic,meson-g12a-usb
               - intel,socfpga-agilex-hsotg
+              - intel,socfpga-hsotg

Where is SoC specific compatible?

Quoted 15 lines
Documentation/devicetree/bindings/usb/dwc2.yaml +1 -0
           - const: snps,dwc2
       - const: amcc,dwc-otg
       - const: apm,apm82181-dwc-otg
@@ -64,6 +65,7 @@ properties:
           - const: snps,dwc2
       - const: samsung,s3c6400-hsotg
       - const: intel,socfpga-agilex-hsotg
+      - const: intel,socfpga-hsotg
 
   reg:
     maxItems: 1
arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +0 -0
index ea788a920eab..c5a51636f657 100644

...

drivers/usb/dwc2/params.c static void dwc2_set_s3c6400_params(struct dwc2_hsotg *hsotg) · line 96

Quoted 10 lines
drivers/usb/dwc2/params.c +1 -1
index 8eab5f38b110..6bb27a24e9e1 100644
@@ -93,7 +93,7 @@ static void dwc2_set_s3c6400_params(struct dwc2_hsotg *hsotg)
 	p->phy_utmi_width = 8;
 }
 
-static void dwc2_set_socfpga_agilex_params(struct dwc2_hsotg *hsotg)
+static void dwc2_set_socfpga_params(struct dwc2_hsotg *hsotg)

Why? Old name was ok...

drivers/usb/dwc2/params.c const struct of_device_id dwc2_of_match_table[] = { · line 271

Quoted 11 lines
drivers/usb/dwc2/params.c +3 -1
 {
 	struct dwc2_core_params *p = &hsotg->params;
 
@@ -266,7 +266,9 @@ const struct of_device_id dwc2_of_match_table[] = {
 	{ .compatible = "st,stm32mp15-hsotg",
 	  .data = dwc2_set_stm32mp15_hsotg_params },
 	{ .compatible = "intel,socfpga-agilex-hsotg",
-	  .data = dwc2_set_socfpga_agilex_params },
+	  .data = dwc2_set_socfpga_params },
+	{ .compatible = "intel,socfpga-hsotg",
+	  .data = dwc2_set_socfpga_params },

Aren't they compatible? Why do you need new entry for compatible devices?

Best regards,
Krzysztof

author
#2 lore raw
Quoted 25 lines

-----Original Message-----
From: Krzysztof Kozlowski <[email protected]>
Sent: Monday, July 17, 2023 5:42 PM
To: Li, Meng <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]
Subject: Re: [PATCH] usb: dwc2: combine platform specific data for Intel Agilex and Stratix10

CAUTION: This email comes from a non Wind River email account! Do not click links or open attachments unless you recognize the sender and know the content is safe.

Quoted 7 lines · Meng Li

Intel Stratix10 is very the same with Agilex platform, the DWC2 IP on the Stratix platform also does not support clock-gating. So, based on commit 3d8d3504d233("usb: dwc2: Add platform specific data for Intel's Agilex"), combine platform specific data for Intel Agilex and Stratix10 together. In additional, in order to avoid breaking the old device tree, keep compatible string "intel,socfpga-agilex-hsotg" unchanged.

Quoted 6 lines
Quoted 3 lines
---
 Documentation/devicetree/bindings/usb/dwc2.yaml   | 2 ++

Bindings are always separate patch.

Got it.

Quoted 4 lines
Quoted 1 line
 arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi | 4 ++--

As DTS is.

Got it.

Quoted 16 lines

Documentation/devicetree/bindings/usb/dwc2.yaml properties: · line 54

Quoted 13 lines
 drivers/usb/dwc2/params.c                         | 6 ++++--
 3 files changed, 8 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/usb/dwc2.yaml +1 -0
index dc4988c0009c..c98ca98d5033 100644
@@ -51,6 +51,7 @@ properties:
               - amlogic,meson-gxbb-usb
               - amlogic,meson-g12a-usb
               - intel,socfpga-agilex-hsotg
+              - intel,socfpga-hsotg

Where is SoC specific compatible?

The socfpga is a SoC family, it includes Agilex ad Stratix10 SoCs.
In fact, we only need the compatible " intel,socfpga-hsotg " is enough.
But in order to avoid breaking the old device tree for agilex platform, I reserve the old compatible. So, I think we don't need the Stratix10 compatible like "intel,socfpga-stratix10-hsotg "

Quoted 25 lines
Quoted 16 lines
Documentation/devicetree/bindings/usb/dwc2.yaml +1 -0
           - const: snps,dwc2
       - const: amcc,dwc-otg
       - const: apm,apm82181-dwc-otg
@@ -64,6 +65,7 @@ properties:
           - const: snps,dwc2
       - const: samsung,s3c6400-hsotg
       - const: intel,socfpga-agilex-hsotg
+      - const: intel,socfpga-hsotg
 
   reg:
     maxItems: 1
arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +0 -0
index ea788a920eab..c5a51636f657 100644

...

drivers/usb/dwc2/params.c static void dwc2_set_s3c6400_params(struct

Quoted 5 lines
drivers/usb/dwc2/params.c +0 -0
index 8eab5f38b110..6bb27a24e9e1 100644
@@ -93,7 +93,7 @@ static void dwc2_set_s3c6400_params(struct

dwc2_hsotg *hsotg)

Quoted 8 lines

drivers/usb/dwc2/params.c static void dwc2_set_s3c6400_params(struct dwc2_hsotg *hsotg) · line 96

Quoted 5 lines
drivers/usb/dwc2/params.c +1 -1
      p->phy_utmi_width = 8;
 }
 
-static void dwc2_set_socfpga_agilex_params(struct dwc2_hsotg *hsotg)
+static void dwc2_set_socfpga_params(struct dwc2_hsotg *hsotg)

Why? Old name was ok...

Old name includes string "agilex" that represents only agilex SoC.
This patch is used to combine platform specific data for Intel Agilex and Stratix10, so create a common function name for socfpga family.

Quoted 14 lines

drivers/usb/dwc2/params.c const struct of_device_id dwc2_of_match_table[] = { · line 271

Quoted 11 lines
drivers/usb/dwc2/params.c +3 -1
 {
      struct dwc2_core_params *p = &hsotg->params;
 
@@ -266,7 +266,9 @@ const struct of_device_id dwc2_of_match_table[] = {
      { .compatible = "st,stm32mp15-hsotg",
        .data = dwc2_set_stm32mp15_hsotg_params },
      { .compatible = "intel,socfpga-agilex-hsotg",
-       .data = dwc2_set_socfpga_agilex_params },
+       .data = dwc2_set_socfpga_params },
+     { .compatible = "intel,socfpga-hsotg",
+       .data = dwc2_set_socfpga_params },

Aren't they compatible? Why do you need new entry for compatible devices?

In fact, the usb IP in Agilex and Sratix10 are the same. But it is not reasonable to use agilex compatible string "intel,socfpga-agilex-hsotg" in Stratix10 dts files. So, I create a common function name and compatible string for socfpga family that includes Agilex and Stratix10 SoCs.

Thanks,
Limeng

Quoted 2 lines

Best regards,
Krzysztof

#3 lore raw
Quoted 14 lines · Meng
Quoted 4 lines
Quoted 4 lines
Documentation/devicetree/bindings/usb/dwc2.yaml +0 -1
index dc4988c0009c..c98ca98d5033 100644
--- a/Documentation/devicetree/bindings/usb/dwc2.yaml
Quoted 9 lines

Documentation/devicetree/bindings/usb/dwc2.yaml properties: · line 54

Quoted 6 lines

+++ b/Documentation/devicetree/bindings/usb/dwc2.yaml

Documentation/devicetree/bindings/usb/dwc2.yaml +1 -0
@@ -51,6 +51,7 @@ properties:
               - amlogic,meson-gxbb-usb
               - amlogic,meson-g12a-usb
               - intel,socfpga-agilex-hsotg
+              - intel,socfpga-hsotg

Where is SoC specific compatible?

Quoted 2 lines

The socfpga is a SoC family, it includes Agilex ad Stratix10 SoCs. In fact, we only need the compatible " intel,socfpga-hsotg " is enough.

You now confuse driver and bindings compatibles...

https://elixir.bootlin.com/linux/v6.1-rc1/source/Documentation/devicetree/bindings/writing-bindings.rst#L42

Quoted 2 lines

But in order to avoid breaking the old device tree for agilex platform, I reserve the old compatible. So, I think we don't need the Stratix10 compatible like "intel,socfpga-stratix10-hsotg "

You need. See above link.

Quoted 29 lines
Quoted 29 lines
Quoted 17 lines
Documentation/devicetree/bindings/usb/dwc2.yaml +1 -0
           - const: snps,dwc2
       - const: amcc,dwc-otg
       - const: apm,apm82181-dwc-otg
@@ -64,6 +65,7 @@ properties:
           - const: snps,dwc2
       - const: samsung,s3c6400-hsotg
       - const: intel,socfpga-agilex-hsotg
+      - const: intel,socfpga-hsotg
 
   reg:
     maxItems: 1
arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +0 -0
index ea788a920eab..c5a51636f657 100644

...

drivers/usb/dwc2/params.c static void dwc2_set_s3c6400_params(struct

Quoted 5 lines
drivers/usb/dwc2/params.c +0 -0
index 8eab5f38b110..6bb27a24e9e1 100644
@@ -93,7 +93,7 @@ static void dwc2_set_s3c6400_params(struct

dwc2_hsotg *hsotg)

Quoted 3 lines
drivers/usb/dwc2/params.c +0 -0
      p->phy_utmi_width = 8;
 }
 
Quoted 7 lines
Quoted 5 lines

drivers/usb/dwc2/params.c static void dwc2_set_s3c6400_params(struct dwc2_hsotg *hsotg) · line 96

Quoted 2 lines
drivers/usb/dwc2/params.c +1 -1
-static void dwc2_set_socfpga_agilex_params(struct dwc2_hsotg *hsotg)
+static void dwc2_set_socfpga_params(struct dwc2_hsotg *hsotg)

Why? Old name was ok...

Old name includes string "agilex" that represents only agilex SoC.

No, old name was representing the first compatibility chip.

Quoted 1 line

This patch is used to combine platform specific data for Intel Agilex and Stratix10, so create a common function name for socfpga family.

And what is wrong with using the previous one? No, don't do this. It brings no benefits.

Quoted 16 lines
Quoted 4 lines
Quoted 4 lines
drivers/usb/dwc2/params.c +0 -0
 {
      struct dwc2_core_params *p = &hsotg->params;
 
Quoted 11 lines

drivers/usb/dwc2/params.c const struct of_device_id dwc2_of_match_table[] = { · line 271

Quoted 8 lines
drivers/usb/dwc2/params.c +3 -1
@@ -266,7 +266,9 @@ const struct of_device_id dwc2_of_match_table[] = {
      { .compatible = "st,stm32mp15-hsotg",
        .data = dwc2_set_stm32mp15_hsotg_params },
      { .compatible = "intel,socfpga-agilex-hsotg",
-       .data = dwc2_set_socfpga_agilex_params },
+       .data = dwc2_set_socfpga_params },
+     { .compatible = "intel,socfpga-hsotg",
+       .data = dwc2_set_socfpga_params },

Aren't they compatible? Why do you need new entry for compatible devices?

Quoted 1 line

In fact, the usb IP in Agilex and Sratix10 are the same.

So you do not need new entry. Don't add it.

Quoted 1 line

But it is not reasonable to use agilex compatible string "intel,socfpga-agilex-hsotg" in Stratix10 dts files.

Why? Why you impose some rule which is different than all other SoCs in upstream? Why do I have to repeat it every now and then.... ehhh :(

https://elixir.bootlin.com/linux/v6.1-rc1/source/Documentation/devicetree/bindings/writing-bindings.rst#L42

Quoted 1 line

So, I create a common function name and compatible string for socfpga family that includes Agilex and Stratix10 SoCs.

Nope, sorry.

Best regards,
Krzysztof