Skip to contentSkip to conversation

Enable ethernet on nanopi m1 and nanopi m1 plus

PATCH New Philipp Rossak 4 participants 12 messages Aug 30, 2017 – Aug 31, 2017

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

cover Enable ethernet on nanopi m1 and nanopi m1 plus

From: Philipp Rossak <[email protected]>

This Patchseries enables the ethernet for the Friendlyarm Nanopi M1 and the Friendlyarm Nanopi M1 Plus.

Philipp Rossak (4):
sunxi: defconfig: enable sun8i emac on nanopi m1
sunxi: defconfig: enable sun8i emac on nanopi m1 plus
sunxi: dts: added emac node for nanopi m1
sunxi: dts: added emac node for nanopi m1 plus

 arch/arm/dts/sun8i-h3-nanopi-m1-plus.dts | 30 ++++++++++++++++++++++++++++++
 arch/arm/dts/sun8i-h3-nanopi-m1.dts      | 11 +++++++++++
 configs/nanopi_m1_defconfig              |  1 +
 configs/nanopi_m1_plus_defconfig         |  2 ++
 4 files changed, 44 insertions(+)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/4 sunxi: defconfig: enable sun8i emac on nanopi m1

From: Philipp Rossak <[email protected]>

The sun8i emac hardware is present on the Nanopi M1. It uses the internal PHY.

---
 configs/nanopi_m1_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/nanopi_m1_defconfig +1 -0
index 498496b..6ac8968 100644
@@ -14,3 +14,4 @@ CONFIG_SPL=y
 # CONFIG_SPL_ISO_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SUN8I_EMAC=y
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/4 sunxi: defconfig: enable sun8i emac on nanopi m1 plus

In reply to Philipp Rossak

From: Philipp Rossak <[email protected]>

The sun8i emac hardware is present on the Nanopi M1. It uses an external PHY. Pin PD6 is used to enable the external PHY.

---
 configs/nanopi_m1_plus_defconfig | 2 ++
 1 file changed, 2 insertions(+)
configs/nanopi_m1_plus_defconfig +2 -0
index d7a908d..e696ce3 100644
@@ -4,6 +4,7 @@ CONFIG_MACH_SUN8I_H3=y
 CONFIG_DRAM_CLK=408
 CONFIG_DRAM_ZQ=3881979
 CONFIG_DRAM_ODT_EN=y
+CONFIG_MACPWR="PD6"
 CONFIG_MMC0_CD_PIN="PH13"
 CONFIG_MMC_SUNXI_SLOT_EXTRA=2
 CONFIG_DEFAULT_DEVICE_TREE="sun8i-h3-nanopi-m1-plus"
@@ -16,3 +17,4 @@ CONFIG_SPL=y
 # CONFIG_SPL_ISO_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SUN8I_EMAC=y
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/4 sunxi: dts: added emac node for nanopi m1

In reply to Philipp Rossak

From: Philipp Rossak <[email protected]>

The sun8i emac hardware is present on the Nanopi M1. It uses the internal PHY.

---
 arch/arm/dts/sun8i-h3-nanopi-m1.dts | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/dts/sun8i-h3-nanopi-m1.dts +11 -0
index ec63d10..9c1c380 100644
@@ -55,6 +55,17 @@
 	status = "okay";
 };
 
+&emac {
+	phy = <&phy1>;
+	phy-mode = "mii";
+	allwinner,use-internal-phy;
+	allwinner,leds-active-low;
+	status = "okay";
+	phy1: ethernet-phy at 1 {
+		reg = <1>;
+	};
+};
+
 &ohci1 {
 	status = "okay";
 };
Signature · 1 line
2.7.4
#4 lore raw

PATCH 3/4 sunxi: dts: added emac node for nanopi m1

Quoted 18 lines · Philipp Rossak

From: Philipp Rossak <[email protected]>

The sun8i emac hardware is present on the Nanopi M1. It uses the internal PHY.

---
 arch/arm/dts/sun8i-h3-nanopi-m1.dts | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/dts/sun8i-h3-nanopi-m1.dts +0 -0
index ec63d10..9c1c380 100644
@@ -55,6 +55,17 @@
        status = "okay";
 };
 

arch/arm/dts/sun8i-h3-nanopi-m1.dts line 67

Quoted 10 lines
arch/arm/dts/sun8i-h3-nanopi-m1.dts +10 -0
+&emac {
+       phy = <&phy1>;
+       phy-mode = "mii";
+       allwinner,use-internal-phy;
+       allwinner,leds-active-low;
+       status = "okay";
+       phy1: ethernet-phy at 1 {
+               reg = <1>;
+       };
+};

