Add support for MediaTek MT7987/MT7988 built-in 2.5Gb ethernet PHY (v2)
Subsystems (4)
PATCH v2 1/4 net: mediatek: associate PHY device with dts node specified by phy-handle
In reply to Weijie GaoAssociate PHY device with its device node specified by phy-handle property. This makes it possible for PHY drivers to read dedicated information to configure the PHY device.
---
Changes in v2: none
--- drivers/net/mtk_eth/mtk_eth.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/mtk_eth/mtk_eth.c +4 -0
@@ -100,6 +100,7 @@ struct mtk_eth_priv {bool pn_swap;struct phy_device *phydev; +ofnode phy_node;int phy_interface;int phy_addr;
@@ -572,6 +573,7 @@ static int mtk_phy_probe(struct udevice *dev)if (!phydev)return -ENODEV ; + phydev->node = priv->phy_node; phydev->supported &=PHY_GBIT_FEATURES ; phydev->advertising = phydev->supported;
@@ -1458,6 +1460,8 @@ static int mtk_eth_of_to_plat(struct udevice *dev)return ret; } + priv->phy_node = args.node; + priv->phy_addr =ofnode_read_s32_default (args.node,"reg" ,-1 );if (priv->phy_addr <0 ) {printf ("error: phy address is not specified\n" );
Signature · 1 line
2.34.1
v2 cover Add support for MediaTek MT7987/MT7988 built-in 2.5Gb ethernet PHY (v2)
This patch adds PHY driver for MediaTek MT7987/MT7988 built-in 2.5Gb ethernet PHY.
Changes in v2:
1. rename "pd-disable" property to "half-en"
2. rename "gbe-min-ipg-11-bytes" property to "gbe-min-ipg-11-bytes-en"
3. rename "auto-downshift-disable" property to "auto-downshift-dis"
4. add default settings for "auto-downshift-dis"
5. add default settings for "half-en"
6. add "retrain-dis" property
Weijie Gao (4):
net: mediatek: associate PHY device with dts node specified by
phy-handle
net: phy: Add MediaTek built-in 2.5Gb ethernet PHY driver
dt-bindings: mediatek: add doc for MediaTek MT7987/MT7988 2.5Gb
ethernrt PHY
MAINTAINERS: update ethernet-related file list for MediaTek ARM
platform
MAINTAINERS | 4 +- .../net/phy/mediatek,mt798x-i2p5ge-phy.txt | 68 ++ drivers/net/mtk_eth/mtk_eth.c | 4 + drivers/net/phy/Kconfig | 2 + drivers/net/phy/Makefile | 1 + drivers/net/phy/mediatek/Kconfig | 15 + drivers/net/phy/mediatek/Makefile | 4 + drivers/net/phy/mediatek/mtk-2p5ge.c | 638 ++++++++++++++++++ drivers/net/phy/mediatek/mtk-phy-lib.c | 106 +++ drivers/net/phy/mediatek/mtk.h | 103 +++ 10 files changed, 943 insertions(+), 2 deletions(-) create mode 100644 doc/device-tree-bindings/net/phy/mediatek,mt798x-i2p5ge-phy.txt create mode 100644 drivers/net/phy/mediatek/Kconfig create mode 100644 drivers/net/phy/mediatek/Makefile create mode 100644 drivers/net/phy/mediatek/mtk-2p5ge.c create mode 100644 drivers/net/phy/mediatek/mtk-phy-lib.c create mode 100644 drivers/net/phy/mediatek/mtk.h
Signature · 1 line
2.34.1
PATCH v2 2/4 net: phy: Add MediaTek built-in 2.5Gb ethernet PHY driver
The MediaTek MT7987/MT7988 SoCs features a built-in 2.5Gb PHY connected to GMAC1. The PHY supports 10/100/1000/2500 Mbps full-duplex only.
The PHY requires one or two firmware files. Firmware for MT7988 has already been added to upstream: mediatek/mt7988/i2p5ge-phy-pmb.bin. MT7987 has two firmware files which will be add to upstream later:
i2p5ge-phy-pmb.bin and i2p5ge-phy-DSPBitTb.bin.
This driver currently provides dedicated weak functions to be overridden by board to provide the firmware data:mt7987_i2p5ge_get_fw() for MT7987 mt7988_i2p5ge_get_fw() for MT7988
---
Changes in v2:
1. rename "pd-disable" property to "half-en"
2. rename "gbe-min-ipg-11-bytes" property to "gbe-min-ipg-11-bytes-en"
3. rename "auto-downshift-disable" property to "auto-downshift-dis"
4. add default settings for "auto-downshift-dis"
5. add default settings for "half-en"
6. add "retrain-dis" property
--- drivers/net/phy/Kconfig | 2 + drivers/net/phy/Makefile | 1 + drivers/net/phy/mediatek/Kconfig | 15 + drivers/net/phy/mediatek/Makefile | 4 + drivers/net/phy/mediatek/mtk-2p5ge.c | 638 +++++++++++++++++++++++++ drivers/net/phy/mediatek/mtk-phy-lib.c | 106 ++++ drivers/net/phy/mediatek/mtk.h | 103 ++++ 7 files changed, 869 insertions(+) create mode 100644 drivers/net/phy/mediatek/Kconfig create mode 100644 drivers/net/phy/mediatek/Makefile create mode 100644 drivers/net/phy/mediatek/mtk-2p5ge.c create mode 100644 drivers/net/phy/mediatek/mtk-phy-lib.c create mode 100644 drivers/net/phy/mediatek/mtk.h
drivers/net/phy/Kconfig +2 -0
@@ -184,6 +184,8 @@ config PHY_MARVELL_10G help Support for the Marvell Alaska MV88X3310 and compatible PHYs. +source "drivers/net/phy/mediatek/Kconfig" + config PHY_MESON_GXL bool "Amlogic Meson GXL Internal PHY support"
drivers/net/phy/Makefile +1 -0
@@ -21,6 +21,7 @@ obj-$(CONFIG_PHY_ET1011C) += et1011c.o obj-$(CONFIG_PHY_LXT) += lxt.o obj-$(CONFIG_PHY_MARVELL) += marvell.o obj-$(CONFIG_PHY_MARVELL_10G) += marvell10g.o +obj-y += mediatek/ obj-$(CONFIG_PHY_MICREL_KSZ8XXX) += micrel_ksz8xxx.o obj-$(CONFIG_PHY_MICREL_KSZ90X1) += micrel_ksz90x1.o obj-$(CONFIG_PHY_MESON_GXL) += meson-gxl.o
drivers/net/phy/mediatek/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config MTK_NET_PHYLIB + tristate + +config PHY_MEDIATEK_2P5GE + tristate "MediaTek built-in 2.5Gb ethernet PHYs" + depends on OF_CONTROL && (TARGET_MT7987 || TARGET_MT7988) + select MTK_NET_PHYLIB + help + Supports MediaTek SoC built-in 2.5Gb ethernet PHYs. + + This driver requires firmware download for PHY to enable its + functionality. The board must override certian firmware downloading + function to provide the firmware data.
drivers/net/phy/mediatek/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_MTK_NET_PHYLIB) += mtk-phy-lib.o +obj-$(CONFIG_PHY_MEDIATEK_2P5GE) += mtk-2p5ge.o
drivers/net/phy/mediatek/mtk-2p5ge.c new file +638 -0
638 lines not on this page · raw message
drivers/net/phy/mediatek/mtk-phy-lib.c new file +106 -0
106 lines not on this page · raw message
drivers/net/phy/mediatek/mtk.h new file +103 -0
103 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v2 3/4 dt-bindings: mediatek: add doc for MediaTek MT7987/MT7988 2.5Gb ethernrt PHY
In reply to Weijie GaoThe MediaTek MT7987 and MT7988 platforms supports one built-in 2.5Gb ethernet PHY through eth1 interface.
This patch add documentation for configuring these PHYs.
---
Changes in v2:
1. rename "pd-disable" property to "half-en"
2. rename "gbe-min-ipg-11-bytes" property to "gbe-min-ipg-11-bytes-en"
3. rename "auto-downshift-disable" property to "auto-downshift-dis"
4. add note for "retrain-dis" property
--- .../net/phy/mediatek,mt798x-i2p5ge-phy.txt | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 doc/device-tree-bindings/net/phy/mediatek,mt798x-i2p5ge-phy.txt
doc/device-tree-bindings/net/phy/mediatek,mt798x-i2p5ge-phy.txt new file +68 -0
@@ -0,0 +1,68 @@ +MediaTek MT7987/MT7988 built-in 2.5Gb Ethernet PHY + +This document describes the device tree bindings for MediaTek MT7987/MT7988 +built-in 2.5Gb Ethernet PHY. + +Required properties: +- reg: The phy address + +Optional properties: +- half-en: Boolean. The uplink XGMAC of this PHY doesn't support half duplex. + As parallel detection is enabled in this PHY, we disabled the PHY's + half-duplex capability by default. If you really want to connect to those + devices supporting only 10M/half or 100M/half and don't care about duplex + mismatch, use this option to force link up. Note that this PHY will still + link up at full duplex. + +- gbe-min-ipg-11-bytes-en: Boolean. If present, enables 11-byte minimum + inter-packet gap for 1000Mbps link speed. When not present (by default), + the PHY uses optimized IPG settings for better performance. This option is + basically for those legacy 1G link partners which only accept higher IPG + transfer. + +- retrain-dis: Boolean. If present, this will block fast retrain and normal + retrain at the same time. Not recommend to use this option unless you know + what you're doing. + +- auto-downshift-dis: Boolean. If present, disables the hardware + auto-downshift feature. When not present (by default), the PHY will + automatically downshift link speed when link quality is poor. + +- pinctrl-names: Accepts "i2p5gbe-led" pinctrl for PHY status indicator + +Notes: +- Firmware loading is required for proper operation. The driver expects + firmware files to be available through weak symbol functions provided by + boards. + +Examples: +/* without option */ +ð1 { + status = "okay"; + phy-mode = "xgmii"; + phy-handle = <&phy15>; + + phy15: ethernet-phy@15 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <15>; + phy-mode = "xgmii"; + }; +}; + +/* with options/pinctrl */ +ð1 { + status = "okay"; + pinctrl-names = "i2p5gbe-led"; + pinctrl-0 = <&i2p5gbe_led0_pins>; + phy-mode = "xgmii"; + phy-handle = <&phy15>; + + phy15: ethernet-phy@15 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <15>; + half-en; + gbe-min-ipg-11-bytes-en; + auto-downshift-dis; + phy-mode = "xgmii"; + }; +};
Signature · 1 line
2.34.1
PATCH v2 4/4 MAINTAINERS: update ethernet-related file list for MediaTek ARM platform
In reply to Weijie GaoUpdate ethernet-related files for MediaTek ARM platform
---
Changes in v2: none
--- MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
MAINTAINERS +2 -2
@@ -423,6 +423,8 @@ F: drivers/clk/mediatek/ F: drivers/cpu/mtk_cpu.c F: drivers/i2c/mtk_i2c.c F: drivers/mmc/mtk-sd.c +F: drivers/net/mtk_eth/ +F: drivers/net/phy/mediatek/ F: drivers/phy/phy-mtk-* F: drivers/pinctrl/mediatek/ F: drivers/power/domain/mtk-power-domain.c
@@ -437,8 +439,6 @@ F: drivers/timer/mtk_timer.c F: drivers/usb/host/xhci-mtk.c F: drivers/usb/mtu3/ F: drivers/watchdog/mtk_wdt.c -F: drivers/net/mtk_eth.c -F: drivers/net/mtk_eth.h F: drivers/reset/reset-mediatek.c F: drivers/serial/serial_mtk.c F: include/dt-bindings/clock/mediatek,*
Signature · 1 line
2.34.1
Re: [PATCH v2 3/4] dt-bindings: mediatek: add doc for MediaTek MT7987/MT7988 2.5Gb ethernrt PHY
In reply to Weijie GaoQuoted 13 lines · Weijie Gao
The MediaTek MT7987 and MT7988 platforms supports one built-in 2.5Gb ethernet PHY through eth1 interface.
This patch add documentation for configuring these PHYs.
Signed-off-by Sky Huang <[email protected]>Signed-off-by Weijie Gao <[email protected]>---
Changes in v2:
1. rename "pd-disable" property to "half-en"
2. rename "gbe-min-ipg-11-bytes" property to "gbe-min-ipg-11-bytes-en"
3. rename "auto-downshift-disable" property to "auto-downshift-dis"
4. add note for "retrain-dis" property
Quoted 4 lines
--- .../net/phy/mediatek,mt798x-i2p5ge-phy.txt | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 doc/device-tree-bindings/net/phy/mediatek,mt798x-i2p5ge-phy.txt
What is the status of this binding in Linux? Thanks.
Signature · 1 line
Tom
Re: [PATCH v2 3/4] dt-bindings: mediatek: add doc for MediaTek MT7987/MT7988 2.5Gb ethernrt PHY
Quoted 23 lines · Tom Rini
Quoted 15 lines · Weijie Gao
The MediaTek MT7987 and MT7988 platforms supports one built-in 2.5Gb
ethernet PHY through eth1 interface.This patch add documentation for configuring these PHYs.
Signed-off-by Sky Huang <[email protected]>Signed-off-by Weijie Gao <[email protected]>---
Changes in v2:
1. rename "pd-disable" property to "half-en"
2. rename "gbe-min-ipg-11-bytes" property to "gbe-min-ipg-11-bytes- en"
3. rename "auto-downshift-disable" property to "auto-downshift-dis"
4. add note for "retrain-dis" propertyQuoted 6 lines
--- .../net/phy/mediatek,mt798x-i2p5ge-phy.txt | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 doc/device-tree-
bindings/net/phy/mediatek,mt798x-i2p5ge-phy.txt
Quoted 2 lines
What is the status of this binding in Linux? Thanks.
The driver in linux kernel is just a basic version supporting only mt7988, and of course none of these bindings are supported. The u-boot driver is actually the complete version. We also plan to update the linux driver later.
Re: [PATCH v2 3/4] dt-bindings: mediatek: add doc for MediaTek MT7987/MT7988 2.5Gb ethernrt PHY
Quoted 24 lines · Weijie Gao
Quoted 23 lines · Tom Rini
Quoted 21 lines · Weijie Gao
The MediaTek MT7987 and MT7988 platforms supports one built-in 2.5Gb
ethernet PHY through eth1 interface.This patch add documentation for configuring these PHYs.
Signed-off-by Sky Huang <[email protected]>Signed-off-by Weijie Gao <[email protected]>---
Changes in v2:
1. rename "pd-disable" property to "half-en"
2. rename "gbe-min-ipg-11-bytes" property to "gbe-min-ipg-11-bytes- en"
3. rename "auto-downshift-disable" property to "auto-downshift-dis"
4. add note for "retrain-dis" property--- .../net/phy/mediatek,mt798x-i2p5ge-phy.txt | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 doc/device-tree-
bindings/net/phy/mediatek,mt798x-i2p5ge-phy.txt
Quoted 7 lines
Quoted 2 lines
What is the status of this binding in Linux? Thanks.
The driver in linux kernel is just a basic version supporting only mt7988, and of course none of these bindings are supported. The u-boot driver is actually the complete version. We also plan to update the linux driver later.
To make using OF_UPSTREAM easier, among other things, I would prefer to get the binding finalized in the kernel and then implement things in U-Boot so that we don't end up having to deal with incompatibilities here. Thanks.
Signature · 1 line
Tom
Re: [PATCH v2 3/4] dt-bindings: mediatek: add doc for MediaTek MT7987/MT7988 2.5Gb ethernrt PHY
Quoted 36 lines · Tom Rini
Quoted 26 lines · Weijie Gao
Quoted 25 lines · Tom Rini
Quoted 23 lines · Weijie Gao
The MediaTek MT7987 and MT7988 platforms supports one built-in 2.5Gb
ethernet PHY through eth1 interface.This patch add documentation for configuring these PHYs.
Signed-off-by Sky Huang <[email protected]>Signed-off-by Weijie Gao <[email protected]>---
Changes in v2:
1. rename "pd-disable" property to "half-en"
2. rename "gbe-min-ipg-11-bytes" property to "gbe-min-ipg-11- bytes-
en"
3. rename "auto-downshift-disable" property to "auto-downshift- dis"
4. add note for "retrain-dis" property--- .../net/phy/mediatek,mt798x-i2p5ge-phy.txt | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 doc/device-tree-
bindings/net/phy/mediatek,mt798x-i2p5ge-phy.txtQuoted 8 lines
Quoted 2 lines
What is the status of this binding in Linux? Thanks.
The driver in linux kernel is just a basic version supporting only mt7988, and of course none of these bindings are supported. The u- boot
driver is actually the complete version. We also plan to update the linux driver later.
Quoted 6 lines
To make using
OF_UPSTREAMeasier, among other things, I would prefer to
get the binding finalized in the kernel and then implement things in U-Boot so that we don't end up having to deal with incompatibilities here. Thanks.
I can resend this driver with all dt-binding related code removed as they are not really used in normal case. No incompatibilitie will be introduce in this case.
Re: [PATCH v2 3/4] dt-bindings: mediatek: add doc for MediaTek MT7987/MT7988 2.5Gb ethernrt PHY
Quoted 44 lines · Weijie Gao (高惟杰)
Quoted 36 lines · Tom Rini
Quoted 26 lines · Weijie Gao
Quoted 25 lines · Tom Rini
Quoted 23 lines · Weijie Gao
The MediaTek MT7987 and MT7988 platforms supports one built-in 2.5Gb
ethernet PHY through eth1 interface.This patch add documentation for configuring these PHYs.
Signed-off-by Sky Huang <[email protected]>Signed-off-by Weijie Gao <[email protected]>---
Changes in v2:
1. rename "pd-disable" property to "half-en"
2. rename "gbe-min-ipg-11-bytes" property to "gbe-min-ipg-11- bytes-
en"
3. rename "auto-downshift-disable" property to "auto-downshift- dis"
4. add note for "retrain-dis" property--- .../net/phy/mediatek,mt798x-i2p5ge-phy.txt | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 doc/device-tree-
bindings/net/phy/mediatek,mt798x-i2p5ge-phy.txtQuoted 8 lines
Quoted 2 lines
What is the status of this binding in Linux? Thanks.
The driver in linux kernel is just a basic version supporting only mt7988, and of course none of these bindings are supported. The u- boot
driver is actually the complete version. We also plan to update the linux driver later.Quoted 6 lines
To make using
OF_UPSTREAMeasier, among other things, I would prefer to
get the binding finalized in the kernel and then implement things in U-Boot so that we don't end up having to deal with incompatibilities here. Thanks.
Quoted 3 lines
I can resend this driver with all dt-binding related code removed as they are not really used in normal case. No incompatibilitie will be introduce in this case.
Sounds good, thanks.
Signature · 1 line
Tom