Skip to contentSkip to conversation

sunxi: Fix A20-OLinuXino-MICRO LAN8710 support

PATCH New Stefan Mavrodiev 4 participants 4 messages Nov 3, 2017 – Dec 7, 2017 3 messages not in the archive

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

PATCH v2 1/1 sunxi: Fix A20-OLinuXino-MICRO LAN8710 support

From revision J the board uses new phy chip LAN8710. Compared with RTL8201, RA17 pin is TXERR. It has pullup which causes phy not to work. To fix this PA17 is muxed with GMAC function. This makes the pin output-low.

---
Changes for v2:
- The pin mux is done with Kconfig option
- Same option is enable by default for
A20-OLinuXino-MICRO boards

 board/sunxi/gmac.c                         | 4 ++++
 configs/A20-OLinuXino_MICRO-eMMC_defconfig | 1 +
 configs/A20-OLinuXino_MICRO_defconfig      | 1 +
 drivers/net/Kconfig                        | 8 ++++++++
 4 files changed, 14 insertions(+)
board/sunxi/gmac.c +4 -0
index 69eb8ff..826650c 100644
@@ -33,7 +33,11 @@ void eth_init_board(void)
 
 #ifndef CONFIG_MACH_SUN6I
 	/* Configure pin mux settings for GMAC */