We usually sync Linux for dts changes and I've seen few patches on Linux, lets wait Linux to merge.

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
#5 lore raw

PATCH 3/4 sunxi: dts: added emac node for nanopi m1

Am 30.08.2017 um 08:47 schrieb Jagan Teki:

Quoted 33 lines · Philipp Rossak
Quoted 18 lines

From: Philipp Rossak <[email protected]>

The sun8i emac hardware is present on the Nanopi M1. It uses the internal PHY.

---
  arch/arm/dts/sun8i-h3-nanopi-m1.dts | 11 +++++++++++
  1 file changed, 11 insertions(+)
arch/arm/dts/sun8i-h3-nanopi-m1.dts +0 -0
index ec63d10..9c1c380 100644
@@ -55,6 +55,17 @@
         status = "okay";
  };
 

arch/arm/dts/sun8i-h3-nanopi-m1.dts line 67

Quoted 10 lines
arch/arm/dts/sun8i-h3-nanopi-m1.dts +10 -0
+&emac {
+       phy = <&phy1>;
+       phy-mode = "mii";
+       allwinner,use-internal-phy;
+       allwinner,leds-active-low;
+       status = "okay";
+       phy1: ethernet-phy at 1 {
+               reg = <1>;
+       };
+};

We usually sync Linux for dts changes and I've seen few patches on Linux, lets wait Linux to merge.

Quoted 2 lines

thanks!

Ok thanks, I didn't know this.

Are there also some plans to snyc the sun8i-dwmac driver? The dt-binings related to the emac are right now different compared to linux mainline.

#6 lore raw

PATCH 3/4 sunxi: dts: added emac node for nanopi m1

Quoted 40 lines · Philipp Rossak

Am 30.08.2017 um 08:47 schrieb Jagan Teki:

Quoted 37 lines · Philipp Rossak
Quoted 20 lines

From: Philipp Rossak <[email protected]>

The sun8i emac hardware is present on the Nanopi M1. It uses the internal PHY.

---
  arch/arm/dts/sun8i-h3-nanopi-m1.dts | 11 +++++++++++
  1 file changed, 11 insertions(+)
arch/arm/dts/sun8i-h3-nanopi-m1.dts +0 -0
index ec63d10..9c1c380 100644
@@ -55,6 +55,17 @@
         status = "okay";
  };
 

arch/arm/dts/sun8i-h3-nanopi-m1.dts line 67

Quoted 10 lines
arch/arm/dts/sun8i-h3-nanopi-m1.dts +10 -0
+&emac {
+       phy = <&phy1>;
+       phy-mode = "mii";
+       allwinner,use-internal-phy;
+       allwinner,leds-active-low;
+       status = "okay";
+       phy1: ethernet-phy at 1 {
+               reg = <1>;
+       };
+};

We usually sync Linux for dts changes and I've seen few patches on Linux, lets wait Linux to merge.

Quoted 5 lines
Quoted 2 lines

thanks!

Ok thanks, I didn't know this.

Are there also some plans to snyc the sun8i-dwmac driver?

No such plan as of now.

Quoted 2 lines

The dt-binings related to the emac are right now different compared to linux mainline.

Yes, I saw others boards also not using Linux binding. May be we can proceed, let me review the patches.

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
#7 lore raw

[U-Boot] [linux-sunxi] Re: [PATCH 3/4] sunxi: dts: added emac node for nanopi m1

Hi,

Jagan Teki píše v St 30. 08. 2017 v 19:48 +0530:

Quoted 41 lines · Philipp Rossak
Quoted 40 lines

Am 30.08.2017 um 08:47 schrieb Jagan Teki:

Quoted 37 lines · Philipp Rossak
Quoted 20 lines

From: Philipp Rossak <[email protected]>

The sun8i emac hardware is present on the Nanopi M1. It uses the internal PHY.

---
  arch/arm/dts/sun8i-h3-nanopi-m1.dts | 11 +++++++++++
  1 file changed, 11 insertions(+)
arch/arm/dts/sun8i-h3-nanopi-m1.dts +0 -0
index ec63d10..9c1c380 100644
@@ -55,6 +55,17 @@
         status = "okay";
  };
 

arch/arm/dts/sun8i-h3-nanopi-m1.dts line 67

