Skip to contentSkip to conversation

net: phy: Add driver for Motorcomm yt8521 gigabit ethernet

PATCH In review Frank 2 participants 2 messages Aug 2, 2022

Subsystems (4)
lore
Share & tools
lore

Frank

author maintainer
#0 lore raw

PATCH 1/1 net: phy: Add driver for Motorcomm yt8521 gigabit ethernet

Add a driver for the motorcomm yt8521 gigabit ethernet phy. We have verified the driver on StarFive VisionFive development board, which is developed by Shanghai StarFive Technology Co., Ltd.. On the board, yt8521 gigabit ethernet phy works in utp mode, RGMII interface, supports 1000M/100M/10M speeds, and wol(magic package).

---

patch v4.2:
fix "=0D" and "=20" which in patch v4.1.

patch v4.1:
Hi Andrew
Thanks very much and based on your comments we modified the patch v4.1 as below.

Quoted 4 lines

You have interrupt bits defined, you enable the WoL interrupt, but you don't have an interrupt handler. PHY interrupts are generally level interrupts, so on WoL, don't you end up with an interrupt storm, because you don't have anything clearing the WoL interrupt?

in the driver, only the interrupt for WOL is used according to uplayer WOL configuration via .set_wol. If WOL is enalbed, then the WOL interrupt is enabled accordingly; you know, for a system support WOL, the WOL interrupt will be handled by user's WOL circuit, and it will not cause interrupt storm to CPU core system.

for WOL interrupt, by default, we configure to pulse trigger mode, that is a pulse from High to low change, and the low level will hold for 672ms. user's WOL circuit will detected such volt level change as a WOL event trigger.

patch v4:
Hi Andrew,Jakub
Thanks very much and based on your comments we modified the patch v4 as below.

We evaluated the Marvell 10G driver and at803x you suggested. The 2 drivers implement SFP module attach/detach functions and we think these functions do not help yt8521 to do UTP/Fiber register space arbitration which you may concern in previous patch.

Yt8521 can detect utp/fiber media link status automatically. For the case of both media are connected, driver arbitrates the priority of the media (by default, driver takes fiber as higher priority) and report the media status to up layer(MAC).

patch v3:
Hi Andrew
Thanks and based on your comments we modified the patch as below.

Quoted 5 lines

It is generally not that simple. Fibre, you probably want 1000BaseX, unless the fibre module is actually copper, and then you want SGMII. So you need something to talk to the fibre module and ask it what it is. That something is phylink. Phylink does not support both copper and fibre at the same time for one MAC.

yes, you said it and for MAC, it does not support copper and Fiber at same time. but from Physical Layer, you know, sometimes both Copper and Fiber cables are connected. in this case, Phy driver should do arbitration and report to MAC which media should be used and Link-up.
This is the reason that the driver has a "polling mode", and by default, also this driver takes fiber as first priority which matches phy chip default behavior.

patch v2:
Hi Andrew, Russell King, Peter,
Thanks and based on your comments we modified the patch as below.

Quoted 2 lines

So there's only two possible pages that can be used in the extended register space?

Yes,there is only two register space (utp and fiber).

Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+/* Extended Register's Data Register */
+#define YTPHY_PAGE_DATA                                0x1F

These are defined exactly the same way as below. Please reuse code where possible.

Yes, code will be reuse, but "YT8511_PAGE" need to be rename like "YTPHY_PAGE_DATA",as it is common register for yt phys.

patch v1:
Add a driver for the motorcomm yt8521 gigabit ethernet phy. We have verified the driver on StarFive VisionFive development board, which is developed by Shanghai StarFive Technology Co., Ltd.. On the board, yt8521 gigabit ethernet phy works in utp mode, RGMII interface, supports 1000M/100M/10M speeds, and wol(magic package).

 MAINTAINERS                 |    1 +
 drivers/net/phy/Kconfig     |    2 +-
 drivers/net/phy/motorcomm.c | 1162 ++++++++++++++++++++++++++++++++++-
 3 files changed, 1162 insertions(+), 3 deletions(-)
MAINTAINERS +1 -0
index a6d3bd9..59813c5 100644
@@ -13437,6 +13437,7 @@ F:	include/uapi/linux/meye.h
 
 MOTORCOMM PHY DRIVER
 M:	Peter Geis <[email protected]>
+M:	Frank <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	drivers/net/phy/motorcomm.c
drivers/net/phy/Kconfig +1 -1
index 9fee639..9061c76 100644
@@ -253,7 +253,7 @@ config MOTORCOMM_PHY
 	tristate "Motorcomm PHYs"
 	help
 	  Enables support for Motorcomm network PHYs.
-	  Currently supports the YT8511 gigabit PHY.
+	  Currently supports the YT8511, YT8521 Gigabit Ethernet PHYs.
 
 config NATIONAL_PHY
 	tristate "National Semiconductor PHYs"
drivers/net/phy/motorcomm.c +1160 -2

1,203 lines not on this page · raw message

Signature · 1 line
2.31.0.windows.1
maintainer
#1 lore raw
Quoted 7 lines · On Tue, 2 Aug 2022 18:45:31 +0800 Frank wrote:

Add a driver for the motorcomm yt8521 gigabit ethernet phy. We have verified the driver on StarFive VisionFive development board, which is developed by Shanghai StarFive Technology Co., Ltd.. On the board, yt8521 gigabit ethernet phy works in utp mode, RGMII interface, supports 1000M/100M/10M speeds, and wol(magic package).

# Form letter - net-next is closed

The merge window for Linux 6.0 has started and therefore net-next is closed for new drivers, features, code refactoring and optimizations. We are currently accepting bug fixes only.

Please repost when net-next reopens after 6.0-rc1 is cut.

RFC patches sent for review only are obviously welcome at any time.