Skip to contentSkip to conversation

sunxi: Enable EMAC on A83T boards using Realtek RTL8211E PHY

PATCH Superseded Chen-Yu Tsai 2 participants 8 messages May 3, 2019

lore
Share & tools
lore
#0 lore raw

v3 cover sunxi: Enable EMAC on A83T boards using Realtek RTL8211E PHY

From: Chen-Yu Tsai <[email protected]>

Hi everyone,

This series enables EMAC (Ethernet controller) on two A83T boards, the Cubietruck Plus and Bananapi M3.

This series is now based on sunxi/next, which has patches that convert sun8i-emac to use the common CLK and DM_RESET framework.

The two patches enable the sun8i-emac and Realtek PHY driver in their respective defconfigs. The device trees already have the EMAC enabled. For the Bananapi M3, the regulator providing the I/O voltages is raised to 3.3V.

This was tested with the "dhcp" command followed by using the "ping" command to ping an external IP, in this case 8.8.8.8.

Regards
ChenYu

Changes in v3:
- Rebased on sunxi/master

Changes in v2:
- Dropped clk/reset related changes in favor of DM CLK / RESET support
- Raised DLDO3 for RGMII I/O on Bananapi M3 to 3.3V per design

Chen-Yu Tsai (2):
sunxi: Enable EMAC on the Cubietruck Plus
sunxi: Enable EMAC on the Bananapi M3

 configs/Cubietruck_plus_defconfig | 2 ++
 configs/Sinovoip_BPI_M3_defconfig | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH v3 1/2 sunxi: Enable EMAC on the Cubietruck Plus

From: Chen-Yu Tsai <[email protected]>

The Cubietruck Plus has an RTL8211E PHY connected to the EMAC using RGMII. The PHY is powered by DLDO4 @ 3.3V, while the I/O pins are powered by DLDO3 @ 2.5V.

This patch enables the EMAC and Realtek PHY drivers in the defconfig. The device tree file already has the EMAC enabled.

---

Changes in v3: None
Changes in v2: None

 configs/Cubietruck_plus_defconfig | 2 ++
 1 file changed, 2 insertions(+)
configs/Cubietruck_plus_defconfig +2 -0
index 869bffcfca0c..044af12779c6 100644
@@ -20,6 +20,8 @@ CONFIG_CONSOLE_MUX=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_DEFAULT_DEVICE_TREE="sun8i-a83t-cubietruck-plus"
+CONFIG_PHY_REALTEK=y
+CONFIG_SUN8I_EMAC=y
 CONFIG_AXP_DLDO3_VOLT=2500
 CONFIG_AXP_DLDO4_VOLT=3300
 CONFIG_AXP_FLDO1_VOLT=1200
Signature · 1 line
2.20.1
#2 lore raw

PATCH v3 2/2 sunxi: Enable EMAC on the Bananapi M3

In reply to Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

The Bananapi M3 has an RTL8211E PHY connected to the EMAC using RGMII. The PHY is powered by DCDC1 through SW @ 3.3V.

The board is designed to use 3.3V with RGMII, instead of the standard reduced voltage of 2.5V we see everywhere. DLDO3, which provides the I/O voltages, is raised to match.

This patch enables the EMAC and Realtek PHY drivers in the defconfig. The device tree file already has the EMAC enabled.

---

Changes in v3:
- Rebased on sunxi/master

Changes in v2:
- Dropped clk/reset related changes in favor of DM CLK / RESET support
- Raised DLDO3 for RGMII I/O on Bananapi M3 to 3.3V per design

 configs/Sinovoip_BPI_M3_defconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
configs/Sinovoip_BPI_M3_defconfig +3 -1
index 79743a9c9a51..b9ab00cb8a29 100644
@@ -21,8 +21,10 @@ CONFIG_CONSOLE_MUX=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_DEFAULT_DEVICE_TREE="sun8i-a83t-bananapi-m3"
+CONFIG_PHY_REALTEK=y
+CONFIG_SUN8I_EMAC=y
 CONFIG_AXP_DCDC5_VOLT=1200
-CONFIG_AXP_DLDO3_VOLT=2500
+CONFIG_AXP_DLDO3_VOLT=3300
 CONFIG_AXP_SW_ON=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_OHCI_HCD=y
Signature · 1 line
2.20.1
#3 lore raw

v3 cover sunxi: Enable EMAC on A83T boards using Realtek RTL8211E PHY

In reply to Chen-Yu Tsai
Quoted 5 lines · Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

Hi everyone,

Quoted 7 lines

This series enables EMAC (Ethernet controller) on two A83T boards, the Cubietruck Plus and Bananapi M3.

This series is now based on sunxi/next, which has patches that convert sun8i-emac to use the common CLK and DM_RESET framework.

The two patches enable the sun8i-emac and Realtek PHY driver in their

So, the U-Boot operates realtek than what Linux does via ethernet-phy-ieee802.3-c22 right? if someone add it in future it will override realtek since we have a dts compatible enabled it dts files already isn't it?

Jagan.

#4 lore raw

v3 cover sunxi: Enable EMAC on A83T boards using Realtek RTL8211E PHY

Quoted 13 lines · Jagan Teki
Quoted 11 lines · Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

Hi everyone,

This series enables EMAC (Ethernet controller) on two A83T boards, the Cubietruck Plus and Bananapi M3.

This series is now based on sunxi/next, which has patches that convert sun8i-emac to use the common CLK and DM_RESET framework.

Quoted 6 lines
Quoted 1 line

