Skip to contentSkip to conversation

Add HSUSB to r8a7743

PATCH New Fabrizio Castro 2 participants 13 messages Mar 6, 2018 – Apr 10, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Add HSUSB to r8a7743

Dear All,

this series backports all the patches necessary to add HSUSB support to the r8a7743.

Thanks,
Fabrizio

Biju Das (5):
usb: renesas_usbhs: Add compatible string for r8a7743/5
ARM: dts: r8a7743: Add HS-USB device node
ARM: dts: iwg20d-q7: Enable HS-USB
ARM: dts: r8a7743: Add USB-DMAC device nodes
ARM: dts: r8a7743: Enable DMA for HSUSB

Simon Horman (2):
usb: renesas_usbhs: add SoC names to compatibility string
documentation
usb: renesas_usbhs: add fallback compatibility strings

 .../devicetree/bindings/usb/renesas_usbhs.txt      | 22 ++++++++----
 arch/arm/boot/dts/iwg20d-q7-common.dtsi            |  7 +++-
 arch/arm/boot/dts/r8a7743.dtsi                     | 40 ++++++++++++++++++++++
 drivers/usb/renesas_usbhs/common.c                 |  9 +++++
 4 files changed, 71 insertions(+), 7 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/7 usb: renesas_usbhs: add SoC names to compatibility string documentation

From: Simon Horman <[email protected]>

This extends the documentation of compatibility strings a little to include the SoC names.

(cherry picked from commit 89d75bf18d0e3e9a02961f537c87d7991df3bd32)
---
 Documentation/devicetree/bindings/usb/renesas_usbhs.txt | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/usb/renesas_usbhs.txt +4 -4
index 7d48f63..a14c0bb 100644
@@ -2,10 +2,10 @@ Renesas Electronics USBHS driver
 
 Required properties:
   - compatible: Must contain one of the following:
-	- "renesas,usbhs-r8a7790"
-	- "renesas,usbhs-r8a7791"
-	- "renesas,usbhs-r8a7794"
-	- "renesas,usbhs-r8a7795"
+	- "renesas,usbhs-r8a7790" for r8a7790 (R-Car H2) compatible device
+	- "renesas,usbhs-r8a7791" for r8a7791 (R-Car M2-W) compatible device
+	- "renesas,usbhs-r8a7794" for r8a7794 (R-Car E2) compatible device
+	- "renesas,usbhs-r8a7795" for r8a7795 (R-Car H3) compatible device
   - reg: Base address and length of the register for the USBHS
   - interrupts: Interrupt specifier for the USBHS
   - clocks: A list of phandle + clock specifier pairs
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/7 usb: renesas_usbhs: add fallback compatibility strings

In reply to Fabrizio Castro

From: Simon Horman <[email protected]>

Add fallback compatibility strings for R-Car Gen2 and Gen3. This is in keeping with the fallback scheme being adopted wherever appropriate for drivers for Renesas SoCs.

(cherry picked from commit 2f1a993a0da652c50e08159f16590b7f9820d192)
---
 Documentation/devicetree/bindings/usb/renesas_usbhs.txt | 12 ++++++++++--
 drivers/usb/renesas_usbhs/common.c                      |  9 +++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/usb/renesas_usbhs.txt +10 -2
index a14c0bb..45d9ae1 100644
@@ -1,11 +1,19 @@
 Renesas Electronics USBHS driver
 
 Required properties:
-  - compatible: Must contain one of the following:
+  - compatible: Must contain one or more of the following:
+
 	- "renesas,usbhs-r8a7790" for r8a7790 (R-Car H2) compatible device
 	- "renesas,usbhs-r8a7791" for r8a7791 (R-Car M2-W) compatible device
 	- "renesas,usbhs-r8a7794" for r8a7794 (R-Car E2) compatible device
 	- "renesas,usbhs-r8a7795" for r8a7795 (R-Car H3) compatible device
