* [PATCH v2 1/4] dt-bindings: net: realtek,rtl82xx: add a property to set MDI order
@ 2026-01-21 15:15 Damien Dejean
2026-01-21 15:15 ` [PATCH v2 2/4] net: phy: realtek: add RTL8224 pair order support Damien Dejean
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Damien Dejean @ 2026-01-21 15:15 UTC (permalink / raw)
To: andrew, krzk+dt
Cc: netdev, devicetree, linux-kernel, edumazet, davem, kuba, pabeni,
hkallweit1, Damien Dejean
MDI pair order reversal is usually configured by the bootloader.
However, on some design the configuration is left untouched during boot
and needs to be set by the driver.
Add the property 'realtek,mdi-cfg-order' to allow forcing normal or
reverse order of the MDI pairs.
Signed-off-by: Damien Dejean <dam.dejean@gmail.com>
---
Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml b/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml
index 2b5697bd7c5d..c4ced671ecb8 100644
--- a/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml
+++ b/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml
@@ -55,6 +55,12 @@ properties:
description:
Enable Wake-on-LAN support for the RTL8211F PHY.
+ realtek,mdi-cfg-order:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ enum: [0, 1]
+ description:
+ Force normal (0) or reverse (1) order of MDI pairs.
+
unevaluatedProperties: false
allOf:
@@ -79,5 +85,6 @@ examples:
reg = <1>;
realtek,clkout-disable;
realtek,aldps-enable;
+ realtek,mdi-cfg-order = <1>;
};
};
base-commit: 983d014aafb14ee5e4915465bf8948e8f3a723b5
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 2/4] net: phy: realtek: add RTL8224 pair order support
2026-01-21 15:15 [PATCH v2 1/4] dt-bindings: net: realtek,rtl82xx: add a property to set MDI order Damien Dejean
@ 2026-01-21 15:15 ` Damien Dejean
2026-01-22 15:15 ` kernel test robot
2026-01-22 17:39 ` kernel test robot
2026-01-21 15:15 ` [PATCH v2 3/4] dt-bindings: net: realtek,rtl82xx: add a property to set MDI polarity Damien Dejean
2026-01-21 15:15 ` [PATCH v2 4/4] net: phy: realtek: add RTL8224 polarity support Damien Dejean
2 siblings, 2 replies; 11+ messages in thread
From: Damien Dejean @ 2026-01-21 15:15 UTC (permalink / raw)
To: andrew, krzk+dt
Cc: netdev, devicetree, linux-kernel, edumazet, davem, kuba, pabeni,
hkallweit1, Damien Dejean
The RTL8224 has a register to configure a pair swap (from ABCD order to
DCBA) providing PCB designers more flexbility when wiring the chip. The
swap parameter has to be set correctly for each of the 4 ports before
the chip can detect a link.
After a reset, this register is (unfortunately) left in a random state,
thus it has to be initialized. On most of the devices the bootloader
does it once for all and we can rely on the value set, on some other it
is not and the kernel has to do it.
The MDI pair swap can be set in the device tree using the property
realtek,mdi-cfg-order. The property is set to 0 to keep the default
order (ABCD), or 1 to reverse the pairs (DCBA).
Signed-off-by: Damien Dejean <dam.dejean@gmail.com>
---
drivers/net/phy/realtek/Kconfig | 1 +
drivers/net/phy/realtek/realtek_main.c | 50 ++++++++++++++++++++++++++
2 files changed, 51 insertions(+)
diff --git a/drivers/net/phy/realtek/Kconfig b/drivers/net/phy/realtek/Kconfig
index b05c2a1e9024..a741b34d193e 100644
--- a/drivers/net/phy/realtek/Kconfig
+++ b/drivers/net/phy/realtek/Kconfig
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
config REALTEK_PHY
tristate "Realtek PHYs"
+ select PHY_PACKAGE
help
Currently supports RTL821x/RTL822x and fast ethernet PHYs
diff --git a/drivers/net/phy/realtek/realtek_main.c b/drivers/net/phy/realtek/realtek_main.c
index 6ff0385201a5..85b0eea936e4 100644
--- a/drivers/net/phy/realtek/realtek_main.c
+++ b/drivers/net/phy/realtek/realtek_main.c
@@ -18,6 +18,7 @@
#include <linux/clk.h>
#include <linux/string_choices.h>
+#include "../phylib.h"
#include "realtek.h"
#define RTL8201F_IER 0x13
@@ -162,6 +163,8 @@
#define RTL8224_SRAM_RTCT_LEN(pair) (0x8028 + (pair) * 4)
+#define RTL8224_VND1_MDI_PAIR_SWAP 0xa90
+
#define RTL8366RB_POWER_SAVE 0x15
#define RTL8366RB_POWER_SAVE_ON BIT(12)
@@ -1683,6 +1686,51 @@ static int rtl8224_cable_test_get_status(struct phy_device *phydev, bool *finish
return rtl8224_cable_test_report(phydev, finished);
}
+static int rtl8224_mdi_config_order(struct phy_device *phydev)
+{
+ struct device_node *np = phydev->mdio.dev.of_node;
+ u8 port_offset = phydev->mdio.addr & 3;
+ u32 mdi_conf, val;
+ int ret;
+
+ ret = of_property_read_u32(np, "realtek,mdi-cfg-order", &mdi_conf);
+
+ /* Do nothing in case the property is not present */
+ if (ret == -EINVAL)
+ return 0;
+
+ if (ret)
+ return ret;
+
+ if (mdi_conf & ~1)
+ return -EINVAL;
+
+ val = __phy_package_read_mmd(phydev, 0, MDIO_MMD_VEND1,
+ RTL8224_VND1_MDI_PAIR_SWAP);
+ if (val < 0)
+ return val;
+
+ if (mdi_conf)
+ val |= (1 << port_offset);
+ else
+ val &= ~(1 << port_offset);
+
+ return __phy_package_write_mmd(phydev, 0, MDIO_MMD_VEND1,
+ RTL8224_VND1_MDI_PAIR_SWAP, val);
+}
+
+static int rtl8224_config_init(struct phy_device *phydev)
+{
+ return rtl8224_mdi_config_order(phydev);
+}
+
+static int rtl8224_probe(struct phy_device *phydev)
+{
+ /* Chip exposes 4 ports, join all of them in the same package */
+ return devm_phy_package_join(&phydev->mdio.dev, phydev,
+ phydev->mdio.addr & ~3, 0);
+}
+
static bool rtlgen_supports_2_5gbps(struct phy_device *phydev)
{
int val;
@@ -2212,6 +2260,8 @@ static struct phy_driver realtek_drvs[] = {
PHY_ID_MATCH_EXACT(0x001ccad0),
.name = "RTL8224 2.5Gbps PHY",
.flags = PHY_POLL_CABLE_TEST,
+ .probe = rtl8224_probe,
+ .config_init = rtl8224_config_init,
.get_features = rtl822x_c45_get_features,
.config_aneg = rtl822x_c45_config_aneg,
.read_status = rtl822x_c45_read_status,
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 3/4] dt-bindings: net: realtek,rtl82xx: add a property to set MDI polarity
2026-01-21 15:15 [PATCH v2 1/4] dt-bindings: net: realtek,rtl82xx: add a property to set MDI order Damien Dejean
2026-01-21 15:15 ` [PATCH v2 2/4] net: phy: realtek: add RTL8224 pair order support Damien Dejean
@ 2026-01-21 15:15 ` Damien Dejean
2026-01-22 16:51 ` Rob Herring
2026-01-21 15:15 ` [PATCH v2 4/4] net: phy: realtek: add RTL8224 polarity support Damien Dejean
2 siblings, 1 reply; 11+ messages in thread
From: Damien Dejean @ 2026-01-21 15:15 UTC (permalink / raw)
To: andrew, krzk+dt
Cc: netdev, devicetree, linux-kernel, edumazet, davem, kuba, pabeni,
hkallweit1, Damien Dejean
MDI pair polarity is usually configured by the bootloader. However, on
some designs the configuration is left untouched during boot and needs
to be set by the driver.
Add the property 'realtek,mdi-cfg-polarity' to configure the polarity of
each pair. Bit 0 to 3 configure the polarity or pairs A to D, if set to
1 the polarity is reversed for this pair.
Signed-off-by: Damien Dejean <dam.dejean@gmail.com>
---
Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml b/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml
index c4ced671ecb8..17088c147358 100644
--- a/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml
+++ b/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml
@@ -61,6 +61,13 @@ properties:
description:
Force normal (0) or reverse (1) order of MDI pairs.
+ realtek,mdi-cfg-polarity:
+ description:
+ A bitmap to describe pair polarity swap. Bit 0 to swap polarity of pair A,
+ bit 1 to swap polarity of pair B, bit 2 to swap polarity of pair C and bit
+ 3 to swap polarity of pair D.
+ $ref: /schemas/types.yaml#/definitions/uint32
+
unevaluatedProperties: false
allOf:
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 4/4] net: phy: realtek: add RTL8224 polarity support
2026-01-21 15:15 [PATCH v2 1/4] dt-bindings: net: realtek,rtl82xx: add a property to set MDI order Damien Dejean
2026-01-21 15:15 ` [PATCH v2 2/4] net: phy: realtek: add RTL8224 pair order support Damien Dejean
2026-01-21 15:15 ` [PATCH v2 3/4] dt-bindings: net: realtek,rtl82xx: add a property to set MDI polarity Damien Dejean
@ 2026-01-21 15:15 ` Damien Dejean
2026-01-22 18:41 ` kernel test robot
2026-01-22 22:12 ` kernel test robot
2 siblings, 2 replies; 11+ messages in thread
From: Damien Dejean @ 2026-01-21 15:15 UTC (permalink / raw)
To: andrew, krzk+dt
Cc: netdev, devicetree, linux-kernel, edumazet, davem, kuba, pabeni,
hkallweit1, Damien Dejean
The RTL8224 has a register to configure the polarity of every pair of
each port. It provides device designers more flexbility when wiring the
chip.
Unfortunately, the register is left in an unknown state after a reset.
Thus on devices where the bootloader don't initialize it, the driver has
to do it to detect and use a link.
The MDI polarity swap can be set in the device tree using the property
realtek,mdi-cfg-polarity. The u32 value is a bitfield where bit[0..3]
control the polarity of pairs A..D.
Signed-off-by: Damien Dejean <dam.dejean@gmail.com>
---
drivers/net/phy/realtek/realtek_main.c | 39 +++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/realtek/realtek_main.c b/drivers/net/phy/realtek/realtek_main.c
index 85b0eea936e4..d2dc4f7a1971 100644
--- a/drivers/net/phy/realtek/realtek_main.c
+++ b/drivers/net/phy/realtek/realtek_main.c
@@ -164,6 +164,7 @@
#define RTL8224_SRAM_RTCT_LEN(pair) (0x8028 + (pair) * 4)
#define RTL8224_VND1_MDI_PAIR_SWAP 0xa90
+#define RTL8224_VND1_MDI_POLARITY_SWAP 0xa94
#define RTL8366RB_POWER_SAVE 0x15
#define RTL8366RB_POWER_SAVE_ON BIT(12)
@@ -1719,9 +1720,45 @@ static int rtl8224_mdi_config_order(struct phy_device *phydev)
RTL8224_VND1_MDI_PAIR_SWAP, val);
}
+static int rtl8224_mdi_config_polarity(struct phy_device *phydev)
+{
+ struct device_node *np = phydev->mdio.dev.of_node;
+ u8 port_offset = phydev->mdio.addr & 3;
+ u32 polarity, val;
+ int ret;
+
+ ret = of_property_read_u32(np, "realtek,mdi-cfg-polarity", &polarity);
+
+ /* Do nothing if the property is not present */
+ if (ret == -EINVAL)
+ return 0;
+
+ if (!ret)
+ return ret;
+
+ if (polarity & ~0xf)
+ return -EINVAL;
+
+ val = __phy_package_read_mmd(phydev, 0, MDIO_MMD_VEND1,
+ RTL8224_VND1_MDI_POLARITY_SWAP);
+ if (val < 0)
+ return val;
+
+ val &= ~(0xf << port_offset);
+ val |= polarity << port_offset;
+ return __phy_package_write_mmd(phydev, 0, MDIO_MMD_VEND1,
+ RTL8224_VND1_MDI_POLARITY_SWAP, val);
+}
+
static int rtl8224_config_init(struct phy_device *phydev)
{
- return rtl8224_mdi_config_order(phydev);
+ int ret;
+
+ ret = rtl8224_mdi_config_order(phydev);
+ if (!ret)
+ return ret;
+
+ return rtl8224_mdi_config_polarity(phydev);
}
static int rtl8224_probe(struct phy_device *phydev)
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/4] net: phy: realtek: add RTL8224 pair order support
2026-01-21 15:15 ` [PATCH v2 2/4] net: phy: realtek: add RTL8224 pair order support Damien Dejean
@ 2026-01-22 15:15 ` kernel test robot
2026-01-22 17:39 ` kernel test robot
1 sibling, 0 replies; 11+ messages in thread
From: kernel test robot @ 2026-01-22 15:15 UTC (permalink / raw)
To: Damien Dejean, andrew, krzk+dt
Cc: oe-kbuild-all, netdev, devicetree, linux-kernel, edumazet, davem,
kuba, pabeni, hkallweit1, Damien Dejean
Hi Damien,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 983d014aafb14ee5e4915465bf8948e8f3a723b5]
url: https://github.com/intel-lab-lkp/linux/commits/Damien-Dejean/net-phy-realtek-add-RTL8224-pair-order-support/20260122-000009
base: 983d014aafb14ee5e4915465bf8948e8f3a723b5
patch link: https://lore.kernel.org/r/20260121151506.813783-2-dam.dejean%40gmail.com
patch subject: [PATCH v2 2/4] net: phy: realtek: add RTL8224 pair order support
config: i386-randconfig-141-20260122 (https://download.01.org/0day-ci/archive/20260122/202601222247.z2ExZCHx-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch version: v0.5.0-8985-g2614ff1a
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601222247.z2ExZCHx-lkp@intel.com/
New smatch warnings:
drivers/net/phy/realtek/realtek_main.c:1710 rtl8224_mdi_config_order() warn: unsigned 'val' is never less than zero.
Old smatch warnings:
drivers/net/phy/realtek/realtek_main.c:805 rtl821x_resume() warn: 'priv->clk' from clk_prepare_enable() not released on lines: 801.
vim +/val +1710 drivers/net/phy/realtek/realtek_main.c
1688
1689 static int rtl8224_mdi_config_order(struct phy_device *phydev)
1690 {
1691 struct device_node *np = phydev->mdio.dev.of_node;
1692 u8 port_offset = phydev->mdio.addr & 3;
1693 u32 mdi_conf, val;
1694 int ret;
1695
1696 ret = of_property_read_u32(np, "realtek,mdi-cfg-order", &mdi_conf);
1697
1698 /* Do nothing in case the property is not present */
1699 if (ret == -EINVAL)
1700 return 0;
1701
1702 if (ret)
1703 return ret;
1704
1705 if (mdi_conf & ~1)
1706 return -EINVAL;
1707
1708 val = __phy_package_read_mmd(phydev, 0, MDIO_MMD_VEND1,
1709 RTL8224_VND1_MDI_PAIR_SWAP);
> 1710 if (val < 0)
1711 return val;
1712
1713 if (mdi_conf)
1714 val |= (1 << port_offset);
1715 else
1716 val &= ~(1 << port_offset);
1717
1718 return __phy_package_write_mmd(phydev, 0, MDIO_MMD_VEND1,
1719 RTL8224_VND1_MDI_PAIR_SWAP, val);
1720 }
1721
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 3/4] dt-bindings: net: realtek,rtl82xx: add a property to set MDI polarity
2026-01-21 15:15 ` [PATCH v2 3/4] dt-bindings: net: realtek,rtl82xx: add a property to set MDI polarity Damien Dejean
@ 2026-01-22 16:51 ` Rob Herring
2026-01-22 20:47 ` Damien Dejean
0 siblings, 1 reply; 11+ messages in thread
From: Rob Herring @ 2026-01-22 16:51 UTC (permalink / raw)
To: Damien Dejean
Cc: andrew, krzk+dt, netdev, devicetree, linux-kernel, edumazet,
davem, kuba, pabeni, hkallweit1
On Wed, Jan 21, 2026 at 04:15:05PM +0100, Damien Dejean wrote:
> MDI pair polarity is usually configured by the bootloader. However, on
> some designs the configuration is left untouched during boot and needs
> to be set by the driver.
>
> Add the property 'realtek,mdi-cfg-polarity' to configure the polarity of
> each pair. Bit 0 to 3 configure the polarity or pairs A to D, if set to
> 1 the polarity is reversed for this pair.
>
> Signed-off-by: Damien Dejean <dam.dejean@gmail.com>
> ---
> Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml b/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml
> index c4ced671ecb8..17088c147358 100644
> --- a/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml
> +++ b/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml
> @@ -61,6 +61,13 @@ properties:
> description:
> Force normal (0) or reverse (1) order of MDI pairs.
>
> + realtek,mdi-cfg-polarity:
> + description:
> + A bitmap to describe pair polarity swap. Bit 0 to swap polarity of pair A,
> + bit 1 to swap polarity of pair B, bit 2 to swap polarity of pair C and bit
> + 3 to swap polarity of pair D.
> + $ref: /schemas/types.yaml#/definitions/uint32
maximum: 0xf
However, are these properties something that should be common?
Rob
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/4] net: phy: realtek: add RTL8224 pair order support
2026-01-21 15:15 ` [PATCH v2 2/4] net: phy: realtek: add RTL8224 pair order support Damien Dejean
2026-01-22 15:15 ` kernel test robot
@ 2026-01-22 17:39 ` kernel test robot
1 sibling, 0 replies; 11+ messages in thread
From: kernel test robot @ 2026-01-22 17:39 UTC (permalink / raw)
To: Damien Dejean, andrew, krzk+dt
Cc: oe-kbuild-all, netdev, devicetree, linux-kernel, edumazet, davem,
kuba, pabeni, hkallweit1, Damien Dejean
Hi Damien,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 983d014aafb14ee5e4915465bf8948e8f3a723b5]
url: https://github.com/intel-lab-lkp/linux/commits/Damien-Dejean/net-phy-realtek-add-RTL8224-pair-order-support/20260122-000009
base: 983d014aafb14ee5e4915465bf8948e8f3a723b5
patch link: https://lore.kernel.org/r/20260121151506.813783-2-dam.dejean%40gmail.com
patch subject: [PATCH v2 2/4] net: phy: realtek: add RTL8224 pair order support
config: i386-randconfig-141-20260122 (https://download.01.org/0day-ci/archive/20260123/202601230140.M3peApO0-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch version: v0.5.0-8994-gd50c5a4c
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601230140.M3peApO0-lkp@intel.com/
New smatch warnings:
drivers/net/phy/realtek/realtek_main.c:1710 rtl8224_mdi_config_order() warn: unsigned 'val' is never less than zero.
Old smatch warnings:
drivers/net/phy/realtek/realtek_main.c:805 rtl821x_resume() warn: 'priv->clk' from clk_prepare_enable() not released on lines: 801.
vim +/val +1710 drivers/net/phy/realtek/realtek_main.c
1688
1689 static int rtl8224_mdi_config_order(struct phy_device *phydev)
1690 {
1691 struct device_node *np = phydev->mdio.dev.of_node;
1692 u8 port_offset = phydev->mdio.addr & 3;
1693 u32 mdi_conf, val;
1694 int ret;
1695
1696 ret = of_property_read_u32(np, "realtek,mdi-cfg-order", &mdi_conf);
1697
1698 /* Do nothing in case the property is not present */
1699 if (ret == -EINVAL)
1700 return 0;
1701
1702 if (ret)
1703 return ret;
1704
1705 if (mdi_conf & ~1)
1706 return -EINVAL;
1707
1708 val = __phy_package_read_mmd(phydev, 0, MDIO_MMD_VEND1,
1709 RTL8224_VND1_MDI_PAIR_SWAP);
> 1710 if (val < 0)
1711 return val;
1712
1713 if (mdi_conf)
1714 val |= (1 << port_offset);
1715 else
1716 val &= ~(1 << port_offset);
1717
1718 return __phy_package_write_mmd(phydev, 0, MDIO_MMD_VEND1,
1719 RTL8224_VND1_MDI_PAIR_SWAP, val);
1720 }
1721
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 4/4] net: phy: realtek: add RTL8224 polarity support
2026-01-21 15:15 ` [PATCH v2 4/4] net: phy: realtek: add RTL8224 polarity support Damien Dejean
@ 2026-01-22 18:41 ` kernel test robot
2026-01-22 22:12 ` kernel test robot
1 sibling, 0 replies; 11+ messages in thread
From: kernel test robot @ 2026-01-22 18:41 UTC (permalink / raw)
To: Damien Dejean, andrew, krzk+dt
Cc: oe-kbuild-all, netdev, devicetree, linux-kernel, edumazet, davem,
kuba, pabeni, hkallweit1, Damien Dejean
Hi Damien,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 983d014aafb14ee5e4915465bf8948e8f3a723b5]
url: https://github.com/intel-lab-lkp/linux/commits/Damien-Dejean/net-phy-realtek-add-RTL8224-pair-order-support/20260122-000009
base: 983d014aafb14ee5e4915465bf8948e8f3a723b5
patch link: https://lore.kernel.org/r/20260121151506.813783-4-dam.dejean%40gmail.com
patch subject: [PATCH v2 4/4] net: phy: realtek: add RTL8224 polarity support
config: i386-randconfig-141-20260122 (https://download.01.org/0day-ci/archive/20260123/202601230236.Ey3jrFu2-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch version: v0.5.0-8994-gd50c5a4c
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601230236.Ey3jrFu2-lkp@intel.com/
New smatch warnings:
drivers/net/phy/realtek/realtek_main.c:1744 rtl8224_mdi_config_polarity() warn: unsigned 'val' is never less than zero.
Old smatch warnings:
drivers/net/phy/realtek/realtek_main.c:806 rtl821x_resume() warn: 'priv->clk' from clk_prepare_enable() not released on lines: 802.
drivers/net/phy/realtek/realtek_main.c:1711 rtl8224_mdi_config_order() warn: unsigned 'val' is never less than zero.
vim +/val +1744 drivers/net/phy/realtek/realtek_main.c
1722
1723 static int rtl8224_mdi_config_polarity(struct phy_device *phydev)
1724 {
1725 struct device_node *np = phydev->mdio.dev.of_node;
1726 u8 port_offset = phydev->mdio.addr & 3;
1727 u32 polarity, val;
1728 int ret;
1729
1730 ret = of_property_read_u32(np, "realtek,mdi-cfg-polarity", &polarity);
1731
1732 /* Do nothing if the property is not present */
1733 if (ret == -EINVAL)
1734 return 0;
1735
1736 if (!ret)
1737 return ret;
1738
1739 if (polarity & ~0xf)
1740 return -EINVAL;
1741
1742 val = __phy_package_read_mmd(phydev, 0, MDIO_MMD_VEND1,
1743 RTL8224_VND1_MDI_POLARITY_SWAP);
> 1744 if (val < 0)
1745 return val;
1746
1747 val &= ~(0xf << port_offset);
1748 val |= polarity << port_offset;
1749 return __phy_package_write_mmd(phydev, 0, MDIO_MMD_VEND1,
1750 RTL8224_VND1_MDI_POLARITY_SWAP, val);
1751 }
1752
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 3/4] dt-bindings: net: realtek,rtl82xx: add a property to set MDI polarity
2026-01-22 16:51 ` Rob Herring
@ 2026-01-22 20:47 ` Damien Dejean
2026-01-22 23:06 ` Rob Herring
0 siblings, 1 reply; 11+ messages in thread
From: Damien Dejean @ 2026-01-22 20:47 UTC (permalink / raw)
To: Rob Herring
Cc: andrew, krzk+dt, netdev, devicetree, linux-kernel, edumazet,
davem, kuba, pabeni, hkallweit1
> Le 22 janv. 2026 à 17:51, Rob Herring <robh@kernel.org> a écrit :
>
> However, are these properties something that should be common?
If by common you mean « not Realtek specific » I have no idea if this kind of mapping is possible on other chips. Marvell Aquantia phys have an « order » (marvell,mdi-cfg-order) property like the one I introduced in the patch before this one (thanks Andrew), but that’s all I know.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 4/4] net: phy: realtek: add RTL8224 polarity support
2026-01-21 15:15 ` [PATCH v2 4/4] net: phy: realtek: add RTL8224 polarity support Damien Dejean
2026-01-22 18:41 ` kernel test robot
@ 2026-01-22 22:12 ` kernel test robot
1 sibling, 0 replies; 11+ messages in thread
From: kernel test robot @ 2026-01-22 22:12 UTC (permalink / raw)
To: Damien Dejean, andrew, krzk+dt
Cc: oe-kbuild-all, netdev, devicetree, linux-kernel, edumazet, davem,
kuba, pabeni, hkallweit1, Damien Dejean
Hi Damien,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 983d014aafb14ee5e4915465bf8948e8f3a723b5]
url: https://github.com/intel-lab-lkp/linux/commits/Damien-Dejean/net-phy-realtek-add-RTL8224-pair-order-support/20260122-000009
base: 983d014aafb14ee5e4915465bf8948e8f3a723b5
patch link: https://lore.kernel.org/r/20260121151506.813783-4-dam.dejean%40gmail.com
patch subject: [PATCH v2 4/4] net: phy: realtek: add RTL8224 polarity support
config: x86_64-defconfig (https://download.01.org/0day-ci/archive/20260123/202601230608.52Hf4Qza-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260123/202601230608.52Hf4Qza-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601230608.52Hf4Qza-lkp@intel.com/
All warnings (new ones prefixed by >>):
In function 'rtl8224_mdi_config_polarity',
inlined from 'rtl8224_config_init' at drivers/net/phy/realtek/realtek_main.c:1761:9:
>> drivers/net/phy/realtek/realtek_main.c:1739:12: warning: 'polarity' is used uninitialized [-Wuninitialized]
1739 | if (polarity & ~0xf)
| ^
drivers/net/phy/realtek/realtek_main.c:1727:13: note: 'polarity' was declared here
1727 | u32 polarity, val;
| ^~~~~~~~
vim +/polarity +1739 drivers/net/phy/realtek/realtek_main.c
1722
1723 static int rtl8224_mdi_config_polarity(struct phy_device *phydev)
1724 {
1725 struct device_node *np = phydev->mdio.dev.of_node;
1726 u8 port_offset = phydev->mdio.addr & 3;
1727 u32 polarity, val;
1728 int ret;
1729
1730 ret = of_property_read_u32(np, "realtek,mdi-cfg-polarity", &polarity);
1731
1732 /* Do nothing if the property is not present */
1733 if (ret == -EINVAL)
1734 return 0;
1735
1736 if (!ret)
1737 return ret;
1738
> 1739 if (polarity & ~0xf)
1740 return -EINVAL;
1741
1742 val = __phy_package_read_mmd(phydev, 0, MDIO_MMD_VEND1,
1743 RTL8224_VND1_MDI_POLARITY_SWAP);
1744 if (val < 0)
1745 return val;
1746
1747 val &= ~(0xf << port_offset);
1748 val |= polarity << port_offset;
1749 return __phy_package_write_mmd(phydev, 0, MDIO_MMD_VEND1,
1750 RTL8224_VND1_MDI_POLARITY_SWAP, val);
1751 }
1752
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 3/4] dt-bindings: net: realtek,rtl82xx: add a property to set MDI polarity
2026-01-22 20:47 ` Damien Dejean
@ 2026-01-22 23:06 ` Rob Herring
0 siblings, 0 replies; 11+ messages in thread
From: Rob Herring @ 2026-01-22 23:06 UTC (permalink / raw)
To: Damien Dejean
Cc: andrew, krzk+dt, netdev, devicetree, linux-kernel, edumazet,
davem, kuba, pabeni, hkallweit1
On Thu, Jan 22, 2026 at 2:47 PM Damien Dejean <dam.dejean@gmail.com> wrote:
>
>
> > Le 22 janv. 2026 à 17:51, Rob Herring <robh@kernel.org> a écrit :
> >
> > However, are these properties something that should be common?
>
> If by common you mean « not Realtek specific »
Yes.
> I have no idea if this kind of mapping is possible on other chips. Marvell Aquantia phys have an « order » (marvell,mdi-cfg-order) property like the one I introduced in the patch before this one (thanks Andrew), but that’s all I know.
Seems like it is.
Rob
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-01-22 23:07 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-21 15:15 [PATCH v2 1/4] dt-bindings: net: realtek,rtl82xx: add a property to set MDI order Damien Dejean
2026-01-21 15:15 ` [PATCH v2 2/4] net: phy: realtek: add RTL8224 pair order support Damien Dejean
2026-01-22 15:15 ` kernel test robot
2026-01-22 17:39 ` kernel test robot
2026-01-21 15:15 ` [PATCH v2 3/4] dt-bindings: net: realtek,rtl82xx: add a property to set MDI polarity Damien Dejean
2026-01-22 16:51 ` Rob Herring
2026-01-22 20:47 ` Damien Dejean
2026-01-22 23:06 ` Rob Herring
2026-01-21 15:15 ` [PATCH v2 4/4] net: phy: realtek: add RTL8224 polarity support Damien Dejean
2026-01-22 18:41 ` kernel test robot
2026-01-22 22:12 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox