Skip to contentSkip to conversation

sunxi: Enable EMAC on A83T boards using Realtek RTL8211E PHY

PATCH RESEND New Chen-Yu Tsai 1 participant 5 messages Apr 12, 2019

Subsystems (3)
lore
Share & tools
lore

Chen-Yu Tsai

author maintainer
#0 lore raw

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

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

(Resending from correct email address and with proper cover letter subject.)

Hi everyone,

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

A couple of changes are required to the clock definitions to make the compiler happy, as it hasn't been coverted to use the common CLK and DM_RESET framework. These changes are not used in the A83T code path.

The other two patches enable the sun8i-emac and Realtek PHY driver in their respective defconfigs. The device trees already have the EMAC enabled.

Since these are compile time issues, all patches should go through the same tree.

Regards
ChenYu

Chen-Yu Tsai (4):
sunxi: Fix compilation of sun8i-emac for A83T
net: sun8i-emac: Fix compilation for A83T
sunxi: Enable EMAC on the Cubietruck Plus
sunxi: Enable EMAC on the Bananapi M3

 arch/arm/include/asm/arch-sunxi/clock_sun8i_a83t.h | 4 ++++
 configs/Cubietruck_plus_defconfig                  | 2 ++
 configs/Sinovoip_BPI_M3_defconfig                  | 2 ++
 drivers/net/sun8i_emac.c                           | 3 +++
 4 files changed, 11 insertions(+)
Signature · 1 line
2.20.1
author maintainer
#1 lore raw

PATCH RESEND 1/4 sunxi: Fix compilation of sun8i-emac for A83T

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

The A83T has its own clock header file and clock control module structure, unlike H3/A64/R40 which share a common one. As such some of the SoC specific fields or macros are undefined when building U-boot for A83T.

Add dummy entries to the clock control module structure to make the compiler happy. The code path using these fields is unused for A83T in the driver.

---

 arch/arm/include/asm/arch-sunxi/clock_sun8i_a83t.h | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/include/asm/arch-sunxi/clock_sun8i_a83t.h +4 -0
index 14df3cc8f46b..15c1d6fe820a 100644
@@ -124,6 +124,10 @@ struct sunxi_ccm_reg {
 	u32 ahb_reset3_cfg;	/* 0x2d0 AHB1 Reset 3 config */
 	u32 reserved32;		/* 0x2d4 */
 	u32 apb2_reset_cfg;	/* 0x2d8 BUS Reset 4 config */
+
+	/* the following exist only to make sun8i-emac happy */
+	u32 gmac_clk_cfg;
+	u32 bus_gate4;
 };
 
 /* apb2 bit field */
Signature · 1 line
2.20.1
author maintainer
#2 lore raw

PATCH RESEND 2/4 net: sun8i-emac: Fix compilation for A83T

In reply to Chen-Yu Tsai

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

The A83T has its own clock header file and clock control module structure, unlike H3/A64/R40 which share a common one. As such some of the SoC specific fields or macros are undefined when building U-boot for A83T.

Define the AHB_RESET_OFFSET_EPHY macro if it isn't already defined to make the compiler happy. The code path including this macro is unused in the driver for A83T.

---
This patch should go in with the others through the sunxi tree, not independently through the net tree.

 drivers/net/sun8i_emac.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/sun8i_emac.c +3 -0
index c9798445c7dd..b6b4b1030153 100644
@@ -68,6 +68,9 @@
 #define CONFIG_MDIO_TIMEOUT	(3 * CONFIG_SYS_HZ)
 
 #define AHB_GATE_OFFSET_EPHY	0
+#ifndef AHB_RESET_OFFSET_EPHY
+#define AHB_RESET_OFFSET_EPHY	2
+#endif
 
 /* IO mux settings */
 #define SUN8I_IOMUX_H3		2
Signature · 1 line
2.20.1
author maintainer
#3 lore raw

PATCH RESEND 3/4 sunxi: Enable EMAC on the Cubietruck Plus

In reply to Chen-Yu Tsai

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.

---

 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
author maintainer
#4 lore raw

PATCH RESEND 4/4 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.

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

---

 configs/Sinovoip_BPI_M3_defconfig | 2 ++
 1 file changed, 2 insertions(+)
configs/Sinovoip_BPI_M3_defconfig +2 -0
index 79743a9c9a51..bb2dbb5dd5c2 100644
@@ -21,6 +21,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-bananapi-m3"
+CONFIG_PHY_REALTEK=y
+CONFIG_SUN8I_EMAC=y
 CONFIG_AXP_DCDC5_VOLT=1200
 CONFIG_AXP_DLDO3_VOLT=2500
 CONFIG_AXP_SW_ON=y
Signature · 1 line
2.20.1