* [PATCH v3] phy: ti: gmii-sel: Always write the RGMII ID setting
@ 2025-08-19 6:56 Michael Walle
2025-08-19 9:45 ` Maxime Chevallier
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Michael Walle @ 2025-08-19 6:56 UTC (permalink / raw)
To: Vinod Koul, Kishon Vijay Abraham I
Cc: Siddharth Vadapalli, Matthias Schiffer, Andrew Lunn, linux-phy,
linux-kernel, netdev, nm, vigneshr, Michael Walle
Some SoCs are just validated with the TX delay enabled. With commit
ca13b249f291 ("net: ethernet: ti: am65-cpsw: fixup PHY mode for fixed
RGMII TX delay"), the network driver will patch the delay setting on the
fly assuming that the TX delay setting is fixed. In reality, the TX
delay is configurable and just skipped in the documentation. There are
bootloaders, which will disable the TX delay and this will lead to a
transmit path which doesn't add any delays at all.
Fix that by always writing the RGMII_ID setting and report an error for
unsupported RGMII delay modes.
This is safe to do and shouldn't break any boards in mainline because
the fixed delay is only introduced for gmii-sel compatibles which are
used together with the am65-cpsw-nuss driver and also contains the
commit above.
Fixes: ca13b249f291 ("net: ethernet: ti: am65-cpsw: fixup PHY mode for fixed RGMII TX delay")
Signed-off-by: Michael Walle <mwalle@kernel.org>
---
v3:
- simplify the logic. Thanks Matthias.
- reworded the commit message
v2:
- reject invalid PHY modes. Thanks Matthias.
- add a paragraph to the commit message that this patch shouldn't
break any existing boards. Thanks Andrew.
drivers/phy/ti/phy-gmii-sel.c | 47 +++++++++++++++++++++++++++++------
1 file changed, 39 insertions(+), 8 deletions(-)
diff --git a/drivers/phy/ti/phy-gmii-sel.c b/drivers/phy/ti/phy-gmii-sel.c
index ff5d5e29629f..50adabb867cb 100644
--- a/drivers/phy/ti/phy-gmii-sel.c
+++ b/drivers/phy/ti/phy-gmii-sel.c
@@ -34,6 +34,7 @@ enum {
PHY_GMII_SEL_PORT_MODE = 0,
PHY_GMII_SEL_RGMII_ID_MODE,
PHY_GMII_SEL_RMII_IO_CLK_EN,
+ PHY_GMII_SEL_FIXED_TX_DELAY,
PHY_GMII_SEL_LAST,
};
@@ -127,6 +128,11 @@ static int phy_gmii_sel_mode(struct phy *phy, enum phy_mode mode, int submode)
goto unsupported;
}
+ /* With a fixed delay, some modes are not supported at all. */
+ if (soc_data->features & BIT(PHY_GMII_SEL_FIXED_TX_DELAY) &&
+ rgmii_id != 0)
+ return -EINVAL;
+
if_phy->phy_if_mode = submode;
dev_dbg(dev, "%s id:%u mode:%u rgmii_id:%d rmii_clk_ext:%d\n",
@@ -210,25 +216,46 @@ struct phy_gmii_sel_soc_data phy_gmii_sel_soc_dm814 = {
static const
struct reg_field phy_gmii_sel_fields_am654[][PHY_GMII_SEL_LAST] = {
- { [PHY_GMII_SEL_PORT_MODE] = REG_FIELD(0x0, 0, 2), },
- { [PHY_GMII_SEL_PORT_MODE] = REG_FIELD(0x4, 0, 2), },
- { [PHY_GMII_SEL_PORT_MODE] = REG_FIELD(0x8, 0, 2), },
- { [PHY_GMII_SEL_PORT_MODE] = REG_FIELD(0xC, 0, 2), },
- { [PHY_GMII_SEL_PORT_MODE] = REG_FIELD(0x10, 0, 2), },
- { [PHY_GMII_SEL_PORT_MODE] = REG_FIELD(0x14, 0, 2), },
- { [PHY_GMII_SEL_PORT_MODE] = REG_FIELD(0x18, 0, 2), },
- { [PHY_GMII_SEL_PORT_MODE] = REG_FIELD(0x1C, 0, 2), },
+ {
+ [PHY_GMII_SEL_PORT_MODE] = REG_FIELD(0x0, 0, 2),
+ [PHY_GMII_SEL_RGMII_ID_MODE] = REG_FIELD(0x0, 4, 4),
+ }, {
+ [PHY_GMII_SEL_PORT_MODE] = REG_FIELD(0x4, 0, 2),
+ [PHY_GMII_SEL_RGMII_ID_MODE] = REG_FIELD(0x4, 4, 4),
+ }, {
+ [PHY_GMII_SEL_PORT_MODE] = REG_FIELD(0x8, 0, 2),
+ [PHY_GMII_SEL_RGMII_ID_MODE] = REG_FIELD(0x8, 4, 4),
+ }, {
+ [PHY_GMII_SEL_PORT_MODE] = REG_FIELD(0xC, 0, 2),
+ [PHY_GMII_SEL_RGMII_ID_MODE] = REG_FIELD(0xC, 4, 4),
+ }, {
+ [PHY_GMII_SEL_PORT_MODE] = REG_FIELD(0x10, 0, 2),
+ [PHY_GMII_SEL_RGMII_ID_MODE] = REG_FIELD(0x10, 4, 4),
+ }, {
+ [PHY_GMII_SEL_PORT_MODE] = REG_FIELD(0x14, 0, 2),
+ [PHY_GMII_SEL_RGMII_ID_MODE] = REG_FIELD(0x14, 4, 4),
+ }, {
+ [PHY_GMII_SEL_PORT_MODE] = REG_FIELD(0x18, 0, 2),
+ [PHY_GMII_SEL_RGMII_ID_MODE] = REG_FIELD(0x18, 4, 4),
+ }, {
+ [PHY_GMII_SEL_PORT_MODE] = REG_FIELD(0x1C, 0, 2),
+ [PHY_GMII_SEL_RGMII_ID_MODE] = REG_FIELD(0x1C, 4, 4),
+ },
};
static const
struct phy_gmii_sel_soc_data phy_gmii_sel_soc_am654 = {
.use_of_data = true,
+ .features = BIT(PHY_GMII_SEL_RGMII_ID_MODE) |
+ BIT(PHY_GMII_SEL_FIXED_TX_DELAY),
.regfields = phy_gmii_sel_fields_am654,
};
static const
struct phy_gmii_sel_soc_data phy_gmii_sel_cpsw5g_soc_j7200 = {
.use_of_data = true,
+ .features = BIT(PHY_GMII_SEL_RGMII_ID_MODE) |
+ BIT(PHY_GMII_SEL_FIXED_TX_DELAY),
.regfields = phy_gmii_sel_fields_am654,
.extra_modes = BIT(PHY_INTERFACE_MODE_QSGMII) | BIT(PHY_INTERFACE_MODE_SGMII) |
BIT(PHY_INTERFACE_MODE_USXGMII),
@@ -239,6 +266,8 @@ struct phy_gmii_sel_soc_data phy_gmii_sel_cpsw5g_soc_j7200 = {
static const
struct phy_gmii_sel_soc_data phy_gmii_sel_cpsw9g_soc_j721e = {
.use_of_data = true,
+ .features = BIT(PHY_GMII_SEL_RGMII_ID_MODE) |
+ BIT(PHY_GMII_SEL_FIXED_TX_DELAY),
.regfields = phy_gmii_sel_fields_am654,
.extra_modes = BIT(PHY_INTERFACE_MODE_QSGMII) | BIT(PHY_INTERFACE_MODE_SGMII),
.num_ports = 8,
@@ -248,6 +277,8 @@ struct phy_gmii_sel_soc_data phy_gmii_sel_cpsw9g_soc_j721e = {
static const
struct phy_gmii_sel_soc_data phy_gmii_sel_cpsw9g_soc_j784s4 = {
.use_of_data = true,
+ .features = BIT(PHY_GMII_SEL_RGMII_ID_MODE) |
+ BIT(PHY_GMII_SEL_FIXED_TX_DELAY),
.regfields = phy_gmii_sel_fields_am654,
.extra_modes = BIT(PHY_INTERFACE_MODE_QSGMII) | BIT(PHY_INTERFACE_MODE_SGMII) |
BIT(PHY_INTERFACE_MODE_USXGMII),
--
2.39.5
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3] phy: ti: gmii-sel: Always write the RGMII ID setting
2025-08-19 6:56 [PATCH v3] phy: ti: gmii-sel: Always write the RGMII ID setting Michael Walle
@ 2025-08-19 9:45 ` Maxime Chevallier
2025-08-22 1:18 ` Jakub Kicinski
2025-09-01 17:03 ` Vinod Koul
2 siblings, 0 replies; 6+ messages in thread
From: Maxime Chevallier @ 2025-08-19 9:45 UTC (permalink / raw)
To: Michael Walle, Vinod Koul, Kishon Vijay Abraham I
Cc: Siddharth Vadapalli, Matthias Schiffer, Andrew Lunn, linux-phy,
linux-kernel, netdev, nm, vigneshr
On 19/08/2025 08:56, Michael Walle wrote:
> Some SoCs are just validated with the TX delay enabled. With commit
> ca13b249f291 ("net: ethernet: ti: am65-cpsw: fixup PHY mode for fixed
> RGMII TX delay"), the network driver will patch the delay setting on the
> fly assuming that the TX delay setting is fixed. In reality, the TX
> delay is configurable and just skipped in the documentation. There are
> bootloaders, which will disable the TX delay and this will lead to a
> transmit path which doesn't add any delays at all.
> Fix that by always writing the RGMII_ID setting and report an error for
> unsupported RGMII delay modes.
>
> This is safe to do and shouldn't break any boards in mainline because
> the fixed delay is only introduced for gmii-sel compatibles which are
> used together with the am65-cpsw-nuss driver and also contains the
> commit above.
>
> Fixes: ca13b249f291 ("net: ethernet: ti: am65-cpsw: fixup PHY mode for fixed RGMII TX delay")
> Signed-off-by: Michael Walle <mwalle@kernel.org>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Maxime
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3] phy: ti: gmii-sel: Always write the RGMII ID setting
2025-08-19 6:56 [PATCH v3] phy: ti: gmii-sel: Always write the RGMII ID setting Michael Walle
2025-08-19 9:45 ` Maxime Chevallier
@ 2025-08-22 1:18 ` Jakub Kicinski
2025-08-22 6:45 ` Michael Walle
2025-09-01 17:03 ` Vinod Koul
2 siblings, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2025-08-22 1:18 UTC (permalink / raw)
To: Michael Walle
Cc: Vinod Koul, Kishon Vijay Abraham I, Siddharth Vadapalli,
Matthias Schiffer, Andrew Lunn, linux-phy, linux-kernel, netdev,
nm, vigneshr
On Tue, 19 Aug 2025 08:56:22 +0200 Michael Walle wrote:
> v3:
> - simplify the logic. Thanks Matthias.
> - reworded the commit message
This was set to Not Applicable in our patchwork, IDK why.
Could you resend?
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3] phy: ti: gmii-sel: Always write the RGMII ID setting
2025-08-22 1:18 ` Jakub Kicinski
@ 2025-08-22 6:45 ` Michael Walle
2025-08-22 14:01 ` Jakub Kicinski
0 siblings, 1 reply; 6+ messages in thread
From: Michael Walle @ 2025-08-22 6:45 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Vinod Koul, Kishon Vijay Abraham I, Siddharth Vadapalli,
Matthias Schiffer, Andrew Lunn, linux-phy, linux-kernel, netdev,
nm, vigneshr
[-- Attachment #1.1: Type: text/plain, Size: 369 bytes --]
Hi,
On Fri Aug 22, 2025 at 3:18 AM CEST, Jakub Kicinski wrote:
> On Tue, 19 Aug 2025 08:56:22 +0200 Michael Walle wrote:
> > v3:
> > - simplify the logic. Thanks Matthias.
> > - reworded the commit message
>
> This was set to Not Applicable in our patchwork, IDK why.
> Could you resend?
Won't this patch be picked up by the linux-phy tree?
-michael
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
[-- Attachment #2: Type: text/plain, Size: 112 bytes --]
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3] phy: ti: gmii-sel: Always write the RGMII ID setting
2025-08-22 6:45 ` Michael Walle
@ 2025-08-22 14:01 ` Jakub Kicinski
0 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2025-08-22 14:01 UTC (permalink / raw)
To: Michael Walle
Cc: Vinod Koul, Kishon Vijay Abraham I, Siddharth Vadapalli,
Matthias Schiffer, Andrew Lunn, linux-phy, linux-kernel, netdev,
nm, vigneshr
On Fri, 22 Aug 2025 08:45:33 +0200 Michael Walle wrote:
> On Fri Aug 22, 2025 at 3:18 AM CEST, Jakub Kicinski wrote:
> > On Tue, 19 Aug 2025 08:56:22 +0200 Michael Walle wrote:
> > > v3:
> > > - simplify the logic. Thanks Matthias.
> > > - reworded the commit message
> >
> > This was set to Not Applicable in our patchwork, IDK why.
> > Could you resend?
>
> Won't this patch be picked up by the linux-phy tree?
Ah, poops, you're right! Let me adjust our filters..
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3] phy: ti: gmii-sel: Always write the RGMII ID setting
2025-08-19 6:56 [PATCH v3] phy: ti: gmii-sel: Always write the RGMII ID setting Michael Walle
2025-08-19 9:45 ` Maxime Chevallier
2025-08-22 1:18 ` Jakub Kicinski
@ 2025-09-01 17:03 ` Vinod Koul
2 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2025-09-01 17:03 UTC (permalink / raw)
To: Kishon Vijay Abraham I, Michael Walle
Cc: Siddharth Vadapalli, Matthias Schiffer, Andrew Lunn, linux-phy,
linux-kernel, netdev, nm, vigneshr
On Tue, 19 Aug 2025 08:56:22 +0200, Michael Walle wrote:
> Some SoCs are just validated with the TX delay enabled. With commit
> ca13b249f291 ("net: ethernet: ti: am65-cpsw: fixup PHY mode for fixed
> RGMII TX delay"), the network driver will patch the delay setting on the
> fly assuming that the TX delay setting is fixed. In reality, the TX
> delay is configurable and just skipped in the documentation. There are
> bootloaders, which will disable the TX delay and this will lead to a
> transmit path which doesn't add any delays at all.
> Fix that by always writing the RGMII_ID setting and report an error for
> unsupported RGMII delay modes.
>
> [...]
Applied, thanks!
[1/1] phy: ti: gmii-sel: Always write the RGMII ID setting
commit: a22d3b0d49d411e64ed07e30c2095035ecb30ed2
Best regards,
--
~Vinod
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-09-02 0:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-19 6:56 [PATCH v3] phy: ti: gmii-sel: Always write the RGMII ID setting Michael Walle
2025-08-19 9:45 ` Maxime Chevallier
2025-08-22 1:18 ` Jakub Kicinski
2025-08-22 6:45 ` Michael Walle
2025-08-22 14:01 ` Jakub Kicinski
2025-09-01 17:03 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).