[U-Boot] [PATCH 0/4] Enable ethernet on nanopi m1 and nanopi m1 plus

From: Philipp Rossak embed3d@gmail.com
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(+)

From: Philipp Rossak embed3d@gmail.com
The sun8i emac hardware is present on the Nanopi M1. It uses the internal PHY.
Signed-off-by: Philipp Rossak embed3d@gmail.com --- configs/nanopi_m1_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/nanopi_m1_defconfig b/configs/nanopi_m1_defconfig index 498496b..6ac8968 100644 --- a/configs/nanopi_m1_defconfig +++ b/configs/nanopi_m1_defconfig @@ -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

From: Philipp Rossak embed3d@gmail.com
The sun8i emac hardware is present on the Nanopi M1. It uses an external PHY. Pin PD6 is used to enable the external PHY.
Signed-off-by: Philipp Rossak embed3d@gmail.com --- configs/nanopi_m1_plus_defconfig | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/configs/nanopi_m1_plus_defconfig b/configs/nanopi_m1_plus_defconfig index d7a908d..e696ce3 100644 --- a/configs/nanopi_m1_plus_defconfig +++ b/configs/nanopi_m1_plus_defconfig @@ -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

From: Philipp Rossak embed3d@gmail.com
The sun8i emac hardware is present on the Nanopi M1. It uses the internal PHY.
Signed-off-by: Philipp Rossak embed3d@gmail.com --- arch/arm/dts/sun8i-h3-nanopi-m1.dts | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/arch/arm/dts/sun8i-h3-nanopi-m1.dts b/arch/arm/dts/sun8i-h3-nanopi-m1.dts index ec63d10..9c1c380 100644 --- a/arch/arm/dts/sun8i-h3-nanopi-m1.dts +++ b/arch/arm/dts/sun8i-h3-nanopi-m1.dts @@ -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@1 { + reg = <1>; + }; +}; + &ohci1 { status = "okay"; };

On Wed, Aug 30, 2017 at 6:02 AM, Philipp Rossak embed3d@gmail.com wrote:
From: Philipp Rossak embed3d@gmail.com
The sun8i emac hardware is present on the Nanopi M1. It uses the internal PHY.
Signed-off-by: Philipp Rossak embed3d@gmail.com
arch/arm/dts/sun8i-h3-nanopi-m1.dts | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/arch/arm/dts/sun8i-h3-nanopi-m1.dts b/arch/arm/dts/sun8i-h3-nanopi-m1.dts index ec63d10..9c1c380 100644 --- a/arch/arm/dts/sun8i-h3-nanopi-m1.dts +++ b/arch/arm/dts/sun8i-h3-nanopi-m1.dts @@ -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@1 {
reg = <1>;
};
+};
We usually sync Linux for dts changes and I've seen few patches on Linux, lets wait Linux to merge.
thanks!

Am 30.08.2017 um 08:47 schrieb Jagan Teki:
On Wed, Aug 30, 2017 at 6:02 AM, Philipp Rossak embed3d@gmail.com wrote:
From: Philipp Rossak embed3d@gmail.com
The sun8i emac hardware is present on the Nanopi M1. It uses the internal PHY.
Signed-off-by: Philipp Rossak embed3d@gmail.com
arch/arm/dts/sun8i-h3-nanopi-m1.dts | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/arch/arm/dts/sun8i-h3-nanopi-m1.dts b/arch/arm/dts/sun8i-h3-nanopi-m1.dts index ec63d10..9c1c380 100644 --- a/arch/arm/dts/sun8i-h3-nanopi-m1.dts +++ b/arch/arm/dts/sun8i-h3-nanopi-m1.dts @@ -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@1 {
reg = <1>;
};
+};
We usually sync Linux for dts changes and I've seen few patches on Linux, lets wait Linux to merge.
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.

On Wed, Aug 30, 2017 at 2:40 PM, Philipp Rossak embed3d@gmail.com wrote:
Am 30.08.2017 um 08:47 schrieb Jagan Teki:
On Wed, Aug 30, 2017 at 6:02 AM, Philipp Rossak embed3d@gmail.com wrote:
From: Philipp Rossak embed3d@gmail.com
The sun8i emac hardware is present on the Nanopi M1. It uses the internal PHY.
Signed-off-by: Philipp Rossak embed3d@gmail.com
arch/arm/dts/sun8i-h3-nanopi-m1.dts | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/arch/arm/dts/sun8i-h3-nanopi-m1.dts b/arch/arm/dts/sun8i-h3-nanopi-m1.dts index ec63d10..9c1c380 100644 --- a/arch/arm/dts/sun8i-h3-nanopi-m1.dts +++ b/arch/arm/dts/sun8i-h3-nanopi-m1.dts @@ -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@1 {
reg = <1>;
};
+};
We usually sync Linux for dts changes and I've seen few patches on Linux, lets wait Linux to merge.
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.
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!

Hi,
Jagan Teki píše v St 30. 08. 2017 v 19:48 +0530:
On Wed, Aug 30, 2017 at 2:40 PM, Philipp Rossak embed3d@gmail.com wrote:
Am 30.08.2017 um 08:47 schrieb Jagan Teki:
On Wed, Aug 30, 2017 at 6:02 AM, Philipp Rossak embed3d@gmail.com wrote:
From: Philipp Rossak embed3d@gmail.com
The sun8i emac hardware is present on the Nanopi M1. It uses the internal PHY.
Signed-off-by: Philipp Rossak embed3d@gmail.com
arch/arm/dts/sun8i-h3-nanopi-m1.dts | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/arch/arm/dts/sun8i-h3-nanopi-m1.dts b/arch/arm/dts/sun8i-h3-nanopi-m1.dts index ec63d10..9c1c380 100644 --- a/arch/arm/dts/sun8i-h3-nanopi-m1.dts +++ b/arch/arm/dts/sun8i-h3-nanopi-m1.dts @@ -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@1 {
reg = <1>;
};
+};
We usually sync Linux for dts changes and I've seen few patches on Linux, lets wait Linux to merge.
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
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!
Jagan Teki Free Software Engineer | www.openedev.com U-Boot, Linux | Upstream Maintainer Hyderabad, India.