+	- "renesas,rcar-gen2-usbhs" for R-Car Gen2 compatible device
+	- "renesas,rcar-gen3-usbhs" for R-Car Gen3 compatible device
+
+	When compatible with the generic version, nodes must list the
+	SoC-specific version corresponding to the platform first followed
+	by the generic version.
+
   - reg: Base address and length of the register for the USBHS
   - interrupts: Interrupt specifier for the USBHS
   - clocks: A list of phandle + clock specifier pairs
@@ -22,7 +30,7 @@ Optional properties:
 
 Example:
 	usbhs: usb at e6590000 {
-		compatible = "renesas,usbhs-r8a7790";
+		compatible = "renesas,usbhs-r8a7790", "renesas,rcar-gen2-usbhs";
 		reg = <0 0xe6590000 0 0x100>;
 		interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp7_clks R8A7790_CLK_HSUSB>;
drivers/usb/renesas_usbhs/common.c +9 -0
index 005da08..2fa4479 100644
@@ -481,6 +481,15 @@ static const struct of_device_id usbhs_of_match[] = {
 		.compatible = "renesas,usbhs-r8a7795",
 		.data = (void *)USBHS_TYPE_RCAR_GEN2,
 	},
+	{
+		.compatible = "renesas,rcar-gen2-usbhs",
+		.data = (void *)USBHS_TYPE_RCAR_GEN2,
+	},
+	{
+		/* Gen3 is compatible with Gen2 */
+		.compatible = "renesas,rcar-gen3-usbhs",
+		.data = (void *)USBHS_TYPE_RCAR_GEN2,
+	},
 	{ },
 };
 MODULE_DEVICE_TABLE(of, usbhs_of_match);
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/7 usb: renesas_usbhs: Add compatible string for r8a7743/5

In reply to Fabrizio Castro

From: Biju Das <[email protected]>

This patch adds support for r8a7743/5 SoCs. The Renesas RZ/G1[ME] (R8A7743/5) usbhs is identical to the R-Car Gen2 family.

No driver change is needed due to the fallback compatible value "renesas,rcar-gen2-usbhs".
Adding the SoC-specific compatible values here has two purposes:
1. Document which SoCs have this hardware module,
2. Allow checkpatch to validate compatible values.

---
 Documentation/devicetree/bindings/usb/renesas_usbhs.txt | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/usb/renesas_usbhs.txt +2 -0
index 45d9ae1..65af38c 100644
@@ -3,6 +3,8 @@ Renesas Electronics USBHS driver
 Required properties:
   - compatible: Must contain one or more of the following:
 
+	- "renesas,usbhs-r8a7743" for r8a7743 (RZ/G1M) compatible device
+	- "renesas,usbhs-r8a7745" for r8a7745 (RZ/G1E) compatible device
 	- "renesas,usbhs-r8a7790" for r8a7790 (R-Car H2) compatible device
 	- "renesas,usbhs-r8a7791" for r8a7791 (R-Car M2-W) compatible device
 	- "renesas,usbhs-r8a7794" for r8a7794 (R-Car E2) compatible device
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/7 ARM: dts: r8a7743: Add HS-USB device node

In reply to Fabrizio Castro

From: Biju Das <[email protected]>

Define the R8A7743 generic part of the HS-USB device node. It is up to the board file to enable the device.

(cherry picked from commit 4b4a3b1c33b7a389d90624683d8f1a8d1dc2affa)

(modified clocks, power-domains properties and removed resets property)

---
 arch/arm/boot/dts/r8a7743.dtsi | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/boot/dts/r8a7743.dtsi +13 -0
index 1b17a20..1237746 100644
@@ -1185,6 +1185,19 @@
 			};
 		};
 
