Skip to contentSkip to conversation

Add HS-USB device tree support for R8A7790/Lager board

PATCH New Sergei Shtylyov 2 participants 6 messages Oct 7, 2014 – Oct 8, 2014

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

v3 cover Add HS-USB device tree support for R8A7790/Lager board

Hello.

Here's the set of 2 patches against Simon Horman's 'renesas.git' repo,
'renesas-devel-20141007-v3.17' tag. Here we add the HS-USB device tree support on the R8A7790/Lager reference board. The patchset requires the USB PHY driver (already merged by Kishon and Greg) and the generic PHY support patches for the HS-USB driver posted by Yoshihiro Shimoda in order to work...

[1/2] ARM: shmobile: r8a7790: add HS-USB device node [2/2] ARM: shmobile: lager: enable HS-USB

WBR, Sergei

#1 lore raw

PATCH v3 1/2 ARM: shmobile: r8a7790: add HS-USB device node

From: Yoshihiro Shimoda <[email protected]>

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

[Sergei: fixed summary, added changelog]

---
Changes in version 3:
- uppercased "arm" in the summary;
- added changelog.

 arch/arm/boot/dts/r8a7790.dtsi |   11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/r8a7790.dtsi +11 -0
Index: renesas/arch/arm/boot/dts/r8a7790.dtsi
===================================================================
@@ -600,6 +600,17 @@
 		status = "disabled";
 	};
 
+	hsusb: usb at e6590000 {
+		compatible = "renesas,usbhs-r8a7790";
+		reg = <0 0xe6590000 0 0x100>;
+		interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&mstp7_clks R8A7790_CLK_HSUSB>;
+		renesas,buswait = <4>;
+		phys = <&usb0 1>;
+		phy-names = "usb";
+		status = "disabled";
+	};
+
 	usbphy: usb-phy at e6590100 {
 		compatible = "renesas,usb-phy-r8a7790";
 		reg = <0 0xe6590100 0 0x100>;
#2 lore raw

PATCH v3 2/2 ARM: shmobile: lager: enable HS-USB

In reply to Sergei Shtylyov

From: Yoshihiro Shimoda <[email protected]>

Enable HS-USB device for the Lager board, defining the GPIO that the driver should check when probing. Since this board doesn't have the OTG ID pin, we assume that GP5_18 (USB0_PWEN) is an ID pin because it is 1 when the SW5 is in position 2-3 (meaning USB function) and 0 in other positions.

Note that there will be pinctrl-related error messages if both internal PCI and HS-USB drivers are enabled but they should be just ignored.

[Sergei: added pin function/group and prop, moved device node, fixed summary, supplemented changelog]

---
Changes in version 3:
- added pin function/group and the pinctrl-related prop;
- moved the HS-USB node to precede the USB PHY node;
- uppercased "arm" in the summary;
- supplemented changelog.

 arch/arm/boot/dts/r8a7790-lager.dts |   12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm/boot/dts/r8a7790-lager.dts +12 -0
Index: renesas/arch/arm/boot/dts/r8a7790-lager.dts
===================================================================
@@ -226,6 +226,11 @@
 		renesas,function = "usb0";
 	};
 
+	hsusb_pins: usb0 {
+		renesas,groups = "usb0_ovc_vbus";
+		renesas,function = "usb0";
+	};
+
 	usb1_pins: usb1 {
 		renesas,groups = "usb1";
 		renesas,function = "usb1";
@@ -425,6 +430,13 @@
 	pinctrl-names = "default";
 };
 
+&hsusb {
+	status = "okay";
+	pinctrl-0 = <&hsusb_pins>;
+	pinctrl-names = "default";
+	renesas,enable-gpio = <&gpio5 18 GPIO_ACTIVE_HIGH>;
+};
+
 &usbphy {
 	status = "okay";
 };
#3 lore raw

PATCH v3 2/2 ARM: shmobile: lager: enable HS-USB

Quoted 30 lines · Sergei Shtylyov

From: Yoshihiro Shimoda <[email protected]>

Enable HS-USB device for the Lager board, defining the GPIO that the driver should check when probing. Since this board doesn't have the OTG ID pin, we assume that GP5_18 (USB0_PWEN) is an ID pin because it is 1 when the SW5 is in position 2-3 (meaning USB function) and 0 in other positions.

Note that there will be pinctrl-related error messages if both internal PCI and HS-USB drivers are enabled but they should be just ignored.