On Wed, Aug 30, 2017 at 8:06 PM, Ondřej Jirman megi@xff.cz wrote:
Hi,
Jagan Teki píše v St 30. 08. 2017 v 19:48 +0530:
On Wed, Aug 30, 2017 at 2:40 PM, Philipp Rossak embed3d@gmail.com wrote:
Am 30.08.2017 um 08:47 schrieb Jagan Teki:
On Wed, Aug 30, 2017 at 6:02 AM, Philipp Rossak embed3d@gmail.com wrote:
From: Philipp Rossak embed3d@gmail.com
The sun8i emac hardware is present on the Nanopi M1. It uses the internal PHY.
Signed-off-by: Philipp Rossak embed3d@gmail.com
arch/arm/dts/sun8i-h3-nanopi-m1.dts | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/arch/arm/dts/sun8i-h3-nanopi-m1.dts b/arch/arm/dts/sun8i-h3-nanopi-m1.dts index ec63d10..9c1c380 100644 --- a/arch/arm/dts/sun8i-h3-nanopi-m1.dts +++ b/arch/arm/dts/sun8i-h3-nanopi-m1.dts @@ -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@1 {
reg = <1>;
};
+};
We usually sync Linux for dts changes and I've seen few patches on Linux, lets wait Linux to merge.
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:
OK, thanks for the info
thanks!

On 30.08.2017 18:59, Jagan Teki wrote:
On Wed, Aug 30, 2017 at 8:06 PM, Ondřej Jirman megi@xff.cz wrote:
Hi,
Jagan Teki píše v St 30. 08. 2017 v 19:48 +0530:
On Wed, Aug 30, 2017 at 2:40 PM, Philipp Rossak embed3d@gmail.com wrote:
Am 30.08.2017 um 08:47 schrieb Jagan Teki:
On Wed, Aug 30, 2017 at 6:02 AM, Philipp Rossak embed3d@gmail.com wrote:
From: Philipp Rossak embed3d@gmail.com
The sun8i emac hardware is present on the Nanopi M1. It uses the internal PHY.
Signed-off-by: Philipp Rossak embed3d@gmail.com
arch/arm/dts/sun8i-h3-nanopi-m1.dts | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/arch/arm/dts/sun8i-h3-nanopi-m1.dts b/arch/arm/dts/sun8i-h3-nanopi-m1.dts index ec63d10..9c1c380 100644 --- a/arch/arm/dts/sun8i-h3-nanopi-m1.dts +++ b/arch/arm/dts/sun8i-h3-nanopi-m1.dts @@ -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@1 {
reg = <1>;
};
+};
We usually sync Linux for dts changes and I've seen few patches on Linux, lets wait Linux to merge.
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:
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

On Thu, Aug 31, 2017 at 7:10 AM, Philipp Rossak embed3d@gmail.com wrote:
On 30.08.2017 18:59, Jagan Teki wrote:
On Wed, Aug 30, 2017 at 8:06 PM, Ondřej Jirman megi@xff.cz wrote:
Hi,
Jagan Teki píše v St 30. 08. 2017 v 19:48 +0530:
On Wed, Aug 30, 2017 at 2:40 PM, Philipp Rossak embed3d@gmail.com wrote:
Am 30.08.2017 um 08:47 schrieb Jagan Teki:
On Wed, Aug 30, 2017 at 6:02 AM, Philipp Rossak embed3d@gmail.com wrote: > > From: Philipp Rossak embed3d@gmail.com > > The sun8i emac hardware is present on the Nanopi M1. > It uses the internal PHY. > > Signed-off-by: Philipp Rossak embed3d@gmail.com > --- > arch/arm/dts/sun8i-h3-nanopi-m1.dts | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/arch/arm/dts/sun8i-h3-nanopi-m1.dts > b/arch/arm/dts/sun8i-h3-nanopi-m1.dts > index ec63d10..9c1c380 100644 > --- a/arch/arm/dts/sun8i-h3-nanopi-m1.dts > +++ b/arch/arm/dts/sun8i-h3-nanopi-m1.dts > @@ -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@1 { > + reg = <1>; > + }; > +};
We usually sync Linux for dts changes and I've seen few patches on Linux, lets wait Linux to merge.
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:
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
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

From: Philipp Rossak embed3d@gmail.com
The sun8i emac hardware is present on the Nanopi M1. It uses an external PHY.
Signed-off-by: Philipp Rossak embed3d@gmail.com --- arch/arm/dts/sun8i-h3-nanopi-m1-plus.dts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
diff --git a/arch/arm/dts/sun8i-h3-nanopi-m1-plus.dts b/arch/arm/dts/sun8i-h3-nanopi-m1-plus.dts index 8ddd1b2..1cc9185 100644 --- a/arch/arm/dts/sun8i-h3-nanopi-m1-plus.dts +++ b/arch/arm/dts/sun8i-h3-nanopi-m1-plus.dts @@ -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 = <®_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@0 { + allwinner,pins = "PD6"; + allwinner,function = "gpio_out"; + allwinner,drive = <SUN4I_PINCTRL_10_MA>; + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>; + }; +};
participants (4)
-
Chen-Yu Tsai
-
Jagan Teki
-
Ondřej Jirman
-
Philipp Rossak