+#ifdef CONFIG_SUN7I_GMAC_FORCE_TXERR
+	for (pin = SUNXI_GPA(0); pin <= SUNXI_GPA(17); pin++) {
+#else
 	for (pin = SUNXI_GPA(0); pin <= SUNXI_GPA(16); pin++) {
+#endif
 #ifdef CONFIG_RGMII
 		/* skip unused pins in RGMII mode */
 		if (pin == SUNXI_GPA(9) || pin == SUNXI_GPA(14))
configs/A20-OLinuXino_MICRO-eMMC_defconfig +1 -0
index 2ff2723..43bcea9 100644
@@ -19,6 +19,7 @@ CONFIG_SPL_I2C_SUPPORT=y
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_SUN7I_GMAC=y
+CONFIG_SUN7I_GMAC_FORCE_TXERR=y
 CONFIG_AXP_ALDO3_VOLT=2800
 CONFIG_AXP_ALDO4_VOLT=2800
 CONFIG_SCSI=y
configs/A20-OLinuXino_MICRO_defconfig +1 -0
index 1a0ad5a..22eacb3 100644
@@ -20,6 +20,7 @@ CONFIG_SPL_I2C_SUPPORT=y
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_SUN7I_GMAC=y
+CONFIG_SUN7I_GMAC_FORCE_TXERR=y
 CONFIG_AXP_ALDO3_VOLT=2800
 CONFIG_AXP_ALDO4_VOLT=2800
 CONFIG_SCSI=y
drivers/net/Kconfig +8 -0
index c1ce54e..f9f04e4 100644
@@ -244,6 +244,14 @@ config SUN7I_GMAC
 	help
 	  Enable the support for Sun7i GMAC Ethernet controller
 
+config SUN7I_GMAC_FORCE_TXERR
+	bool "Force PA17 as gmac function"
+	depends on SUN7I_GMAC
+	help
+	  Some ethernet phys needs TXERR control. Since the GMAC
+	  doesn't have such signal, setting PA17 as GMAC function
+	  makes the pin output low, which enables data transmission.
+
 config SUN4I_EMAC
 	bool "Allwinner Sun4i Ethernet MAC support"
 	depends on DM_ETH
Signature · 1 line
2.7.4

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

PATCH v2 1/1 sunxi: Fix A20-OLinuXino-MICRO LAN8710 support

Quoted 61 lines · Karsten Merker
Quoted 50 lines · Stefan Mavrodiev

From revision J the board uses new phy chip LAN8710. Compared
with RTL8201, RA17 pin is TXERR. It has pullup which causes phy not to work. To fix this PA17 is muxed with GMAC function. This makes the pin output-low.

---
Changes for v2:
- The pin mux is done with Kconfig option
- Same option is enable by default for
A20-OLinuXino-MICRO boards

  board/sunxi/gmac.c                         | 4 ++++
  configs/A20-OLinuXino_MICRO-eMMC_defconfig | 1 +
  configs/A20-OLinuXino_MICRO_defconfig      | 1 +
  drivers/net/Kconfig                        | 8 ++++++++
  4 files changed, 14 insertions(+)
board/sunxi/gmac.c +4 -0
index 69eb8ff..826650c 100644
@@ -33,7 +33,11 @@ void eth_init_board(void)
 
  #ifndef CONFIG_MACH_SUN6I
  	/* Configure pin mux settings for GMAC */
+#ifdef CONFIG_SUN7I_GMAC_FORCE_TXERR
+	for (pin = SUNXI_GPA(0); pin <= SUNXI_GPA(17); pin++) {
+#else
  	for (pin = SUNXI_GPA(0); pin <= SUNXI_GPA(16); pin++) {
+#endif
  #ifdef CONFIG_RGMII
  		/* skip unused pins in RGMII mode */
  		if (pin == SUNXI_GPA(9) || pin == SUNXI_GPA(14))
configs/A20-OLinuXino_MICRO-eMMC_defconfig +1 -0
index 2ff2723..43bcea9 100644
@@ -19,6 +19,7 @@ CONFIG_SPL_I2C_SUPPORT=y
  # CONFIG_SPL_EFI_PARTITION is not set
  CONFIG_ETH_DESIGNWARE=y
  CONFIG_SUN7I_GMAC=y
+CONFIG_SUN7I_GMAC_FORCE_TXERR=y
  CONFIG_AXP_ALDO3_VOLT=2800
  CONFIG_AXP_ALDO4_VOLT=2800
  CONFIG_SCSI=y
configs/A20-OLinuXino_MICRO_defconfig +0 -0
index 1a0ad5a..22eacb3 100644

configs/A20-OLinuXino_MICRO_defconfig CONFIG_SPL_I2C_SUPPORT=y · line 26

Quoted 7 lines
configs/A20-OLinuXino_MICRO_defconfig +1 -0
@@ -20,6 +20,7 @@ CONFIG_SPL_I2C_SUPPORT=y
  # CONFIG_SPL_EFI_PARTITION is not set
  CONFIG_ETH_DESIGNWARE=y
  CONFIG_SUN7I_GMAC=y
+CONFIG_SUN7I_GMAC_FORCE_TXERR=y
  CONFIG_AXP_ALDO3_VOLT=2800
  CONFIG_AXP_ALDO4_VOLT=2800
  CONFIG_SCSI=y

Hello,

Quoted 9 lines

wouldn't this break networking on pre-revision-J A20-OLinuXino_MICRO boards? AIUI, the A20-OLinuXino_MICRO before Revision J uses PA17 to control the (low-active) RESETB# line of the RTL8201CP used on the older board revisions, so with this change the PHY on pre-revision-J boards would be held in permanent reset state. AIUI, it would be necessary to have two different defconfigs - the existing defconfig for pre-revision-J boards (without CONFIG_SUN7I_GMAC_FORCE_TXERR) and an additional new one for revision-J-and-newer boards which sets CONFIG_SUN7I_GMAC_FORCE_TXERR=y.

Yes, the boards before rev.J uses this signal as EPHY-RST#, but only as an option. It's disconnected by N/A resistor. So setting this as output-low will not have any unwanted effect. You can see this in this schematic:
https://github.com/OLIMEX/OLINUXINO/blob/master/HARDWARE/A10-OLinuXino-MICRO/A20-OLINUXINO-MICRO_4GB_Rev_G1.pdf

Quoted 19 lines
drivers/net/Kconfig +8 -0
index c1ce54e..f9f04e4 100644
@@ -244,6 +244,14 @@ config SUN7I_GMAC
  	help
  	  Enable the support for Sun7i GMAC Ethernet controller
 
+config SUN7I_GMAC_FORCE_TXERR
+	bool "Force PA17 as gmac function"
+	depends on SUN7I_GMAC
+	help
+	  Some ethernet phys needs TXERR control. Since the GMAC
+	  doesn't have such signal, setting PA17 as GMAC function
+	  makes the pin output low, which enables data transmission.
+
  config SUN4I_EMAC
  	bool "Allwinner Sun4i Ethernet MAC support"
  	depends on DM_ETH
Quoted 2 lines

Regards,
Karsten

Regards,
Stefan Mavrodiev

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

PATCH v2 1/1 sunxi: Fix A20-OLinuXino-MICRO LAN8710 support

Quoted 10 lines · Karsten Merker
Quoted 4 lines · Stefan Mavrodiev

From revision J the board uses new phy chip LAN8710. Compared with RTL8201, RA17 pin is TXERR. It has pullup which causes phy not to work. To fix this PA17 is muxed with GMAC function. This makes the pin output-low.

Hello Jagan, hello Maxime,

I wanted to kindly ask about the status of this patch. Can it be merged or are there any open issues with it?

I guess we just forgot it because of the discussion that followed.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171120/ea43bfba/attachment.sig>

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

PATCH v2 1/1 sunxi: Fix A20-OLinuXino-MICRO LAN8710 support

Quoted 8 lines · Karsten Merker
Quoted 7 lines · Maxime Ripard
Quoted 6 lines · Karsten Merker
Quoted 4 lines · Stefan Mavrodiev

From revision J the board uses new phy chip LAN8710. Compared with RTL8201, RA17 pin is TXERR. It has pullup which causes phy not to work. To fix this PA17 is muxed with GMAC function. This makes the pin output-low.

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

Hello Jagan, hello Maxime,

I wanted to kindly ask about the status of this patch. Can it be merged or are there any open issues with it?

I guess we just forgot it because of the discussion that followed.

Applied to u-boot-sunxi/master