The two patches enable the sun8i-emac and Realtek PHY driver in their

So, the U-Boot operates realtek than what Linux does via ethernet-phy-ieee802.3-c22 right? if someone add it in future it will override realtek since we have a dts compatible enabled it dts files already isn't it?

What? No. The PHY vendor and model are automatically detected by reading the standard registers in the PHY. The compatible string is only used to determine how to access the registers. c22 vs c45 define different ways of accessing registers, as well as a larger address space for c45.

See https://www.totalphase.com/support/articles/200349206-MDIO-Background

By reading the vendor and model IDs, the system, be it Linux or U-boot, can then go through the list of registered PHY drivers to find a match, or fall back to some generic implementation.

It used to be you needed to enable the Realtek driver for gigabit links to work properly, but that seems to have been fixed. Nevertheless, having the specific driver enabled is better.

ChenYu

#5 lore raw

v3 cover sunxi: Enable EMAC on A83T boards using Realtek RTL8211E PHY

Quoted 27 lines · Chen-Yu Tsai
Quoted 13 lines · Jagan Teki
Quoted 11 lines · Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

Hi everyone,

This series enables EMAC (Ethernet controller) on two A83T boards, the Cubietruck Plus and Bananapi M3.

This series is now based on sunxi/next, which has patches that convert sun8i-emac to use the common CLK and DM_RESET framework.

Quoted 6 lines
Quoted 1 line

The two patches enable the sun8i-emac and Realtek PHY driver in their

So, the U-Boot operates realtek than what Linux does via ethernet-phy-ieee802.3-c22 right? if someone add it in future it will override realtek since we have a dts compatible enabled it dts files already isn't it?

What? No. The PHY vendor and model are automatically detected by reading the standard registers in the PHY. The compatible string is only used to determine how to access the registers. c22 vs c45 define different ways of accessing registers, as well as a larger address space for c45.

Quoted 5 lines

See https://www.totalphase.com/support/articles/200349206-MDIO-Background

By reading the vendor and model IDs, the system, be it Linux or U-boot, can then go through the list of registered PHY drivers to find a match, or fall back to some generic implementation.

Yes, I understand thanks.

Quoted 4 lines

It used to be you needed to enable the Realtek driver for gigabit links to work properly, but that seems to have been fixed. Nevertheless, having the specific driver enabled is better.

Ah.. this is what exactly I tried before in Linux since it doesn't enable default in sunxi_defconfig. on the other-hand the existing generic compatible is also working for gigabit links as well.

#7 lore raw

v3 cover sunxi: Enable EMAC on A83T boards using Realtek RTL8211E PHY

In reply to Chen-Yu Tsai
Quoted 25 lines · Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

Hi everyone,

This series enables EMAC (Ethernet controller) on two A83T boards, the Cubietruck Plus and Bananapi M3.

This series is now based on sunxi/next, which has patches that convert sun8i-emac to use the common CLK and DM_RESET framework.

The two patches enable the sun8i-emac and Realtek PHY driver in their respective defconfigs. The device trees already have the EMAC enabled. For the Bananapi M3, the regulator providing the I/O voltages is raised to 3.3V.

This was tested with the "dhcp" command followed by using the "ping" command to ping an external IP, in this case 8.8.8.8.

Regards
ChenYu

Changes in v3:
- Rebased on sunxi/master

Quoted 7 lines

Changes in v2:
- Dropped clk/reset related changes in favor of DM CLK / RESET support
- Raised DLDO3 for RGMII I/O on Bananapi M3 to 3.3V per design

Chen-Yu Tsai (2):
sunxi: Enable EMAC on the Cubietruck Plus
sunxi: Enable EMAC on the Bananapi M3

Applied to u-boot-sunxi/master

#6 lore raw

v3 cover sunxi: Enable EMAC on A83T boards using Realtek RTL8211E PHY

In reply to Jagan Teki
Quoted 38 lines · Jagan Teki
Quoted 27 lines · Chen-Yu Tsai
Quoted 13 lines · Jagan Teki
Quoted 11 lines · Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

Hi everyone,

This series enables EMAC (Ethernet controller) on two A83T boards, the Cubietruck Plus and Bananapi M3.

This series is now based on sunxi/next, which has patches that convert sun8i-emac to use the common CLK and DM_RESET framework.

Quoted 6 lines
Quoted 1 line

The two patches enable the sun8i-emac and Realtek PHY driver in their

So, the U-Boot operates realtek than what Linux does via ethernet-phy-ieee802.3-c22 right? if someone add it in future it will override realtek since we have a dts compatible enabled it dts files already isn't it?

What? No. The PHY vendor and model are automatically detected by reading the standard registers in the PHY. The compatible string is only used to determine how to access the registers. c22 vs c45 define different ways of accessing registers, as well as a larger address space for c45.

Quoted 5 lines

See https://www.totalphase.com/support/articles/200349206-MDIO-Background

By reading the vendor and model IDs, the system, be it Linux or U-boot, can then go through the list of registered PHY drivers to find a match, or fall back to some generic implementation.

Yes, I understand thanks.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

It used to be you needed to enable the Realtek driver for gigabit links to work properly, but that seems to have been fixed. Nevertheless, having the specific driver enabled is better.

Ah.. this is what exactly I tried before in Linux since it doesn't enable default in sunxi_defconfig. on the other-hand the existing generic compatible is also working for gigabit links as well.

Yeah. My memories of it not working are from way back, before the whole DM conversion even started.

I think it's still better to have the specific driver enabled though, as the PHY has some vendor specific features or status flags.

ChenYu