devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: dts: sun8i: h3: Enable EMAC with external PHY on NanoPi M1 Plus
@ 2017-08-01  5:01 Luis Araneda
       [not found] ` <20170801050115.21497-1-luaraneda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Luis Araneda @ 2017-08-01  5:01 UTC (permalink / raw)
  To: robh+dt-DgEjT+Ai2ygdnm+yROfE0A
  Cc: mark.rutland-5wv7dgnIgG8, linux-I+IVW8TIWO2tmTQ+vhA3Yw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8, wens-jdAy2FN1RRM,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Luis Araneda

The Nanopi M1 Plus uses an external Realtek RTL8211E PHY in RGMII mode,
enabled by a GPIO-based regulator.

Signed-off-by: Luis Araneda <luaraneda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts | 31 +++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts b/arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts
index 8ddd1b2cc..54727990c 100644
--- a/arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts
+++ b/arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts
@@ -45,6 +45,20 @@
 / {
 	model = "FriendlyArm NanoPi M1 Plus";
 	compatible = "friendlyarm,nanopi-m1-plus", "allwinner,sun8i-h3";
+
+	aliases {
+		ethernet0 = &emac;
+	};
+
+	reg_gmac_3v3: gmac-3v3 {
+		compatible = "regulator-fixed";
+		regulator-name = "gmac-3v3";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		startup-delay-us = <100000>;
+		enable-active-high;
+		gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>; /* PD6 */
+	};
 };
 
 &ehci1 {
@@ -55,6 +69,23 @@
 	status = "okay";
 };
 
+&emac {
+	pinctrl-names = "default";
+	pinctrl-0 = <&emac_rgmii_pins>;
+	phy-supply = <&reg_gmac_3v3>;
+	phy-handle = <&ext_rgmii_phy>;
+	phy-mode = "rgmii";
+	allwinner,leds-active-low;
+	status = "okay";
+};
+
+&mdio {
+	ext_rgmii_phy: ethernet-phy@1 {
+		compatible = "ethernet-phy-ieee802.3-c22";
+		reg = <0>;
+	};
+};
+
 &ohci1 {
 	status = "okay";
 };
-- 
2.13.3

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: dts: sun8i: h3: Enable EMAC with external PHY on NanoPi M1 Plus
       [not found] ` <20170801050115.21497-1-luaraneda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-08-01  7:55   ` Chen-Yu Tsai
       [not found]     ` <CAGb2v66r1kpbzKN8uE5pb9mqzWMwTjn-N2ufZGdUU2LJ7FvbeA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Chen-Yu Tsai @ 2017-08-01  7:55 UTC (permalink / raw)
  To: Luis Araneda
  Cc: Rob Herring, Mark Rutland, Russell King, Maxime Ripard,
	Chen-Yu Tsai, devicetree, linux-arm-kernel

On Tue, Aug 1, 2017 at 1:01 PM, Luis Araneda <luaraneda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> The Nanopi M1 Plus uses an external Realtek RTL8211E PHY in RGMII mode,
> enabled by a GPIO-based regulator.
>
> Signed-off-by: Luis Araneda <luaraneda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts | 31 +++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
>
> diff --git a/arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts b/arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts
> index 8ddd1b2cc..54727990c 100644
> --- a/arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts
> +++ b/arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts
> @@ -45,6 +45,20 @@
>  / {
>         model = "FriendlyArm NanoPi M1 Plus";
>         compatible = "friendlyarm,nanopi-m1-plus", "allwinner,sun8i-h3";
> +
> +       aliases {
> +               ethernet0 = &emac;
> +       };
> +
> +       reg_gmac_3v3: gmac-3v3 {
> +               compatible = "regulator-fixed";
> +               regulator-name = "gmac-3v3";
> +               regulator-min-microvolt = <3300000>;
> +               regulator-max-microvolt = <3300000>;
> +               startup-delay-us = <100000>;
> +               enable-active-high;
> +               gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>; /* PD6 */
> +       };
>  };
>
>  &ehci1 {
> @@ -55,6 +69,23 @@
>         status = "okay";
>  };
>
> +&emac {
> +       pinctrl-names = "default";
> +       pinctrl-0 = <&emac_rgmii_pins>;
> +       phy-supply = <&reg_gmac_3v3>;
> +       phy-handle = <&ext_rgmii_phy>;
> +       phy-mode = "rgmii";
> +       allwinner,leds-active-low;

This property is for the internal PHY. You should not be using it
with an external PHY.

> +       status = "okay";
> +};
> +
> +&mdio {
> +       ext_rgmii_phy: ethernet-phy@1 {
> +               compatible = "ethernet-phy-ieee802.3-c22";
> +               reg = <0>;

Value in reg should match the address part of the node name.

ChenYu

> +       };
> +};
> +
>  &ohci1 {
>         status = "okay";
>  };
> --
> 2.13.3
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: dts: sun8i: h3: Enable EMAC with external PHY on NanoPi M1 Plus
       [not found]     ` <CAGb2v66r1kpbzKN8uE5pb9mqzWMwTjn-N2ufZGdUU2LJ7FvbeA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-08-02  2:39       ` Luis Araneda
  0 siblings, 0 replies; 3+ messages in thread
From: Luis Araneda @ 2017-08-02  2:39 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Rob Herring, Mark Rutland, Russell King, Maxime Ripard,
	devicetree, linux-arm-kernel

Hi,

On Tue, Aug 1, 2017 at 3:55 AM, Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org> wrote:
> On Tue, Aug 1, 2017 at 1:01 PM, Luis Araneda <luaraneda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> +&emac {
>> +       pinctrl-names = "default";
>> +       pinctrl-0 = <&emac_rgmii_pins>;
>> +       phy-supply = <&reg_gmac_3v3>;
>> +       phy-handle = <&ext_rgmii_phy>;
>> +       phy-mode = "rgmii";
>> +       allwinner,leds-active-low;
>
> This property is for the internal PHY. You should not be using it
> with an external PHY.

You're right. When reading the file "dwmac-sun8i.txt" I thought EPHY meant
External PHY, but it means Ethernet PHY (integrated).
I've tested the board without the property and the LEDs are working fine.

>
>> +       status = "okay";
>> +};
>> +
>> +&mdio {
>> +       ext_rgmii_phy: ethernet-phy@1 {
>> +               compatible = "ethernet-phy-ieee802.3-c22";
>> +               reg = <0>;
>
> Value in reg should match the address part of the node name.

Ok.

I'll be sending a v2 with the suggested changes.

Cheers,

Luis Araneda.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-02  2:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-01  5:01 [PATCH] ARM: dts: sun8i: h3: Enable EMAC with external PHY on NanoPi M1 Plus Luis Araneda
     [not found] ` <20170801050115.21497-1-luaraneda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-01  7:55   ` Chen-Yu Tsai
     [not found]     ` <CAGb2v66r1kpbzKN8uE5pb9mqzWMwTjn-N2ufZGdUU2LJ7FvbeA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-02  2:39       ` Luis Araneda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).