Quoted 10 lines
arch/arm/dts/sun8i-h3-nanopi-m1.dts +10 -0
+&emac {
+       phy = <&phy1>;
+       phy-mode = "mii";
+       allwinner,use-internal-phy;
+       allwinner,leds-active-low;
+       status = "okay";
+       phy1: ethernet-phy at 1 {
+               reg = <1>;
+       };
+};

We usually sync Linux for dts changes and I've seen few patches on Linux, lets wait Linux to merge.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

thanks!

Ok thanks, I didn't know this.

Are there also some plans to snyc the sun8i-dwmac driver?

No such plan as of now.

There's apritzel's work on this in this branch:

https://github.com/apritzel/u-boot/commits/a64-pending

Quoted 13 lines
Quoted 2 lines

The dt-binings related to the emac are right now different compared to linux mainline.

Yes, I saw others boards also not using Linux binding. May be we can proceed, let me review the patches.

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 850 bytes
Desc: This is a digitally signed message part
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170830/cec0fe73/attachment.sig>

#8 lore raw

[U-Boot] [linux-sunxi] Re: [PATCH 3/4] sunxi: dts: added emac node for nanopi m1

Quoted 49 lines · Ondřej Jirman

Hi,

Jagan Teki píše v St 30. 08. 2017 v 19:48 +0530:

Quoted 46 lines · Philipp Rossak
Quoted 45 lines

Am 30.08.2017 um 08:47 schrieb Jagan Teki:

Quoted 37 lines · Philipp Rossak
Quoted 20 lines

From: Philipp Rossak <[email protected]>

The sun8i emac hardware is present on the Nanopi M1. It uses the internal PHY.

---
  arch/arm/dts/sun8i-h3-nanopi-m1.dts | 11 +++++++++++
  1 file changed, 11 insertions(+)
arch/arm/dts/sun8i-h3-nanopi-m1.dts +0 -0
index ec63d10..9c1c380 100644
@@ -55,6 +55,17 @@
         status = "okay";
  };
 

arch/arm/dts/sun8i-h3-nanopi-m1.dts line 67

Quoted 10 lines
arch/arm/dts/sun8i-h3-nanopi-m1.dts +10 -0
+&emac {
+       phy = <&phy1>;
+       phy-mode = "mii";
+       allwinner,use-internal-phy;
+       allwinner,leds-active-low;
+       status = "okay";
+       phy1: ethernet-phy at 1 {
+               reg = <1>;
+       };
+};

We usually sync Linux for dts changes and I've seen few patches on Linux, lets wait Linux to merge.

Quoted 2 lines

thanks!

Ok thanks, I didn't know this.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Are there also some plans to snyc the sun8i-dwmac driver?

No such plan as of now.

There's apritzel's work on this in this branch:

https://github.com/apritzel/u-boot/commits/a64-pending

OK, thanks for the info

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
#9 lore raw

[U-Boot] [linux-sunxi] Re: [PATCH 3/4] sunxi: dts: added emac node for nanopi m1

Quoted 45 lines · Jagan Teki
Quoted 44 lines · Ondřej Jirman

Hi,

Jagan Teki píše v St 30. 08. 2017 v 19:48 +0530:

Quoted 41 lines · Philipp Rossak
Quoted 40 lines

Am 30.08.2017 um 08:47 schrieb Jagan Teki:

Quoted 34 lines · Philipp Rossak
Quoted 19 lines

From: Philipp Rossak <[email protected]>

The sun8i emac hardware is present on the Nanopi M1. It uses the internal PHY.

---
   arch/arm/dts/sun8i-h3-nanopi-m1.dts | 11 +++++++++++
   1 file changed, 11 insertions(+)
arch/arm/dts/sun8i-h3-nanopi-m1.dts +0 -0
index ec63d10..9c1c380 100644
@@ -55,6 +55,17 @@
          status = "okay";
   };
 

arch/arm/dts/sun8i-h3-nanopi-m1.dts line 67

Quoted 10 lines
arch/arm/dts/sun8i-h3-nanopi-m1.dts +10 -0
+&emac {
+       phy = <&phy1>;
+       phy-mode = "mii";
+       allwinner,use-internal-phy;
+       allwinner,leds-active-low;
+       status = "okay";
+       phy1: ethernet-phy at 1 {
+               reg = <1>;
+       };
+};

We usually sync Linux for dts changes and I've seen few patches on Linux, lets wait Linux to merge.

Quoted 2 lines

thanks!

Ok thanks, I didn't know this.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line

Are there also some plans to snyc the sun8i-dwmac driver?

