* [PATCH v5 net-next 0/2] make PHY output RMII reference clock
@ 2024-10-10 6:19 Wei Fang
2024-10-10 6:19 ` [PATCH v5 net-next 1/2] dt-bindings: net: tja11xx: add "nxp,rmii-refclk-out" property Wei Fang
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Wei Fang @ 2024-10-10 6:19 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, robh, krzk+dt, conor+dt, andrew,
f.fainelli, hkallweit1, andrei.botila, linux, horms
Cc: devicetree, linux-kernel, netdev, imx
The TJA11xx PHYs have the capability to provide 50MHz reference clock
in RMII mode and output on REF_CLK pin. Therefore, add the new property
"nxp,rmii-refclk-output" to support this feature. This property is only
available for PHYs which use nxp-c45-tja11xx driver, such as TJA1103,
TJA1104, TJA1120 and TJA1121.
---
v2 Link: https://lore.kernel.org/netdev/20240823-jersey-conducive-70863dd6fd27@spud/T/
v3 Link: https://lore.kernel.org/imx/20240826052700.232453-1-wei.fang@nxp.com/
v4 Link: https://lore.kernel.org/netdev/20241009151223.GA522364-robh@kernel.org/T/
---
Wei Fang (2):
dt-bindings: net: tja11xx: add "nxp,rmii-refclk-out" property
net: phy: c45-tja11xx: add support for outputting RMII reference clock
.../devicetree/bindings/net/nxp,tja11xx.yaml | 16 ++++++++++
drivers/net/phy/nxp-c45-tja11xx.c | 30 ++++++++++++++++++-
drivers/net/phy/nxp-c45-tja11xx.h | 1 +
3 files changed, 46 insertions(+), 1 deletion(-)
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v5 net-next 1/2] dt-bindings: net: tja11xx: add "nxp,rmii-refclk-out" property
2024-10-10 6:19 [PATCH v5 net-next 0/2] make PHY output RMII reference clock Wei Fang
@ 2024-10-10 6:19 ` Wei Fang
2024-10-10 18:00 ` Rob Herring (Arm)
2024-10-10 6:19 ` [PATCH v5 net-next 2/2] net: phy: c45-tja11xx: add support for outputting RMII reference clock Wei Fang
2024-10-15 9:20 ` [PATCH v5 net-next 0/2] make PHY output " patchwork-bot+netdevbpf
2 siblings, 1 reply; 5+ messages in thread
From: Wei Fang @ 2024-10-10 6:19 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, robh, krzk+dt, conor+dt, andrew,
f.fainelli, hkallweit1, andrei.botila, linux, horms
Cc: devicetree, linux-kernel, netdev, imx
Per the RMII specification, the REF_CLK is sourced from MAC to PHY
or from an external source. But for TJA11xx PHYs, they support to
output a 50MHz RMII reference clock on REF_CLK pin. Previously the
"nxp,rmii-refclk-in" was added to indicate that in RMII mode, if
this property present, REF_CLK is input to the PHY, otherwise it
is output. This seems inappropriate now. Because according to the
RMII specification, the REF_CLK is originally input, so there is
no need to add an additional "nxp,rmii-refclk-in" property to
declare that REF_CLK is input.
Unfortunately, because the "nxp,rmii-refclk-in" property has been
added for a while, and we cannot confirm which DTS use the TJA1100
and TJA1101 PHYs, changing it to switch polarity will cause an ABI
break. But fortunately, this property is only valid for TJA1100 and
TJA1101. For TJA1103/TJA1104/TJA1120/TJA1121 PHYs, this property is
invalid because they use the nxp-c45-tja11xx driver, which is a
different driver from TJA1100/TJA1101. Therefore, for PHYs using
nxp-c45-tja11xx driver, add "nxp,rmii-refclk-out" property to
support outputting RMII reference clock on REF_CLK pin.
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
V2 changes:
1. Change the property name from "nxp,reverse-mode" to
"nxp,phy-output-refclk".
2. Simplify the description of the property.
3. Modify the subject and commit message.
V3 changes:
1. Keep the "nxp,rmii-refclk-in" property for TJA1100 and TJA1101.
2. Rephrase the commit message and subject.
V4 changes:
1. Change the property name from "nxp,phy-output-refclk" to
"nxp,rmii-refclk-out", which means the opposite of "nxp,rmii-refclk-in".
2. Refactor the patch after fixing the original issue with this YAML.
V5 changes:
1. Reword the description of "nxp,rmii-refclk-out" property.
---
.../devicetree/bindings/net/nxp,tja11xx.yaml | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml b/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml
index a754a61adc2d..5f9f7efff538 100644
--- a/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml
+++ b/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml
@@ -62,6 +62,22 @@ allOf:
reference clock output when RMII mode enabled.
Only supported on TJA1100 and TJA1101.
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - ethernet-phy-id001b.b010
+ - ethernet-phy-id001b.b013
+ - ethernet-phy-id001b.b030
+ - ethernet-phy-id001b.b031
+
+ then:
+ properties:
+ nxp,rmii-refclk-out:
+ type: boolean
+ description: Enable 50MHz RMII reference clock output on REF_CLK pin.
+
patternProperties:
"^ethernet-phy@[0-9a-f]+$":
type: object
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v5 net-next 2/2] net: phy: c45-tja11xx: add support for outputting RMII reference clock
2024-10-10 6:19 [PATCH v5 net-next 0/2] make PHY output RMII reference clock Wei Fang
2024-10-10 6:19 ` [PATCH v5 net-next 1/2] dt-bindings: net: tja11xx: add "nxp,rmii-refclk-out" property Wei Fang
@ 2024-10-10 6:19 ` Wei Fang
2024-10-15 9:20 ` [PATCH v5 net-next 0/2] make PHY output " patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: Wei Fang @ 2024-10-10 6:19 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, robh, krzk+dt, conor+dt, andrew,
f.fainelli, hkallweit1, andrei.botila, linux, horms
Cc: devicetree, linux-kernel, netdev, imx
For TJA11xx PHYs, they have the capability to output 50MHz reference
clock on REF_CLK pin in RMII mode, which is called "revRMII" mode in
the PHY data sheet.
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
V2 changes:
1. Change the property name.
2. Modify the subject and commit message.
V3 changes:
No changes.
V4 changes:
1. Change the property name based on patch 1.
V5 changes:
1. Fix a typo in the title.
2. Based on Russel's suggestion, add comment to MII_BASIC_CONFIG_REV
and the basic_config variable to make the code clearer.
---
drivers/net/phy/nxp-c45-tja11xx.c | 30 +++++++++++++++++++++++++++++-
drivers/net/phy/nxp-c45-tja11xx.h | 1 +
2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/nxp-c45-tja11xx.c b/drivers/net/phy/nxp-c45-tja11xx.c
index 5af5ade4fc64..7e328c2a29a4 100644
--- a/drivers/net/phy/nxp-c45-tja11xx.c
+++ b/drivers/net/phy/nxp-c45-tja11xx.c
@@ -10,6 +10,7 @@
#include <linux/kernel.h>
#include <linux/mii.h>
#include <linux/module.h>
+#include <linux/of.h>
#include <linux/phy.h>
#include <linux/processor.h>
#include <linux/property.h>
@@ -185,6 +186,8 @@
#define NXP_C45_SKB_CB(skb) ((struct nxp_c45_skb_cb *)(skb)->cb)
+#define TJA11XX_REVERSE_MODE BIT(0)
+
struct nxp_c45_phy;
struct nxp_c45_skb_cb {
@@ -1510,6 +1513,8 @@ static int nxp_c45_get_delays(struct phy_device *phydev)
static int nxp_c45_set_phy_mode(struct phy_device *phydev)
{
+ struct nxp_c45_phy *priv = phydev->priv;
+ u16 basic_config;
int ret;
ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, VEND1_ABILITIES);
@@ -1561,8 +1566,15 @@ static int nxp_c45_set_phy_mode(struct phy_device *phydev)
phydev_err(phydev, "rmii mode not supported\n");
return -EINVAL;
}
+
+ basic_config = MII_BASIC_CONFIG_RMII;
+
+ /* This is not PHY_INTERFACE_MODE_REVRMII */
+ if (priv->flags & TJA11XX_REVERSE_MODE)
+ basic_config |= MII_BASIC_CONFIG_REV;
+
phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_MII_BASIC_CONFIG,
- MII_BASIC_CONFIG_RMII);
+ basic_config);
break;
case PHY_INTERFACE_MODE_SGMII:
if (!(ret & SGMII_ABILITY)) {
@@ -1623,6 +1635,20 @@ static int nxp_c45_get_features(struct phy_device *phydev)
return genphy_c45_pma_read_abilities(phydev);
}
+static int nxp_c45_parse_dt(struct phy_device *phydev)
+{
+ struct device_node *node = phydev->mdio.dev.of_node;
+ struct nxp_c45_phy *priv = phydev->priv;
+
+ if (!IS_ENABLED(CONFIG_OF_MDIO))
+ return 0;
+
+ if (of_property_read_bool(node, "nxp,rmii-refclk-out"))
+ priv->flags |= TJA11XX_REVERSE_MODE;
+
+ return 0;
+}
+
static int nxp_c45_probe(struct phy_device *phydev)
{
struct nxp_c45_phy *priv;
@@ -1642,6 +1668,8 @@ static int nxp_c45_probe(struct phy_device *phydev)
phydev->priv = priv;
+ nxp_c45_parse_dt(phydev);
+
mutex_init(&priv->ptp_lock);
phy_abilities = phy_read_mmd(phydev, MDIO_MMD_VEND1,
diff --git a/drivers/net/phy/nxp-c45-tja11xx.h b/drivers/net/phy/nxp-c45-tja11xx.h
index f364fca68f0b..8b5fc383752b 100644
--- a/drivers/net/phy/nxp-c45-tja11xx.h
+++ b/drivers/net/phy/nxp-c45-tja11xx.h
@@ -28,6 +28,7 @@ struct nxp_c45_phy {
int extts_index;
bool extts;
struct nxp_c45_macsec *macsec;
+ u32 flags;
};
#if IS_ENABLED(CONFIG_MACSEC)
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v5 net-next 1/2] dt-bindings: net: tja11xx: add "nxp,rmii-refclk-out" property
2024-10-10 6:19 ` [PATCH v5 net-next 1/2] dt-bindings: net: tja11xx: add "nxp,rmii-refclk-out" property Wei Fang
@ 2024-10-10 18:00 ` Rob Herring (Arm)
0 siblings, 0 replies; 5+ messages in thread
From: Rob Herring (Arm) @ 2024-10-10 18:00 UTC (permalink / raw)
To: Wei Fang
Cc: linux, linux-kernel, conor+dt, krzk+dt, andrew, andrei.botila,
horms, devicetree, kuba, imx, davem, pabeni, hkallweit1, edumazet,
netdev, f.fainelli
On Thu, 10 Oct 2024 14:19:43 +0800, Wei Fang wrote:
> Per the RMII specification, the REF_CLK is sourced from MAC to PHY
> or from an external source. But for TJA11xx PHYs, they support to
> output a 50MHz RMII reference clock on REF_CLK pin. Previously the
> "nxp,rmii-refclk-in" was added to indicate that in RMII mode, if
> this property present, REF_CLK is input to the PHY, otherwise it
> is output. This seems inappropriate now. Because according to the
> RMII specification, the REF_CLK is originally input, so there is
> no need to add an additional "nxp,rmii-refclk-in" property to
> declare that REF_CLK is input.
> Unfortunately, because the "nxp,rmii-refclk-in" property has been
> added for a while, and we cannot confirm which DTS use the TJA1100
> and TJA1101 PHYs, changing it to switch polarity will cause an ABI
> break. But fortunately, this property is only valid for TJA1100 and
> TJA1101. For TJA1103/TJA1104/TJA1120/TJA1121 PHYs, this property is
> invalid because they use the nxp-c45-tja11xx driver, which is a
> different driver from TJA1100/TJA1101. Therefore, for PHYs using
> nxp-c45-tja11xx driver, add "nxp,rmii-refclk-out" property to
> support outputting RMII reference clock on REF_CLK pin.
>
> Signed-off-by: Wei Fang <wei.fang@nxp.com>
> ---
> V2 changes:
> 1. Change the property name from "nxp,reverse-mode" to
> "nxp,phy-output-refclk".
> 2. Simplify the description of the property.
> 3. Modify the subject and commit message.
> V3 changes:
> 1. Keep the "nxp,rmii-refclk-in" property for TJA1100 and TJA1101.
> 2. Rephrase the commit message and subject.
> V4 changes:
> 1. Change the property name from "nxp,phy-output-refclk" to
> "nxp,rmii-refclk-out", which means the opposite of "nxp,rmii-refclk-in".
> 2. Refactor the patch after fixing the original issue with this YAML.
> V5 changes:
> 1. Reword the description of "nxp,rmii-refclk-out" property.
> ---
> .../devicetree/bindings/net/nxp,tja11xx.yaml | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v5 net-next 0/2] make PHY output RMII reference clock
2024-10-10 6:19 [PATCH v5 net-next 0/2] make PHY output RMII reference clock Wei Fang
2024-10-10 6:19 ` [PATCH v5 net-next 1/2] dt-bindings: net: tja11xx: add "nxp,rmii-refclk-out" property Wei Fang
2024-10-10 6:19 ` [PATCH v5 net-next 2/2] net: phy: c45-tja11xx: add support for outputting RMII reference clock Wei Fang
@ 2024-10-15 9:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-15 9:20 UTC (permalink / raw)
To: Wei Fang
Cc: davem, edumazet, kuba, pabeni, robh, krzk+dt, conor+dt, andrew,
f.fainelli, hkallweit1, andrei.botila, linux, horms, devicetree,
linux-kernel, netdev, imx
Hello:
This series was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Thu, 10 Oct 2024 14:19:42 +0800 you wrote:
> The TJA11xx PHYs have the capability to provide 50MHz reference clock
> in RMII mode and output on REF_CLK pin. Therefore, add the new property
> "nxp,rmii-refclk-output" to support this feature. This property is only
> available for PHYs which use nxp-c45-tja11xx driver, such as TJA1103,
> TJA1104, TJA1120 and TJA1121.
>
>
> [...]
Here is the summary with links:
- [v5,net-next,1/2] dt-bindings: net: tja11xx: add "nxp,rmii-refclk-out" property
https://git.kernel.org/netdev/net-next/c/09277e4fc9a6
- [v5,net-next,2/2] net: phy: c45-tja11xx: add support for outputting RMII reference clock
https://git.kernel.org/netdev/net-next/c/6d8d89873ae0
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-10-15 9:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-10 6:19 [PATCH v5 net-next 0/2] make PHY output RMII reference clock Wei Fang
2024-10-10 6:19 ` [PATCH v5 net-next 1/2] dt-bindings: net: tja11xx: add "nxp,rmii-refclk-out" property Wei Fang
2024-10-10 18:00 ` Rob Herring (Arm)
2024-10-10 6:19 ` [PATCH v5 net-next 2/2] net: phy: c45-tja11xx: add support for outputting RMII reference clock Wei Fang
2024-10-15 9:20 ` [PATCH v5 net-next 0/2] make PHY output " patchwork-bot+netdevbpf
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).