+		hsusb: usb at e6590000 {
+			compatible = "renesas,usbhs-r8a7743",
+				     "renesas,rcar-gen2-usbhs";
+			reg = <0 0xe6590000 0 0x100>;
+			interrupts = <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&mstp7_clks R8A7743_CLK_HSUSB>;
+			power-domains = <&cpg_clocks>;
+			renesas,buswait = <4>;
+			phys = <&usb0 1>;
+			phy-names = "usb";
+			status = "disabled";
+		};
+
 		usbphy: usb-phy at e6590100 {
 			compatible = "renesas,usb-phy-r8a7743",
 				     "renesas,rcar-gen2-usb-phy";
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/7 ARM: dts: iwg20d-q7: Enable HS-USB

In reply to Fabrizio Castro

From: Biju Das <[email protected]>

Enable HS-USB device for the iWave G20D-Q7 carrier board based on RZ/G1M.
Also disable the host mode support on usb otg port by default to avoid pin conflicts.

(cherry picked from commit 405b580227ff1ae8fde82a666a2a5c0391a7e64a)
---
 arch/arm/boot/dts/iwg20d-q7-common.dtsi | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/boot/dts/iwg20d-q7-common.dtsi +6 -1
index fbb5215..8f203c5 100644
@@ -59,6 +59,12 @@
 	};
 };
 
+&hsusb {
+	status = "okay";
+	pinctrl-0 = <&usb0_pins>;
+	pinctrl-names = "default";
+};
+
 &i2c2 {
 	pinctrl-0 = <&i2c2_pins>;
 	pinctrl-names = "default";
@@ -111,7 +117,6 @@
 };
 
 &pci0 {
-	status = "okay";
 	pinctrl-0 = <&usb0_pins>;
 	pinctrl-names = "default";
 };
Signature · 1 line
2.7.4
#6 lore raw

PATCH 6/7 ARM: dts: r8a7743: Add USB-DMAC device nodes

In reply to Fabrizio Castro

From: Biju Das <[email protected]>

(cherry picked from commit 310861003a0d59cb410538bcdf73a218157a111d)

(modified clocks and power-domains properties, removed resets property)

---
 arch/arm/boot/dts/r8a7743.dtsi | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
arch/arm/boot/dts/r8a7743.dtsi +24 -0
index 1237746..db00959 100644
@@ -309,6 +309,30 @@
 			dma-channels = <15>;
 		};
 
+		usb_dmac0: dma-controller at e65a0000 {
+			compatible = "renesas,usb-dmac";
+			reg = <0 0xe65a0000 0 0x100>;
+			interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH
+				      GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "ch0", "ch1";
+			clocks = <&mstp3_clks R8A7743_CLK_USBDMAC0>;
+			power-domains = <&cpg_clocks>;
+			#dma-cells = <1>;
+			dma-channels = <2>;
+		};
+
+		usb_dmac1: dma-controller at e65b0000 {
+			compatible = "renesas,usb-dmac";
+			reg = <0 0xe65b0000 0 0x100>;
+			interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH
+				      GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "ch0", "ch1";
+			clocks = <&mstp3_clks R8A7743_CLK_USBDMAC1>;
+			power-domains = <&cpg_clocks>;
+			#dma-cells = <1>;
+			dma-channels = <2>;
+		};
+
 		/* The memory map in the User's Manual maps the cores to bus
 		 *  numbers
 		 */
Signature · 1 line
2.7.4
#7 lore raw

PATCH 6/7 ARM: dts: r8a7743: Add USB-DMAC device nodes

Quoted 21 lines · Fabrizio Castro

From: Biju Das <[email protected]>

(cherry picked from commit 310861003a0d59cb410538bcdf73a218157a111d)

(modified clocks and power-domains properties, removed resets property)

---
?arch/arm/boot/dts/r8a7743.dtsi | 24 ++++++++++++++++++++++++ ?1 file changed, 24 insertions(+)

arch/arm/boot/dts/r8a7743.dtsi +0 -0
index 1237746..db00959 100644
@@ -309,6 +309,30 @@
 ?			dma-channels = <15>;
 ?		};

?

arch/arm/boot/dts/r8a7743.dtsi