[Sergei: added pin function/group and prop, moved device node, fixed summary, supplemented changelog]

---
Changes in version 3:
- added pin function/group and the pinctrl-related prop;
- moved the HS-USB node to precede the USB PHY node;
- uppercased "arm" in the summary;
- supplemented changelog.

  arch/arm/boot/dts/r8a7790-lager.dts |   12 ++++++++++++
  1 file changed, 12 insertions(+)

Index: renesas/arch/arm/boot/dts/r8a7790-lager.dts
===================================================================

arch/arm/boot/dts/r8a7790-lager.dts line 229

Quoted 4 lines
arch/arm/boot/dts/r8a7790-lager.dts +1 -0
@@ -226,6 +226,11 @@
  		renesas,function = "usb0";
  	};
 
+	hsusb_pins: usb0 {

Oops, forgot to rename the node. :-/ Although dtc didn't protest.

WBR, Sergei

#4 lore raw

PATCH v3 2/2 ARM: shmobile: lager: enable HS-USB

In reply to Sergei Shtylyov

Hello.

Quoted 7 lines · Sergei Shtylyov

From: Yoshihiro Shimoda <[email protected]>

Enable HS-USB device for the Lager board, defining the GPIO that the driver should check when probing. Since this board doesn't have the OTG ID pin, we assume that GP5_18 (USB0_PWEN) is an ID pin because it is 1 when the SW5 is in position 2-3 (meaning USB function) and 0 in other positions.

< snip >

arch/arm/boot/dts/r8a7790-lager.dts line 230

Quoted 10 lines

Index: renesas/arch/arm/boot/dts/r8a7790-lager.dts
===================================================================

arch/arm/boot/dts/r8a7790-lager.dts +2 -0
@@ -226,6 +226,11 @@
 		renesas,function = "usb0";
 	};
 
+	hsusb_pins: usb0 {
+		renesas,groups = "usb0_ovc_vbus";

Thank you for the v3 patch.
I tested this, and kernel log said "GP_5_19 already requested". However, the hsusb on lager uses GP_5_18. Is this correct behavior?

sh-pfc e6060000.pfc: pin GP_5_19 already requested by ee090000.pci; cannot claim for e6590000.usb sh-pfc e6060000.pfc: pin-179 (e6590000.usb) status -22
sh-pfc e6060000.pfc: could not request pin 179 (GP_5_19) from group usb0_ovc_vbus on device sh-pfc

Best regards,
Yoshihiro Shimoda

#5 lore raw

PATCH v3 2/2 ARM: shmobile: lager: enable HS-USB

Quoted 14 lines · Yoshihiro Shimoda
Quoted 4 lines

Enable HS-USB device for the Lager board, defining the GPIO that the driver should check when probing. Since this board doesn't have the OTG ID pin, we assume that GP5_18 (USB0_PWEN) is an ID pin because it is 1 when the SW5 is in position 2-3 (meaning USB function) and 0 in other positions.

< snip >

Quoted 8 lines

Index: renesas/arch/arm/boot/dts/r8a7790-lager.dts
===================================================================

arch/arm/boot/dts/r8a7790-lager.dts +0 -0
@@ -226,6 +226,11 @@
  		renesas,function = "usb0";
  	};
 
Quoted 5 lines

arch/arm/boot/dts/r8a7790-lager.dts line 230

Quoted 2 lines
arch/arm/boot/dts/r8a7790-lager.dts +2 -0
+	hsusb_pins: usb0 {
+		renesas,groups = "usb0_ovc_vbus";

Thank you for the v3 patch.
I tested this, and kernel log said "GP_5_19 already requested".

GP5_19 is also USB0_OVC_VBUS. It's used by PCI [EO]HCI.

Quoted 1 line

However, the hsusb on lager uses GP_5_18. Is this correct behavior?

Yes, this error needs to be ignored (I wrote about that in the changelog
but you cut out that part). If you disable the internal PCI driver, this error will disappear.

Quoted 3 lines

sh-pfc e6060000.pfc: pin GP_5_19 already requested by ee090000.pci; cannot claim for e6590000.usb sh-pfc e6060000.pfc: pin-179 (e6590000.usb) status -22
sh-pfc e6060000.pfc: could not request pin 179 (GP_5_19) from group usb0_ovc_vbus on device sh-pfc

The kernel log already tells you well about the source of error.

Quoted 2 lines

Best regards,
Yoshihiro Shimoda

WBR, Sergei