diff mbox series

[v3,15/15] ARM: dts: rza2mevb: Add USB host support

Message ID 20190514145605.19112-16-chris.brandt@renesas.com (mailing list archive)
State Superseded
Delegated to: Simon Horman
Headers show
Series usb: Add host and device support for RZ/A2 | expand

Commit Message

Chris Brandt May 14, 2019, 2:56 p.m. UTC
Enable USB Host support for both the Type-C connector on the CPU board
and the Type-A plug on the sub board.

Both boards are also capable of USB Device operation as well after the
appropriate Device Tree modifications.

Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
---
v2:
 * added blank line between nodes
 * removed 'r7s9210-' from patch title
 * removed 'renesas,uses_usb_x1' property
---
 arch/arm/boot/dts/r7s9210-rza2mevb.dts | 37 ++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

Comments

Geert Uytterhoeven May 15, 2019, 8:21 a.m. UTC | #1
Hi Chris,

On Tue, May 14, 2019 at 4:58 PM Chris Brandt <chris.brandt@renesas.com> wrote:
> Enable USB Host support for both the Type-C connector on the CPU board
> and the Type-A plug on the sub board.
>
> Both boards are also capable of USB Device operation as well after the
> appropriate Device Tree modifications.
>
> Signed-off-by: Chris Brandt <chris.brandt@renesas.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
One question below.

> --- a/arch/arm/boot/dts/r7s9210-rza2mevb.dts
> +++ b/arch/arm/boot/dts/r7s9210-rza2mevb.dts

> @@ -161,3 +173,28 @@
>         bus-width = <4>;
>         status = "okay";
>  };
> +
> +/* USB-0 as Host */
> +/* NOTE: Requires JP3 to be fitted */

This not applies to the dr_mode property below, right?
So perhaps it should be moved there...

> +&usb2_phy0 {
> +       pinctrl-names = "default";
> +       pinctrl-0 = <&usb0_pins>;
> +       dr_mode = "host";

... like:

    dr_mode = "host";    /* Requires JP3 to be fitted */

Does resistor R78 need to be mounted, too?

> +       status = "okay";
> +};

Gr{oetje,eeting}s,

                        Geert
Chris Brandt May 15, 2019, 2:03 p.m. UTC | #2
Hi Geert,

