Skip to contentSkip to conversation

net: phy: add driver for Motorcomm yt8511 phy

PATCH Superseded Peter Geis 2 participants 4 messages May 11, 2021 – May 12, 2021

Subsystems (5)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Peter Geis

author
#0 lore raw

PATCH v2 1/1 net: phy: add driver for Motorcomm yt8511 phy

Add a driver for the Motorcomm yt8511 phy that will be used in the production Pine64 rk3566-quartz64 development board.
It supports gigabit transfer speeds, rgmii, and 125mhz clk output.

---
Changes v2:
- Change to __phy_modify
- Handle return errors
- Remove unnecessary &

 MAINTAINERS                 |  6 +++
 drivers/net/phy/Kconfig     |  6 +++
 drivers/net/phy/Makefile    |  1 +
 drivers/net/phy/motorcomm.c | 87 +++++++++++++++++++++++++++++++++++++
 4 files changed, 100 insertions(+)
 create mode 100644 drivers/net/phy/motorcomm.c
MAINTAINERS +6 -0
index 601b5ae0368a..2a2e406238fc 100644
@@ -12388,6 +12388,12 @@ F:	Documentation/userspace-api/media/drivers/meye*
 F:	drivers/media/pci/meye/
 F:	include/uapi/linux/meye.h
 
+MOTORCOMM PHY DRIVER
+M:	Peter Geis <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/net/phy/motorcomm.c
+
 MOXA SMARTIO/INDUSTIO/INTELLIO SERIAL CARD
 S:	Orphan
 F:	Documentation/driver-api/serial/moxa-smartio.rst
drivers/net/phy/Kconfig +6 -0
index 288bf405ebdb..16db9f8037b5 100644
@@ -229,6 +229,12 @@ config MICROSEMI_PHY
 	help
 	  Currently supports VSC8514, VSC8530, VSC8531, VSC8540 and VSC8541 PHYs
 
+config MOTORCOMM_PHY
+	tristate "Motorcomm PHYs"
+	help
+	  Enables support for Motorcomm network PHYs.
+	  Currently supports the YT8511 gigabit PHY.
+
 config NATIONAL_PHY
 	tristate "National Semiconductor PHYs"
 	help
drivers/net/phy/Makefile +1 -0
index bcda7ed2455d..37ffbc6e3c87 100644
@@ -70,6 +70,7 @@ obj-$(CONFIG_MICREL_PHY)	+= micrel.o
 obj-$(CONFIG_MICROCHIP_PHY)	+= microchip.o
 obj-$(CONFIG_MICROCHIP_T1_PHY)	+= microchip_t1.o
 obj-$(CONFIG_MICROSEMI_PHY)	+= mscc/
+obj-$(CONFIG_MOTORCOMM_PHY)	+= motorcomm.o
 obj-$(CONFIG_NATIONAL_PHY)	+= national.o
 obj-$(CONFIG_NXP_C45_TJA11XX_PHY)	+= nxp-c45-tja11xx.o
 obj-$(CONFIG_NXP_TJA11XX_PHY)	+= nxp-tja11xx.o
drivers/net/phy/motorcomm.c new file +87 -0

87 lines not on this page · raw message

Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 3 lines · Peter Geis

Add a driver for the Motorcomm yt8511 phy that will be used in the production Pine64 rk3566-quartz64 development board.
It supports gigabit transfer speeds, rgmii, and 125mhz clk output.

Hi Peter

Please can you add minimal RGMII delay support. Trying to add it later generally end up in backwards compatibility problems.

Do you know which one of the four RGMII modes your setup needs? Is the PHY adding the Rx and Tx delays? So "rgmii-id"?

Andrew

author
#2 lore raw
Quoted 10 lines · Andrew Lunn
Quoted 3 lines · Peter Geis

Add a driver for the Motorcomm yt8511 phy that will be used in the production Pine64 rk3566-quartz64 development board.
It supports gigabit transfer speeds, rgmii, and 125mhz clk output.

Hi Peter

Please can you add minimal RGMII delay support. Trying to add it later generally end up in backwards compatibility problems.

It should be possible, yes.
I experimented a bit with it but it just broke things.
I'm still digging through the datasheet to find what is possible for this PHY. A lot of items should be set up via the device tree, though it seems this is a relatively unused concept in the net phy subsystem.
As I'm relatively new to this subsystem I'm still learning as well.

Quoted 3 lines

Do you know which one of the four RGMII modes your setup needs? Is the PHY adding the Rx and Tx delays? So "rgmii-id"?

By default it implements a 500ps delay internally on the txd clock and a 1.2 ns delay on the rx clock.
The controller is the snps,dwmac-4.20a, and it implements a default delay as well.

I'd like to eventually support as much as possible.
For instance it seems to support cable testing.
What I've done so far has been through trial and error, but I'd prefer a more scientific approach.
I need to be able to test that functions work and would need someone who's experienced with network phys to assist.

Quoted 2 lines

Andrew

maintainer
#3 lore raw

Hi Peter

Quoted 2 lines

A lot of items should be set up via the device tree, though it seems this is a relatively unused concept in the net phy subsystem.

Very little should be set up via device tree, since it does not describe the hardware. The interface mode does describe the hardware, so that is expected to be in DT, but not too much else.

Quoted 7 lines
Quoted 2 lines

Do you know which one of the four RGMII modes your setup needs? Is the PHY adding the Rx and Tx delays? So "rgmii-id"?

By default it implements a 500ps delay internally on the txd clock and a 1.2 ns delay on the rx clock.
The controller is the snps,dwmac-4.20a, and it implements a default delay as well.

O.K, that is confusing. We generally recommend that the MAC does not add delays, the PHY does it. So maybe you can implement "rgmii-id" in the PHY, and return -EOPNOTSUP for the other three RGMII modes, as a minimum. However dwmac is one of the oddball drivers which does sometime add the delays, and always sets the PHY to "rgmii" so it does not add delays. Either way, is O.K, but please avoid having some of the delay on one side, and the rest on the other.

Andrew