Quoted 2 lines
arch/arm/boot/dts/r8a7743.dtsi +2 -0
+		usb_dmac0: dma-controller at e65a0000 {
+			compatible = "renesas,usb-dmac";

[...]

Why no "renesas,r8a7743-usb-dmac" compatible string?

Ben.

Signature · 2 lines
Ben Hutchings
Software Developer, Codethink Ltd.
#8 lore raw

PATCH 6/7 ARM: dts: r8a7743: Add USB-DMAC device nodes

Hi Ben,

Quoted 27 lines

Subject: Re: [cip-dev][PATCH 6/7] ARM: dts: r8a7743: Add USB-DMAC device nodes

[This sender failed our fraud detection checks and may not be who they appear to be. Learn about spoofing at
http://aka.ms/LearnAboutSpoofing]

Quoted 21 lines · Fabrizio Castro

From: Biju Das <[email protected]>

(cherry picked from commit 310861003a0d59cb410538bcdf73a218157a111d)

(modified clocks and power-domains properties, removed resets property)

---
 arch/arm/boot/dts/r8a7743.dtsi | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
arch/arm/boot/dts/r8a7743.dtsi +0 -0
index 1237746..db00959 100644
@@ -309,6 +309,30 @@
                      dma-channels = <15>;
              };
 
Quoted 5 lines

arch/arm/boot/dts/r8a7743.dtsi line 313

Quoted 2 lines
arch/arm/boot/dts/r8a7743.dtsi +2 -0
+             usb_dmac0: dma-controller at e65a0000 {
+                     compatible = "renesas,usb-dmac";

[...]

Why no "renesas,r8a7743-usb-dmac" compatible string?

It's down to the dt-bindings, commit 0b2eed49875ec3605b7a71bdf05adc8c1cbd49fc introduces SoC specific support, this would trigger changes to the corresponding SoC specific DT touched by such a change, and as usual, where do we draw the line with the backporting? Would you rather I used "renesas,r8a7743-usb-dmac" instead?

Thanks,
Fab

Quoted 6 lines

Ben.

--
Ben Hutchings
Software Developer, Codethink Ltd.

Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.

#9 lore raw

PATCH 6/7 ARM: dts: r8a7743: Add USB-DMAC device nodes

Quoted 34 lines · Fabrizio Castro

Hi Ben,

Quoted 32 lines

Subject: Re: [cip-dev][PATCH 6/7] ARM: dts: r8a7743: Add USB-DMAC device nodes

[This sender failed our fraud detection checks and may not be who they appear to be. Learn about spoofing at
http://aka.ms/LearnAboutSpoofing]

Quoted 23 lines · Fabrizio Castro

From: Biju Das <[email protected]>

(cherry picked from commit 310861003a0d59cb410538bcdf73a218157a111d)

(modified clocks and power-domains properties, removed resets property)

---
?arch/arm/boot/dts/r8a7743.dtsi | 24 ++++++++++++++++++++++++ ?1 file changed, 24 insertions(+)

arch/arm/boot/dts/r8a7743.dtsi +2 -0
index 1237746..db00959 100644
@@ -309,6 +309,30 @@
 ??????????????????????dma-channels = <15>;
 ??????????????};
 
+?????????????usb_dmac0: dma-controller at e65a0000 {
+?????????????????????compatible = "renesas,usb-dmac";

[...]

Quoted 5 lines
Quoted 1 line

Why no "renesas,r8a7743-usb-dmac" compatible string?

It's down to the dt-bindings, commit 0b2eed49875ec3605b7a71bdf05adc8c1cbd49fc introduces SoC specific support, this would trigger changes to the corresponding SoC specific DT touched by such a change,

It adds documentation of the string. It wouldn't trigger anything.

Quoted 2 lines

and as usual, where do we draw the line with
the backporting? Would you rather I used "renesas,r8a7743-usb-dmac" instead?

In general we should make the minimum necessary changes to a backported commit. Deleting one of the compatible strings does not appear to be necessary.

Ben.

Signature · 2 lines
Ben Hutchings
Software Developer, Codethink Ltd.
#10 lore raw

PATCH 7/7 ARM: dts: r8a7743: Enable DMA for HSUSB

In reply to Fabrizio Castro

From: Biju Das <[email protected]>

This patch adds DMA properties to the HSUSB node.

(cherry picked from commit e0a10e7b070624965f20205c59fb2a0c0b465782)
---
 arch/arm/boot/dts/r8a7743.dtsi | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/boot/dts/r8a7743.dtsi +3 -0
index db00959..40137cf 100644
@@ -1215,6 +1215,9 @@
 			reg = <0 0xe6590000 0 0x100>;
 			interrupts = <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&mstp7_clks R8A7743_CLK_HSUSB>;
+			dmas = <&usb_dmac0 0>, <&usb_dmac0 1>,
+			       <&usb_dmac1 0>, <&usb_dmac1 1>;
+			dma-names = "ch0", "ch1", "ch2", "ch3";
 			power-domains = <&cpg_clocks>;
 			renesas,buswait = <4>;
 			phys = <&usb0 1>;
Signature · 1 line
2.7.4
#11 lore raw

cover Add HSUSB to r8a7743

In reply to Fabrizio Castro

I've applied this series, thanks. I added back the compatible strings that you left out of the last patch, since I didn't see any need to diverge from upstream there.

Ben.

Quoted 26 lines · Fabrizio Castro

Dear All,

this series backports all the patches necessary to add HSUSB support to the r8a7743.

Thanks,
Fabrizio

Biju Das (5):
? usb: renesas_usbhs: Add compatible string for r8a7743/5 ? ARM: dts: r8a7743: Add HS-USB device node
? ARM: dts: iwg20d-q7: Enable HS-USB
? ARM: dts: r8a7743: Add USB-DMAC device nodes
? ARM: dts: r8a7743: Enable DMA for HSUSB

Simon Horman (2):
? usb: renesas_usbhs: add SoC names to compatibility string ????documentation
? usb: renesas_usbhs: add fallback compatibility strings

?.../devicetree/bindings/usb/renesas_usbhs.txt??????| 22 ++++++++----
?arch/arm/boot/dts/iwg20d-q7-common.dtsi????????????|??7 +++-
?arch/arm/boot/dts/r8a7743.dtsi?????????????????????| 40 ++++++++++++++++++++++
?drivers/usb/renesas_usbhs/common.c?????????????????|??9 +++++

?4 files changed, 71 insertions(+), 7 deletions(-)

Signature · 2 lines
Ben Hutchings
Software Developer, Codethink Ltd.
#12 lore raw

cover Add HSUSB to r8a7743

Hello Ben,

Quoted 5 lines

Subject: Re: [cip-dev][PATCH 0/7] Add HSUSB to r8a7743

I've applied this series, thanks. I added back the compatible strings that you left out of the last patch, since I didn't see any need to diverge from upstream there.

Ok.

Thanks,
Fab

Quoted 30 lines

Ben.

Quoted 20 lines · Fabrizio Castro

Dear All,

this series backports all the patches necessary to add HSUSB support to the r8a7743.

Thanks,
Fabrizio

Biju Das (5):
usb: renesas_usbhs: Add compatible string for r8a7743/5
ARM: dts: r8a7743: Add HS-USB device node
ARM: dts: iwg20d-q7: Enable HS-USB
ARM: dts: r8a7743: Add USB-DMAC device nodes
ARM: dts: r8a7743: Enable DMA for HSUSB

Simon Horman (2):
usb: renesas_usbhs: add SoC names to compatibility string
documentation
usb: renesas_usbhs: add fallback compatibility strings

Quoted 6 lines
 .../devicetree/bindings/usb/renesas_usbhs.txt      | 22 ++++++++----
 arch/arm/boot/dts/iwg20d-q7-common.dtsi            |  7 +++-
 arch/arm/boot/dts/r8a7743.dtsi                     | 40 ++++++++++++++++++++++
 drivers/usb/renesas_usbhs/common.c                 |  9 +++++
 4 files changed, 71 insertions(+), 7 deletions(-)
Quoted 3 lines

--
Ben Hutchings
Software Developer, Codethink Ltd.

Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.