On Wed, May 15, 2019, Geert Uytterhoeven wrote:
> > +/* USB-0 as Host */
> > +/* NOTE: Requires JP3 to be fitted */
> 
> This not applies to the dr_mode property below, right?
> So perhaps it should be moved there...
> 
> > +&usb2_phy0 {
> > +       pinctrl-names = "default";
> > +       pinctrl-0 = <&usb0_pins>;
> > +       dr_mode = "host";
> 
> ... like:
> 
>     dr_mode = "host";    /* Requires JP3 to be fitted */

OK, if you think it makes more sense there.


> Does resistor R78 need to be mounted, too?

By default, R78 and R79 are not populated on these boards, and both Host
and Function work fine without board modification, so I would say 
populating R78 is not a requirement as far as I can tell.

Chris
Geert Uytterhoeven May 15, 2019, 2:33 p.m. UTC | #3
Hi Chris,

On Wed, May 15, 2019 at 4:03 PM Chris Brandt <Chris.Brandt@renesas.com> wrote:
> On Wed, May 15, 2019, Geert Uytterhoeven wrote:
> > > +/* USB-0 as Host */
> > > +/* NOTE: Requires JP3 to be fitted */
> >
> > This not applies to the dr_mode property below, right?
> > So perhaps it should be moved there...
> >
> > > +&usb2_phy0 {
> > > +       pinctrl-names = "default";
> > > +       pinctrl-0 = <&usb0_pins>;
> > > +       dr_mode = "host";
> >
> > ... like:
> >
> >     dr_mode = "host";    /* Requires JP3 to be fitted */
>
> OK, if you think it makes more sense there.
>
> > Does resistor R78 need to be mounted, too?
>
> By default, R78 and R79 are not populated on these boards, and both Host
> and Function work fine without board modification, so I would say
> populating R78 is not a requirement as far as I can tell.

I asked because after reading Section 2.4 USB Interface in the RZ/A2M CPU
Board  User's Manual, it's not clear to me when one needs to
populate one of these resistors. Especially in relation to JP3, which
talks about 2 possible modes (host vs. function), while the resistor
paragraph talks about 3 possible modes (dual-role vs. host vs.
function).

Perhaps I just need to drink more USB Kool-Aid?
(no Kool-Aid sold in local shops, though; we live on Coke ;-)

Thanks!

Gr{oetje,eeting}s,

                        Geert
Chris Brandt May 15, 2019, 2:54 p.m. UTC | #4
Hi Geert,

On Wed, May 15, 2019 1, Geert Uytterhoeven wrote:
> > > Does resistor R78 need to be mounted, too?
> >
> > By default, R78 and R79 are not populated on these boards, and both Host
> > and Function work fine without board modification, so I would say
> > populating R78 is not a requirement as far as I can tell.
> 
> I asked because after reading Section 2.4 USB Interface in the RZ/A2M CPU
> Board  User's Manual, it's not clear to me when one needs to
> populate one of these resistors. Especially in relation to JP3, which
> talks about 2 possible modes (host vs. function), while the resistor
> paragraph talks about 3 possible modes (dual-role vs. host vs.
> function).

Honestly, I'm not sure what they were thinking.
They put on a USB-C connector, and put on circuitry to detect if a Host 
or device was attached....but then put a physical jumper on the board to
connect/disconnect VBUS power.


> Perhaps I just need to drink more USB Kool-Aid?
> (no Kool-Aid sold in local shops, though; we live on Coke ;-)

Maybe not Kool-Aid as it seem they were 'smoking something' instead. :o


Chris
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/r7s9210-rza2mevb.dts b/arch/arm/boot/dts/r7s9210-rza2mevb.dts
index 7da409170db5..c0a4484a0bde 100644
--- a/arch/arm/boot/dts/r7s9210-rza2mevb.dts
+++ b/arch/arm/boot/dts/r7s9210-rza2mevb.dts
@@ -107,6 +107,18 @@ 
 		pinmux = <RZA2_PINMUX(PORT5, 4, 3)>,	/* SD1_CD */
 			 <RZA2_PINMUX(PORT5, 5, 3)>;	/* SD1_WP */
 	};
+
+	usb0_pins: usb0 {
+		pinmux = <RZA2_PINMUX(PORT5, 2, 3)>,	/* VBUSIN0 */
+			 <RZA2_PINMUX(PORTC, 6, 1)>,	/* VBUSEN0 */
+			 <RZA2_PINMUX(PORTC, 7, 1)>;	/* OVRCUR0 */
+	};
+
+	usb1_pins: usb1 {
+		pinmux = <RZA2_PINMUX(PORTC, 0, 1)>,	/* VBUSIN1 */
+			 <RZA2_PINMUX(PORTC, 5, 1)>,	/* VBUSEN1 */
+			 <RZA2_PINMUX(PORT7, 5, 5)>;	/* OVRCUR1 */
+	};
 };
 
 /* High resolution System tick timers */
@@ -161,3 +173,28 @@ 
 	bus-width = <4>;
 	status = "okay";
 };
+
+/* USB-0 as Host */
+/* NOTE: Requires JP3 to be fitted */
+&usb2_phy0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&usb0_pins>;
+	dr_mode = "host";
+	status = "okay";
+};
+
+&ehci0 {
+	status = "okay";
+};
+
+/* USB-1 as Host */
+&usb2_phy1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&usb1_pins>;
+	dr_mode = "host";
+	status = "okay";
+};
+
+&ehci1 {
+	status = "okay";
+};