* [PATCH net-next 0/3] add "nxp,reverse-mode" to instead of "nxp,rmii-refclk-in"
@ 2024-08-15 5:51 Wei Fang
2024-08-15 5:51 ` [PATCH net-next 1/3] dt-bindings: net: tja11xx: use reverse-mode to instead of rmii-refclk-in Wei Fang
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: Wei Fang @ 2024-08-15 5:51 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, robh, krzk+dt, conor+dt, andrew,
f.fainelli, hkallweit1, linux, andrei.botila
Cc: netdev, devicetree, linux-kernel
The TJA11xx PHYs support reverse mode so that TX_CLK and RX_CLK can
be set to input in revMII mode and REF_CLK can be set to output in
revRMII mode. Therefore, add the new property "nxp,reverse-mode" to
instead of the "nxp,rmii-refclk-in" property, which is more generic
and reasonable.
Wei Fang (3):
dt-bindings: net: tja11xx: use reverse-mode to instead of
rmii-refclk-in
net: phy: tja11xx: replace "nxp,rmii-refclk-in" with
"nxp,reverse-mode"
net: phy: c45-tja11xx: add revRMII mode support
.../devicetree/bindings/net/nxp,tja11xx.yaml | 21 +++++---------
drivers/net/phy/nxp-c45-tja11xx.c | 29 +++++++++++++++++--
drivers/net/phy/nxp-c45-tja11xx.h | 1 +
drivers/net/phy/nxp-tja11xx.c | 13 ++++-----
4 files changed, 41 insertions(+), 23 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH net-next 1/3] dt-bindings: net: tja11xx: use reverse-mode to instead of rmii-refclk-in
2024-08-15 5:51 [PATCH net-next 0/3] add "nxp,reverse-mode" to instead of "nxp,rmii-refclk-in" Wei Fang
@ 2024-08-15 5:51 ` Wei Fang
2024-08-15 14:33 ` Andrew Lunn
2024-08-15 5:51 ` [PATCH net-next 2/3] net: phy: tja11xx: replace "nxp,rmii-refclk-in" with "nxp,reverse-mode" Wei Fang
2024-08-15 5:51 ` [PATCH net-next 3/3] net: phy: c45-tja11xx: add revRMII mode support Wei Fang
2 siblings, 1 reply; 14+ messages in thread
From: Wei Fang @ 2024-08-15 5:51 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, robh, krzk+dt, conor+dt, andrew,
f.fainelli, hkallweit1, linux, andrei.botila
Cc: netdev, devicetree, linux-kernel
Per the MII and RMII specifications, for the standard RMII mode,
the REF_CLK is sourced from MAC to PHY or from an external source.
For the standard MII mode, the RX_CLK and TX_CLK are both sourced
by the PHY. But for TJA11xx PHYs, they support reverse mode, that
is, for revRMII mode, the REF_CLK is output, and for revMII mode,
the TX_CLK and RX_CLK are inputs to the PHY.
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. Firstly, for
the standard RMII mode, REF_CLK is originally input, and there is
no need to add the "nxp,rmii-refclk-in" property to indicate that
REF_CLK is input. Secondly, this property is not generic for TJA
PHYs, because it cannot cover the settings of TX_CLK and RX_CLK in
MII mode. Therefore, add new property "nxp,reverse-mode" to instead
of the "nxp,rmii-refclk-in" property.
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
.../devicetree/bindings/net/nxp,tja11xx.yaml | 21 +++++++------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml b/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml
index 85bfa45f5122..e8ab2cf8d4d4 100644
--- a/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml
+++ b/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml
@@ -32,21 +32,14 @@ patternProperties:
description:
The ID number for the child PHY. Should be +1 of parent PHY.
- nxp,rmii-refclk-in:
+ nxp,reverse-mode:
type: boolean
description: |
- The REF_CLK is provided for both transmitted and received data
- in RMII mode. This clock signal is provided by the PHY and is
- typically derived from an external 25MHz crystal. Alternatively,
- a 50MHz clock signal generated by an external oscillator can be
- connected to pin REF_CLK. A third option is to connect a 25MHz
- clock to pin CLK_IN_OUT. So, the REF_CLK should be configured
- as input or output according to the actual circuit connection.
- If present, indicates that the REF_CLK will be configured as
- interface reference clock input when RMII mode enabled.
- If not present, the REF_CLK will be configured as interface
- reference clock output when RMII mode enabled.
- Only supported on TJA1100 and TJA1101.
+ If present, the TJA11xx PHY will operate in "reversed" role mode.
+ If XMII_MODE is set to MII, the device operates in revMII mode
+ (TXCLK and RXCLK are input).
+ If XMII_MODE is set to RMII, the device operates in revRMII mode
+ (REF_CLK is output).
required:
- reg
@@ -61,7 +54,7 @@ examples:
tja1101_phy0: ethernet-phy@4 {
reg = <0x4>;
- nxp,rmii-refclk-in;
+ nxp,reverse-mode;
};
};
- |
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH net-next 2/3] net: phy: tja11xx: replace "nxp,rmii-refclk-in" with "nxp,reverse-mode"
2024-08-15 5:51 [PATCH net-next 0/3] add "nxp,reverse-mode" to instead of "nxp,rmii-refclk-in" Wei Fang
2024-08-15 5:51 ` [PATCH net-next 1/3] dt-bindings: net: tja11xx: use reverse-mode to instead of rmii-refclk-in Wei Fang
@ 2024-08-15 5:51 ` Wei Fang
2024-08-15 13:37 ` Simon Horman
2024-08-15 5:51 ` [PATCH net-next 3/3] net: phy: c45-tja11xx: add revRMII mode support Wei Fang
2 siblings, 1 reply; 14+ messages in thread
From: Wei Fang @ 2024-08-15 5:51 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, robh, krzk+dt, conor+dt, andrew,
f.fainelli, hkallweit1, linux, andrei.botila
Cc: netdev, devicetree, linux-kernel
As the new property "nxp,reverse-mode" is added to instead of the
"nxp,rmii-refclk-in" property, so replace the "nxp,rmii-refclk-in"
property used in the driver with the "nxp,reverse-mode" property
and make slight modifications.
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
drivers/net/phy/nxp-tja11xx.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/net/phy/nxp-tja11xx.c b/drivers/net/phy/nxp-tja11xx.c
index 2c263ae44b4f..a3721f91689b 100644
--- a/drivers/net/phy/nxp-tja11xx.c
+++ b/drivers/net/phy/nxp-tja11xx.c
@@ -78,8 +78,7 @@
#define MII_COMMCFG 27
#define MII_COMMCFG_AUTO_OP BIT(15)
-/* Configure REF_CLK as input in RMII mode */
-#define TJA110X_RMII_MODE_REFCLK_IN BIT(0)
+#define TJA11XX_REVERSE_MODE BIT(0)
struct tja11xx_priv {
char *hwmon_name;
@@ -274,10 +273,10 @@ static int tja11xx_get_interface_mode(struct phy_device *phydev)
mii_mode = MII_CFG1_REVMII_MODE;
break;
case PHY_INTERFACE_MODE_RMII:
- if (priv->flags & TJA110X_RMII_MODE_REFCLK_IN)
- mii_mode = MII_CFG1_RMII_MODE_REFCLK_IN;
- else
+ if (priv->flags & TJA11XX_REVERSE_MODE)
mii_mode = MII_CFG1_RMII_MODE_REFCLK_OUT;
+ else
+ mii_mode = MII_CFG1_RMII_MODE_REFCLK_IN;
break;
default:
return -EINVAL;
@@ -517,8 +516,8 @@ static int tja11xx_parse_dt(struct phy_device *phydev)
if (!IS_ENABLED(CONFIG_OF_MDIO))
return 0;
- if (of_property_read_bool(node, "nxp,rmii-refclk-in"))
- priv->flags |= TJA110X_RMII_MODE_REFCLK_IN;
+ if (of_property_read_bool(node, "nxp,reverse-mode"))
+ priv->flags |= TJA11XX_REVERSE_MODE;
return 0;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH net-next 3/3] net: phy: c45-tja11xx: add revRMII mode support
2024-08-15 5:51 [PATCH net-next 0/3] add "nxp,reverse-mode" to instead of "nxp,rmii-refclk-in" Wei Fang
2024-08-15 5:51 ` [PATCH net-next 1/3] dt-bindings: net: tja11xx: use reverse-mode to instead of rmii-refclk-in Wei Fang
2024-08-15 5:51 ` [PATCH net-next 2/3] net: phy: tja11xx: replace "nxp,rmii-refclk-in" with "nxp,reverse-mode" Wei Fang
@ 2024-08-15 5:51 ` Wei Fang
2 siblings, 0 replies; 14+ messages in thread
From: Wei Fang @ 2024-08-15 5:51 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, robh, krzk+dt, conor+dt, andrew,
f.fainelli, hkallweit1, linux, andrei.botila
Cc: netdev, devicetree, linux-kernel
For TJA11xx PHYs, they have the capability to make REF_CLK as output
in RMII mode, which is called revRMII mode in the data sheet, so add
the revRMII mode support.
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
drivers/net/phy/nxp-c45-tja11xx.c | 29 +++++++++++++++++++++++++++--
drivers/net/phy/nxp-c45-tja11xx.h | 1 +
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/nxp-c45-tja11xx.c b/drivers/net/phy/nxp-c45-tja11xx.c
index 5af5ade4fc64..571ecdbd49d9 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,7 @@ 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;
int ret;
ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, VEND1_ABILITIES);
@@ -1561,8 +1565,13 @@ static int nxp_c45_set_phy_mode(struct phy_device *phydev)
phydev_err(phydev, "rmii mode not supported\n");
return -EINVAL;
}
- phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_MII_BASIC_CONFIG,
- MII_BASIC_CONFIG_RMII);
+
+ if (priv->flags & TJA11XX_REVERSE_MODE)
+ phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_MII_BASIC_CONFIG,
+ MII_BASIC_CONFIG_RMII | MII_BASIC_CONFIG_REV);
+ else
+ phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_MII_BASIC_CONFIG,
+ MII_BASIC_CONFIG_RMII);
break;
case PHY_INTERFACE_MODE_SGMII:
if (!(ret & SGMII_ABILITY)) {
@@ -1623,6 +1632,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,reverse-mode"))
+ priv->flags |= TJA11XX_REVERSE_MODE;
+
+ return 0;
+}
+
static int nxp_c45_probe(struct phy_device *phydev)
{
struct nxp_c45_phy *priv;
@@ -1642,6 +1665,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] 14+ messages in thread
* Re: [PATCH net-next 2/3] net: phy: tja11xx: replace "nxp,rmii-refclk-in" with "nxp,reverse-mode"
2024-08-15 5:51 ` [PATCH net-next 2/3] net: phy: tja11xx: replace "nxp,rmii-refclk-in" with "nxp,reverse-mode" Wei Fang
@ 2024-08-15 13:37 ` Simon Horman
0 siblings, 0 replies; 14+ messages in thread
From: Simon Horman @ 2024-08-15 13:37 UTC (permalink / raw)
To: Wei Fang
Cc: davem, edumazet, kuba, pabeni, robh, krzk+dt, conor+dt, andrew,
f.fainelli, hkallweit1, linux, andrei.botila, netdev, devicetree,
linux-kernel
On Thu, Aug 15, 2024 at 01:51:25PM +0800, Wei Fang wrote:
> As the new property "nxp,reverse-mode" is added to instead of the
> "nxp,rmii-refclk-in" property, so replace the "nxp,rmii-refclk-in"
> property used in the driver with the "nxp,reverse-mode" property
> and make slight modifications.
>
> Signed-off-by: Wei Fang <wei.fang@nxp.com>
> ---
> drivers/net/phy/nxp-tja11xx.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/phy/nxp-tja11xx.c b/drivers/net/phy/nxp-tja11xx.c
> index 2c263ae44b4f..a3721f91689b 100644
> --- a/drivers/net/phy/nxp-tja11xx.c
> +++ b/drivers/net/phy/nxp-tja11xx.c
> @@ -78,8 +78,7 @@
> #define MII_COMMCFG 27
> #define MII_COMMCFG_AUTO_OP BIT(15)
>
> -/* Configure REF_CLK as input in RMII mode */
> -#define TJA110X_RMII_MODE_REFCLK_IN BIT(0)
> +#define TJA11XX_REVERSE_MODE BIT(0)
>
> struct tja11xx_priv {
> char *hwmon_name;
> @@ -274,10 +273,10 @@ static int tja11xx_get_interface_mode(struct phy_device *phydev)
> mii_mode = MII_CFG1_REVMII_MODE;
> break;
> case PHY_INTERFACE_MODE_RMII:
> - if (priv->flags & TJA110X_RMII_MODE_REFCLK_IN)
> - mii_mode = MII_CFG1_RMII_MODE_REFCLK_IN;
> - else
> + if (priv->flags & TJA11XX_REVERSE_MODE)
> mii_mode = MII_CFG1_RMII_MODE_REFCLK_OUT;
> + else
> + mii_mode = MII_CFG1_RMII_MODE_REFCLK_IN;
> break;
> default:
> return -EINVAL;
> @@ -517,8 +516,8 @@ static int tja11xx_parse_dt(struct phy_device *phydev)
> if (!IS_ENABLED(CONFIG_OF_MDIO))
> return 0;
>
> - if (of_property_read_bool(node, "nxp,rmii-refclk-in"))
> - priv->flags |= TJA110X_RMII_MODE_REFCLK_IN;
Hi,
I am curious to know if there are any backwards compatibility
issues to be considered in making this change.
> + if (of_property_read_bool(node, "nxp,reverse-mode"))
> + priv->flags |= TJA11XX_REVERSE_MODE;
>
> return 0;
> }
> --
> 2.34.1
>
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net-next 1/3] dt-bindings: net: tja11xx: use reverse-mode to instead of rmii-refclk-in
2024-08-15 5:51 ` [PATCH net-next 1/3] dt-bindings: net: tja11xx: use reverse-mode to instead of rmii-refclk-in Wei Fang
@ 2024-08-15 14:33 ` Andrew Lunn
2024-08-16 1:39 ` Wei Fang
0 siblings, 1 reply; 14+ messages in thread
From: Andrew Lunn @ 2024-08-15 14:33 UTC (permalink / raw)
To: Wei Fang
Cc: davem, edumazet, kuba, pabeni, robh, krzk+dt, conor+dt,
f.fainelli, hkallweit1, linux, andrei.botila, netdev, devicetree,
linux-kernel
On Thu, Aug 15, 2024 at 01:51:24PM +0800, Wei Fang wrote:
> Per the MII and RMII specifications, for the standard RMII mode,
> the REF_CLK is sourced from MAC to PHY or from an external source.
> For the standard MII mode, the RX_CLK and TX_CLK are both sourced
> by the PHY. But for TJA11xx PHYs, they support reverse mode, that
> is, for revRMII mode, the REF_CLK is output, and for revMII mode,
> the TX_CLK and RX_CLK are inputs to the PHY.
> 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. Firstly, for
> the standard RMII mode, REF_CLK is originally input, and there is
> no need to add the "nxp,rmii-refclk-in" property to indicate that
> REF_CLK is input. Secondly, this property is not generic for TJA
> PHYs, because it cannot cover the settings of TX_CLK and RX_CLK in
> MII mode. Therefore, add new property "nxp,reverse-mode" to instead
> of the "nxp,rmii-refclk-in" property.
Please could you add some justification why using
PHY_INTERFACE_MODE_REVRMII is not possible.
Andrew
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH net-next 1/3] dt-bindings: net: tja11xx: use reverse-mode to instead of rmii-refclk-in
2024-08-15 14:33 ` Andrew Lunn
@ 2024-08-16 1:39 ` Wei Fang
2024-08-16 2:32 ` Andrew Lunn
0 siblings, 1 reply; 14+ messages in thread
From: Wei Fang @ 2024-08-16 1:39 UTC (permalink / raw)
To: Andrew Lunn
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, f.fainelli@gmail.com, hkallweit1@gmail.com,
linux@armlinux.org.uk, Andrei Botila (OSS),
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: 2024年8月15日 22:33
> To: Wei Fang <wei.fang@nxp.com>
> Cc: davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> pabeni@redhat.com; robh@kernel.org; krzk+dt@kernel.org;
> conor+dt@kernel.org; f.fainelli@gmail.com; hkallweit1@gmail.com;
> linux@armlinux.org.uk; Andrei Botila (OSS) <andrei.botila@oss.nxp.com>;
> netdev@vger.kernel.org; devicetree@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Subject: Re: [PATCH net-next 1/3] dt-bindings: net: tja11xx: use reverse-mode
> to instead of rmii-refclk-in
>
> On Thu, Aug 15, 2024 at 01:51:24PM +0800, Wei Fang wrote:
> > Per the MII and RMII specifications, for the standard RMII mode, the
> > REF_CLK is sourced from MAC to PHY or from an external source.
> > For the standard MII mode, the RX_CLK and TX_CLK are both sourced by
> > the PHY. But for TJA11xx PHYs, they support reverse mode, that is, for
> > revRMII mode, the REF_CLK is output, and for revMII mode, the TX_CLK
> > and RX_CLK are inputs to the PHY.
> > 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. Firstly, for the standard
> > RMII mode, REF_CLK is originally input, and there is no need to add
> > the "nxp,rmii-refclk-in" property to indicate that REF_CLK is input.
> > Secondly, this property is not generic for TJA PHYs, because it cannot
> > cover the settings of TX_CLK and RX_CLK in MII mode. Therefore, add
> > new property "nxp,reverse-mode" to instead of the "nxp,rmii-refclk-in"
> > property.
>
> Please could you add some justification why using
> PHY_INTERFACE_MODE_REVRMII is not possible.
>
According to the commit message c858d436be8b ("net: phy: introduce
PHY_INTERFACE_MODE_REVRMII"), my understanding is that
PHY_INTERFACE_MODE_REVRMII and PHY_INTERFACE_MODE_REVMII
are used for MAC to MAC connections, which means the MAC behaves
link an RMII/MII PHY. For the MAC to PHY connection, I think these two
macros are not applicable.
Currently PHY_INTERFACE_MODE_REVMII is used in both TJA11xx drivers,
and if my understanding is correct I think they will need to be removed in
the future.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net-next 1/3] dt-bindings: net: tja11xx: use reverse-mode to instead of rmii-refclk-in
2024-08-16 1:39 ` Wei Fang
@ 2024-08-16 2:32 ` Andrew Lunn
2024-08-16 2:57 ` Wei Fang
0 siblings, 1 reply; 14+ messages in thread
From: Andrew Lunn @ 2024-08-16 2:32 UTC (permalink / raw)
To: Wei Fang
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, f.fainelli@gmail.com, hkallweit1@gmail.com,
linux@armlinux.org.uk, Andrei Botila (OSS),
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
> According to the commit message c858d436be8b ("net: phy: introduce
> PHY_INTERFACE_MODE_REVRMII"), my understanding is that
> PHY_INTERFACE_MODE_REVRMII and PHY_INTERFACE_MODE_REVMII
> are used for MAC to MAC connections, which means the MAC behaves
> link an RMII/MII PHY. For the MAC to PHY connection, I think these two
> macros are not applicable.
In MAC to MAC connections, REVRMII means that end plays the role of a
PHY, even though it is a MAC.
What is actually happening when you use these properties/register
setting on the PHY? It is playing the role of a MAC? In order to have
a working link, do you need to tell the MAC to play the role of the
PHY?
Andrew
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH net-next 1/3] dt-bindings: net: tja11xx: use reverse-mode to instead of rmii-refclk-in
2024-08-16 2:32 ` Andrew Lunn
@ 2024-08-16 2:57 ` Wei Fang
2024-08-16 3:28 ` Andrew Lunn
0 siblings, 1 reply; 14+ messages in thread
From: Wei Fang @ 2024-08-16 2:57 UTC (permalink / raw)
To: Andrew Lunn
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, f.fainelli@gmail.com, hkallweit1@gmail.com,
linux@armlinux.org.uk, Andrei Botila (OSS),
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: 2024年8月16日 10:33
> To: Wei Fang <wei.fang@nxp.com>
> Cc: davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> pabeni@redhat.com; robh@kernel.org; krzk+dt@kernel.org;
> conor+dt@kernel.org; f.fainelli@gmail.com; hkallweit1@gmail.com;
> linux@armlinux.org.uk; Andrei Botila (OSS) <andrei.botila@oss.nxp.com>;
> netdev@vger.kernel.org; devicetree@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Subject: Re: [PATCH net-next 1/3] dt-bindings: net: tja11xx: use reverse-mode
> to instead of rmii-refclk-in
>
> > According to the commit message c858d436be8b ("net: phy: introduce
> > PHY_INTERFACE_MODE_REVRMII"), my understanding is that
> > PHY_INTERFACE_MODE_REVRMII and PHY_INTERFACE_MODE_REVMII
> > are used for MAC to MAC connections, which means the MAC behaves
> > link an RMII/MII PHY. For the MAC to PHY connection, I think these two
> > macros are not applicable.
>
> In MAC to MAC connections, REVRMII means that end plays the role of a
> PHY, even though it is a MAC.
>
> What is actually happening when you use these properties/register
> setting on the PHY? It is playing the role of a MAC? In order to have
> a working link, do you need to tell the MAC to play the role of the
> PHY?
>
Based on the TJA data sheet, like TJA1103/TJA1104, if the reverse mode
is set. If XMII_MODE is set to MII, the device operates in revMII mode
(TXCLK and RXCLK are input). If XMII_MODE is set to RMII, the device
operates in revRMII mode (REF_CLK is output). So it's just that the input
and output directions of xx_CLK are reversed.
we don't need to tell the MAC to play the role of the PHY, in our case, we
just need the PHY to provide the reference clock in RMII mode.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net-next 1/3] dt-bindings: net: tja11xx: use reverse-mode to instead of rmii-refclk-in
2024-08-16 2:57 ` Wei Fang
@ 2024-08-16 3:28 ` Andrew Lunn
2024-08-16 5:01 ` Wei Fang
0 siblings, 1 reply; 14+ messages in thread
From: Andrew Lunn @ 2024-08-16 3:28 UTC (permalink / raw)
To: Wei Fang
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, f.fainelli@gmail.com, hkallweit1@gmail.com,
linux@armlinux.org.uk, Andrei Botila (OSS),
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
> Based on the TJA data sheet, like TJA1103/TJA1104, if the reverse mode
> is set. If XMII_MODE is set to MII, the device operates in revMII mode
> (TXCLK and RXCLK are input). If XMII_MODE is set to RMII, the device
> operates in revRMII mode (REF_CLK is output). So it's just that the input
> and output directions of xx_CLK are reversed.
> we don't need to tell the MAC to play the role of the PHY, in our case, we
> just need the PHY to provide the reference clock in RMII mode.
If this is purely about providing a reference clock, normally 25Mhz,
there are a few PHY drivers which support this. Find one and copy
it. There is no need to invent something new.
Andrew
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH net-next 1/3] dt-bindings: net: tja11xx: use reverse-mode to instead of rmii-refclk-in
2024-08-16 3:28 ` Andrew Lunn
@ 2024-08-16 5:01 ` Wei Fang
2024-08-20 5:13 ` Wei Fang
0 siblings, 1 reply; 14+ messages in thread
From: Wei Fang @ 2024-08-16 5:01 UTC (permalink / raw)
To: Andrew Lunn
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, f.fainelli@gmail.com, hkallweit1@gmail.com,
linux@armlinux.org.uk, Andrei Botila (OSS),
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: 2024年8月16日 11:28
> To: Wei Fang <wei.fang@nxp.com>
> Cc: davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> pabeni@redhat.com; robh@kernel.org; krzk+dt@kernel.org;
> conor+dt@kernel.org; f.fainelli@gmail.com; hkallweit1@gmail.com;
> linux@armlinux.org.uk; Andrei Botila (OSS) <andrei.botila@oss.nxp.com>;
> netdev@vger.kernel.org; devicetree@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Subject: Re: [PATCH net-next 1/3] dt-bindings: net: tja11xx: use reverse-mode
> to instead of rmii-refclk-in
>
> > Based on the TJA data sheet, like TJA1103/TJA1104, if the reverse mode
> > is set. If XMII_MODE is set to MII, the device operates in revMII mode
> > (TXCLK and RXCLK are input). If XMII_MODE is set to RMII, the device
> > operates in revRMII mode (REF_CLK is output). So it's just that the input
> > and output directions of xx_CLK are reversed.
> > we don't need to tell the MAC to play the role of the PHY, in our case, we
> > just need the PHY to provide the reference clock in RMII mode.
>
> If this is purely about providing a reference clock, normally 25Mhz,
> there are a few PHY drivers which support this. Find one and copy
> it. There is no need to invent something new.
>
Sorry, I didn't find the correct PHY driver, could you point me to which PHY
driver that I can refer to?
The PHY drivers I searched for using the "clk" keyword all seem to set the
clock via a vendor defined property. Such as,
realtek: "realtek,clkout-disable"
dp83867 and dp83869: "ti,clk-output-sel" and "ti,sgmii-ref-clock-output-enable"
motorcomm: " motorcomm,tx-clk-1000-inverted"
micrel: "rmii-ref"
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH net-next 1/3] dt-bindings: net: tja11xx: use reverse-mode to instead of rmii-refclk-in
2024-08-16 5:01 ` Wei Fang
@ 2024-08-20 5:13 ` Wei Fang
2024-08-20 13:25 ` Andrew Lunn
0 siblings, 1 reply; 14+ messages in thread
From: Wei Fang @ 2024-08-20 5:13 UTC (permalink / raw)
To: Andrew Lunn
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, f.fainelli@gmail.com, hkallweit1@gmail.com,
linux@armlinux.org.uk, Andrei Botila (OSS),
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
> -----Original Message-----
> From: Wei Fang
> Sent: 2024年8月16日 13:02
> To: Andrew Lunn <andrew@lunn.ch>
> Cc: davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> pabeni@redhat.com; robh@kernel.org; krzk+dt@kernel.org;
> conor+dt@kernel.org; f.fainelli@gmail.com; hkallweit1@gmail.com;
> linux@armlinux.org.uk; Andrei Botila (OSS) <andrei.botila@oss.nxp.com>;
> netdev@vger.kernel.org; devicetree@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Subject: RE: [PATCH net-next 1/3] dt-bindings: net: tja11xx: use reverse-mode
> to instead of rmii-refclk-in
>
> > -----Original Message-----
> > From: Andrew Lunn <andrew@lunn.ch>
> > Sent: 2024年8月16日 11:28
> > To: Wei Fang <wei.fang@nxp.com>
> > Cc: davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> > pabeni@redhat.com; robh@kernel.org; krzk+dt@kernel.org;
> > conor+dt@kernel.org; f.fainelli@gmail.com; hkallweit1@gmail.com;
> > linux@armlinux.org.uk; Andrei Botila (OSS)
> > <andrei.botila@oss.nxp.com>; netdev@vger.kernel.org;
> > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH net-next 1/3] dt-bindings: net: tja11xx: use
> > reverse-mode to instead of rmii-refclk-in
> >
> > > Based on the TJA data sheet, like TJA1103/TJA1104, if the reverse
> > > mode is set. If XMII_MODE is set to MII, the device operates in
> > > revMII mode (TXCLK and RXCLK are input). If XMII_MODE is set to
> > > RMII, the device operates in revRMII mode (REF_CLK is output). So
> > > it's just that the input and output directions of xx_CLK are reversed.
> > > we don't need to tell the MAC to play the role of the PHY, in our
> > > case, we just need the PHY to provide the reference clock in RMII mode.
> >
> > If this is purely about providing a reference clock, normally 25Mhz,
> > there are a few PHY drivers which support this. Find one and copy it.
> > There is no need to invent something new.
> >
>
> Sorry, I didn't find the correct PHY driver, could you point me to which PHY
> driver that I can refer to?
> The PHY drivers I searched for using the "clk" keyword all seem to set the
> clock via a vendor defined property. Such as,
> realtek: "realtek,clkout-disable"
> dp83867 and dp83869: "ti,clk-output-sel" and
> "ti,sgmii-ref-clock-output-enable"
> motorcomm: " motorcomm,tx-clk-1000-inverted"
> micrel: "rmii-ref"
Hi Andrew,
I still cannot find a generic method in other PHY drivers to provide
reference clock by PHY. So I think this patch is the best I could do, at
least it's more reasonable than the "nxp,rmii-refclk-in" property.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net-next 1/3] dt-bindings: net: tja11xx: use reverse-mode to instead of rmii-refclk-in
2024-08-20 5:13 ` Wei Fang
@ 2024-08-20 13:25 ` Andrew Lunn
2024-08-21 1:40 ` Wei Fang
0 siblings, 1 reply; 14+ messages in thread
From: Andrew Lunn @ 2024-08-20 13:25 UTC (permalink / raw)
To: Wei Fang
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, f.fainelli@gmail.com, hkallweit1@gmail.com,
linux@armlinux.org.uk, Andrei Botila (OSS),
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
> > Sorry, I didn't find the correct PHY driver, could you point me to which PHY
> > driver that I can refer to?
> > The PHY drivers I searched for using the "clk" keyword all seem to set the
> > clock via a vendor defined property. Such as,
> > realtek: "realtek,clkout-disable"
> > dp83867 and dp83869: "ti,clk-output-sel" and
> > "ti,sgmii-ref-clock-output-enable"
> > motorcomm: " motorcomm,tx-clk-1000-inverted"
> > micrel: "rmii-ref"
>
> Hi Andrew,
> I still cannot find a generic method in other PHY drivers to provide
> reference clock by PHY. So I think this patch is the best I could do, at
> least it's more reasonable than the "nxp,rmii-refclk-in" property.
I did not say there was a generic method. I just said copy one. We
have too many different ways of doing the same thing, so we should not
add another one. Which of these is closest to what you want? You
should use your own vendor part, but copy clk-output-sel, rmii-ref,
etc, and implement the same behaviour in your driver.
Andrew
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH net-next 1/3] dt-bindings: net: tja11xx: use reverse-mode to instead of rmii-refclk-in
2024-08-20 13:25 ` Andrew Lunn
@ 2024-08-21 1:40 ` Wei Fang
0 siblings, 0 replies; 14+ messages in thread
From: Wei Fang @ 2024-08-21 1:40 UTC (permalink / raw)
To: Andrew Lunn
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, f.fainelli@gmail.com, hkallweit1@gmail.com,
linux@armlinux.org.uk, Andrei Botila (OSS),
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: 2024年8月20日 21:25
> To: Wei Fang <wei.fang@nxp.com>
> Cc: davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> pabeni@redhat.com; robh@kernel.org; krzk+dt@kernel.org;
> conor+dt@kernel.org; f.fainelli@gmail.com; hkallweit1@gmail.com;
> linux@armlinux.org.uk; Andrei Botila (OSS) <andrei.botila@oss.nxp.com>;
> netdev@vger.kernel.org; devicetree@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Subject: Re: [PATCH net-next 1/3] dt-bindings: net: tja11xx: use reverse-mode
> to instead of rmii-refclk-in
>
> > > Sorry, I didn't find the correct PHY driver, could you point me to which PHY
> > > driver that I can refer to?
> > > The PHY drivers I searched for using the "clk" keyword all seem to set the
> > > clock via a vendor defined property. Such as,
> > > realtek: "realtek,clkout-disable"
> > > dp83867 and dp83869: "ti,clk-output-sel" and
> > > "ti,sgmii-ref-clock-output-enable"
> > > motorcomm: " motorcomm,tx-clk-1000-inverted"
> > > micrel: "rmii-ref"
> >
> > Hi Andrew,
> > I still cannot find a generic method in other PHY drivers to provide
> > reference clock by PHY. So I think this patch is the best I could do, at
> > least it's more reasonable than the "nxp,rmii-refclk-in" property.
>
> I did not say there was a generic method. I just said copy one. We
> have too many different ways of doing the same thing, so we should not
> add another one. Which of these is closest to what you want? You
> should use your own vendor part, but copy clk-output-sel, rmii-ref,
> etc, and implement the same behaviour in your driver.
>
Sorry, I misunderstood your meaning. So "reverse-mode" does not seem to
be easy to understand its real purpose. Referring to the
"adi,phy-output-reference-clock" property, for TJA11xx PHY, we can use the
"nxp,phy-output-refclk" to make the PHY provide reference clock.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2024-08-21 1:40 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-15 5:51 [PATCH net-next 0/3] add "nxp,reverse-mode" to instead of "nxp,rmii-refclk-in" Wei Fang
2024-08-15 5:51 ` [PATCH net-next 1/3] dt-bindings: net: tja11xx: use reverse-mode to instead of rmii-refclk-in Wei Fang
2024-08-15 14:33 ` Andrew Lunn
2024-08-16 1:39 ` Wei Fang
2024-08-16 2:32 ` Andrew Lunn
2024-08-16 2:57 ` Wei Fang
2024-08-16 3:28 ` Andrew Lunn
2024-08-16 5:01 ` Wei Fang
2024-08-20 5:13 ` Wei Fang
2024-08-20 13:25 ` Andrew Lunn
2024-08-21 1:40 ` Wei Fang
2024-08-15 5:51 ` [PATCH net-next 2/3] net: phy: tja11xx: replace "nxp,rmii-refclk-in" with "nxp,reverse-mode" Wei Fang
2024-08-15 13:37 ` Simon Horman
2024-08-15 5:51 ` [PATCH net-next 3/3] net: phy: c45-tja11xx: add revRMII mode support Wei Fang
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).