No such plan as of now.

There's apritzel's work on this in this branch:

https://github.com/apritzel/u-boot/commits/a64-pending

OK, thanks for the info

thanks!

How shoud we proceed with this patch series?

My linux mainline patches were rejected since the dwmac-sun8i bindings have not stabilized yet:
http://www.spinics.net/lists/kernel/msg2592861.html

#10 lore raw

[U-Boot] [linux-sunxi] Re: [PATCH 3/4] sunxi: dts: added emac node for nanopi m1

Quoted 67 lines · Philipp Rossak
Quoted 64 lines · Jagan Teki
Quoted 52 lines · Ondřej Jirman

Hi,

Jagan Teki píše v St 30. 08. 2017 v 19:48 +0530:

Quoted 48 lines
Quoted 45 lines · Philipp Rossak

Am 30.08.2017 um 08:47 schrieb Jagan Teki:

Quoted 38 lines
Quoted 20 lines · Philipp Rossak

From: Philipp Rossak <[email protected]>

The sun8i emac hardware is present on the Nanopi M1. It uses the internal PHY.

---
   arch/arm/dts/sun8i-h3-nanopi-m1.dts | 11 +++++++++++
   1 file changed, 11 insertions(+)
arch/arm/dts/sun8i-h3-nanopi-m1.dts +0 -0
index ec63d10..9c1c380 100644
@@ -55,6 +55,17 @@
          status = "okay";
   };
 

arch/arm/dts/sun8i-h3-nanopi-m1.dts line 67

Quoted 10 lines
arch/arm/dts/sun8i-h3-nanopi-m1.dts +10 -0
+&emac {
+       phy = <&phy1>;
+       phy-mode = "mii";
+       allwinner,use-internal-phy;
+       allwinner,leds-active-low;
+       status = "okay";
+       phy1: ethernet-phy at 1 {
+               reg = <1>;
+       };
+};

We usually sync Linux for dts changes and I've seen few patches on Linux, lets wait Linux to merge.

Quoted 2 lines

thanks!

Ok thanks, I didn't know this.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Are there also some plans to snyc the sun8i-dwmac driver?

No such plan as of now.

There's apritzel's work on this in this branch:

https://github.com/apritzel/u-boot/commits/a64-pending

OK, thanks for the info

Quoted 7 lines
Quoted 1 line

thanks!

How shoud we proceed with this patch series?

My linux mainline patches were rejected since the dwmac-sun8i bindings have not stabilized yet:
http://www.spinics.net/lists/kernel/msg2592861.html

You should wait until the bindings have stabilized, then resync the dts files from Linux to U-boot, and fix up the driver to support the new bindings.

ChenYu

#11 lore raw

PATCH 4/4 sunxi: dts: added emac node for nanopi m1 plus

In reply to Philipp Rossak

From: Philipp Rossak <[email protected]>

The sun8i emac hardware is present on the Nanopi M1. It uses an external PHY.

---
 arch/arm/dts/sun8i-h3-nanopi-m1-plus.dts | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
arch/arm/dts/sun8i-h3-nanopi-m1-plus.dts +30 -0
index 8ddd1b2..1cc9185 100644
@@ -45,6 +45,18 @@
 / {
 	model = "FriendlyArm NanoPi M1 Plus";
 	compatible = "friendlyarm,nanopi-m1-plus", "allwinner,sun8i-h3";
+
+	reg_gmac_3v3: gmac-3v3 {
+		compatible = "regulator-fixed";
+		pinctrl-names = "default";
+		pinctrl-0 = <&gmac_power_pin_nanopi_m1_plus>;
+		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>;
+	};
 };
 
 &ehci1 {
@@ -55,6 +67,15 @@
 	status = "okay";
 };
 
+&emac {
+	/* The Nanopi M1 Plus uses an external phy */
+	pinctrl-names = "default";
+	pinctrl-0 = <&emac_rgmii_pins>;
+	phy-supply = <&reg_gmac_3v3>;
+	phy-mode = "rgmii";
+	/delete-property/allwinner,use-internal-phy;
+};
+
 &ohci1 {
 	status = "okay";
 };
@@ -62,3 +83,12 @@
 &ohci2 {
 	status = "okay";
 };
+
+&pio {
+	gmac_power_pin_nanopi_m1_plus: gmac_power_pin at 0 {
+		allwinner,pins = "PD6";
+		allwinner,function = "gpio_out";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+	};
+};
Signature · 1 line
2.7.4