net: phy: add driver for MediaTek SoC built-in GE PHYs
Subsystems (4)
PATCH v2 1/1 net: phy: add driver for MediaTek SoC built-in GE PHYs
Some of MediaTek's Filogic SoCs come with built-in gigabit Ethernet PHYs which require calibration data from the SoC's efuse. Despite the similar design the driver doesn't share any code with the existing mediatek-ge.c, so add support for these PHYs by introducing a new driver for only MediaTek's ARM64 SoCs.
---
Changes since v1:
* split-off SoC-specific driver from mediatek-ge.c as requested
* address comments made by Heiner Kallweit
* add pinctrl handling for PHY LED
* remove calibration details not needed in production hardware
MAINTAINERS | 9 + drivers/net/phy/Kconfig | 12 + drivers/net/phy/Makefile | 1 + drivers/net/phy/mediatek-ge-soc.c | 1263 +++++++++++++++++++++++++++++ drivers/net/phy/mediatek-ge.c | 3 +- 5 files changed, 1287 insertions(+), 1 deletion(-) create mode 100644 drivers/net/phy/mediatek-ge-soc.c
MAINTAINERS +9 -0
@@ -13078,6 +13078,15 @@ S: Maintained F: drivers/net/pcs/pcs-mtk-lynxi.c F: include/linux/pcs/pcs-mtk-lynxi.h +MEDIATEK ETHERNET PHY DRIVERS +M: Daniel Golle <[email protected]> +M: Qingfang Deng <[email protected]> +M: SkyLake Huang <[email protected]> +L: [email protected] +S: Maintained +F: drivers/net/phy/mediatek-ge-soc.c +F: drivers/net/phy/mediatek-ge.c + MEDIATEK I2C CONTROLLER DRIVER M: Qii Wang <[email protected]> L: [email protected]
drivers/net/phy/Kconfig +12 -0
@@ -238,6 +238,18 @@ config MEDIATEK_GE_PHY help Supports the MediaTek Gigabit Ethernet PHYs. +config MEDIATEK_GE_SOC_PHY + tristate "MediaTek SoC Ethernet PHYs" + depends on (ARM64 && ARCH_MEDIATEK) || COMPILE_TEST + select NVMEM_MTK_EFUSE + help + Supports MediaTek SoC built-in Gigabit Ethernet PHYs. + + Include support for built-in Ethernet PHYs which are present in + the MT7981 and MT7988 SoCs. These PHYs need calibration data + present in the SoCs efuse and will dynamically calibrate VCM + (common-mode voltage) during startup. + config MICREL_PHY tristate "Micrel PHYs" depends on PTP_1588_CLOCK_OPTIONAL
drivers/net/phy/Makefile +1 -0
@@ -69,6 +69,7 @@ obj-$(CONFIG_MARVELL_PHY) += marvell.o obj-$(CONFIG_MARVELL_88X2222_PHY) += marvell-88x2222.o obj-$(CONFIG_MAXLINEAR_GPHY) += mxl-gpy.o obj-$(CONFIG_MEDIATEK_GE_PHY) += mediatek-ge.o +obj-$(CONFIG_MEDIATEK_GE_SOC_PHY) += mediatek-ge-soc.o obj-$(CONFIG_MESON_GXL_PHY) += meson-gxl.o obj-$(CONFIG_MICREL_KS8995MA) += spi_ks8995.o obj-$(CONFIG_MICREL_PHY) += micrel.o
drivers/net/phy/mediatek-ge-soc.c new file +1263 -0
1,263 lines not on this page · raw message
drivers/net/phy/mediatek-ge.c +2 -1
@@ -102,7 +102,8 @@ static struct phy_driver mtk_gephy_driver[] = {module_phy_driver (mtk_gephy_driver);static struct mdio_device_id __maybe_unused mtk_gephy_tbl[] = { - {PHY_ID_MATCH_VENDOR (0x03a29400 ) }, + {PHY_ID_MATCH_EXACT (0x03a29441 ) }, + {PHY_ID_MATCH_EXACT (0x03a29412 ) }, { } };
Signature · 1 line
2.40.0
Jakub Kicinski
maintainerQuoted 5 lines · On Sat, 22 Apr 2023 13:36:58 +0100 Daniel Golle wrote:
Some of MediaTek's Filogic SoCs come with built-in gigabit Ethernet PHYs which require calibration data from the SoC's efuse. Despite the similar design the driver doesn't share any code with the existing
mediatek-ge.c, so add support for these PHYs by introducing a new driver for only MediaTek's ARM64 SoCs.
Andrew, Heiner, how do you feel about this driver?
Daniel, is it high prio for you to get it into 6.4 or 6.5 is okay?
I'm trying to get a read on whether we should merge it because it's kind of on the goal line for this merge window.
If nobody feels strongly we can do this the traditional way - I'll just complain about RCT, hence kicking it back out into the field :)
Andrew Lunn
maintainerQuoted 8 lines · Jakub Kicinski
Quoted 5 lines · On Sat, 22 Apr 2023 13:36:58 +0100 Daniel Golle wrote:
Some of MediaTek's Filogic SoCs come with built-in gigabit Ethernet PHYs which require calibration data from the SoC's efuse. Despite the similar design the driver doesn't share any code with the existing
mediatek-ge.c, so add support for these PHYs by introducing a new driver for only MediaTek's ARM64 SoCs.Andrew, Heiner, how do you feel about this driver?
It is 95% magic values in magic registers which nobody is every going to understand without the datasheet. Assuming any of it is actually in the data sheet. I really think the firmware in this PHY needs a re-write to avoid exposing all this to the OS. But i don't know if we have that level of NACK. Having said that, there is a nice quote in LWN from Thomas Gleixer about this:
https://lwn.net/Articles/928946/
This does seem like a case of 'throw hardware/firmware over the fence and let software folks deal with it.' There is no other PHY like it in Linux. So i would like to reject it, but i then suspect we are punishing the wrong people, Daniel not MediaTek.
I would also drop the LED configuration parts. Leave it at reset defaults for the moment. It seems like the generic support for controlling PHY LEDs is making progress and will be merged next cycle.
Andrew
Quoted 10 lines · Jakub Kicinski
Quoted 5 lines · On Sat, 22 Apr 2023 13:36:58 +0100 Daniel Golle wrote:
Some of MediaTek's Filogic SoCs come with built-in gigabit Ethernet PHYs which require calibration data from the SoC's efuse. Despite the similar design the driver doesn't share any code with the existing
mediatek-ge.c, so add support for these PHYs by introducing a new driver for only MediaTek's ARM64 SoCs.Andrew, Heiner, how do you feel about this driver?
Daniel, is it high prio for you to get it into 6.4 or 6.5 is okay?
No rush, as this is mostly relevant for OpenWrt the thing which matters most to me is having it in the next LTS kernel, so 6.5 should still be fine I suppose.
Quoted 6 lines
I'm trying to get a read on whether we should merge it because it's kind of on the goal line for this merge window.
If nobody feels strongly we can do this the traditional way - I'll just complain about RCT, hence kicking it back out into the field :)
I understand Andrew's concerns and will resubmit for the next merge window in 2 weeks, and without the LED part for now until PHY LED infrastructure is more ready (ie. able to offload 'netdev' trigger to hardware)
Jakub Kicinski
maintainerQuoted 10 lines · On Tue, 25 Apr 2023 09:27:56 +0100 Daniel Golle wrote:
Quoted 1 line
Daniel, is it high prio for you to get it into 6.4 or 6.5 is okay?
No rush, as this is mostly relevant for OpenWrt the thing which matters most to me is having it in the next LTS kernel, so 6.5 should still be fine I suppose.
Quoted 4 lines
I'm trying to get a read on whether we should merge it because it's kind of on the goal line for this merge window.
Quoted 7 lines
Quoted 2 lines
If nobody feels strongly we can do this the traditional way - I'll just complain about RCT, hence kicking it back out into the field :)
I understand Andrew's concerns and will resubmit for the next merge window in 2 weeks, and without the LED part for now until PHY LED infrastructure is more ready (ie. able to offload 'netdev' trigger to hardware)
Perfect, thanks!