linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/5] Fix missing PHY-to-MAC RX clock
@ 2024-01-03 14:28 Romain Gantois
  2024-01-03 14:28 ` [PATCH net 1/5] net: phy: add PHY_F_RXC_ALWAYS_ON to PHY dev flags Romain Gantois
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Romain Gantois @ 2024-01-03 14:28 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu, Russell King, Andrew Lunn,
	Jakub Kicinski, Heiner Kallweit
  Cc: Romain Gantois, David S. Miller, Eric Dumazet, Paolo Abeni,
	Maxime Coquelin, Clément Léger, Marek Vasut,
	Clark Wang, Miquel Raynal, Sylvain Girard, Pascal EBERHARD,
	netdev, linux-stm32, linux-arm-kernel, linux-renesas-soc

Hello everyone,

There is an issue with some stmmac/PHY combinations that has been reported
some time ago in a couple of different series:

Clark Wang's report: https://lore.kernel.org/all/20230202081559.3553637-1-xiaoning.wang@nxp.com/
Clément Léger's report: https://lore.kernel.org/linux-arm-kernel/20230116103926.276869-4-clement.leger@bootlin.com/

Stmmac controllers require an RX clock signal from the MII bus to perform
their hardware initialization successfully. This causes issues with some
PHY/PCS devices. If these devices do not bring the clock signal up before
the MAC driver initializes its hardware, then said initialization will
fail. This can happen at probe time or when the system wakes up from a
suspended state.

This series introduces new flags for phy_device and phylink_pcs. These
flags allow MAC drivers to signal to PHY/PCS drivers that the RX clock
signal should be enabled as soon as possible, and that it should always
stay enabled.

I have included specific uses of these flags that fix the RZN1 GMAC1 stmmac
driver that I am currently working on and that is not yet upstream. I have
also included changes to the at803x PHY driver that should fix the issue
that Clark Wang was having.

Clark, could you please confirm that this series fixes your issue with the
at803x PHY?

Best Regards,

Romain

Romain Gantois (2):
  net: phy: add rxc_always_on flag to phylink_pcs
  net: pcs: rzn1-miic: Init RX clock early if MAC requires it

Russell King (3):
  net: phy: add PHY_F_RXC_ALWAYS_ON to PHY dev flags
  net: stmmac: Signal to PHY/PCS drivers to keep RX clock on
  net: phy: at803x: Avoid hibernating if MAC requires RX clock

 .../net/ethernet/stmicro/stmmac/stmmac_main.c  |  5 +++++
 drivers/net/pcs/pcs-rzn1-miic.c                | 18 +++++++++++++-----
 drivers/net/phy/at803x.c                       |  3 ++-
 drivers/net/phy/phylink.c                      | 13 ++++++++++++-
 include/linux/phy.h                            |  1 +
 include/linux/phylink.h                        |  9 +++++++++
 6 files changed, 42 insertions(+), 7 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH net 1/5] net: phy: add PHY_F_RXC_ALWAYS_ON to PHY dev flags
  2024-01-03 14:28 [PATCH net 0/5] Fix missing PHY-to-MAC RX clock Romain Gantois
@ 2024-01-03 14:28 ` Romain Gantois
  2024-01-03 14:28 ` [PATCH net 2/5] net: phy: add rxc_always_on flag to phylink_pcs Romain Gantois
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Romain Gantois @ 2024-01-03 14:28 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu, Russell King, Andrew Lunn,
	Jakub Kicinski, Heiner Kallweit
  Cc: David S. Miller, Eric Dumazet, Paolo Abeni, Maxime Coquelin,
	Clément Léger, Marek Vasut, Clark Wang, Miquel Raynal,
	Sylvain Girard, Pascal EBERHARD, netdev, linux-stm32,
	linux-arm-kernel, linux-renesas-soc, Romain Gantois

From: Russell King <linux@armlinux.org.uk>

Some MAC controllers (e.g. stmmac) require their connected PHY to
continuously provide a receive clock signal. This can cause issues in two
cases:

  1. The clock signal hasn't been started yet by the time the MAC driver
     initializes its hardware. This can make the initialization fail, as in
      the case of the rzn1 GMAC1 driver.
  2. The clock signal is cut during a power saving event. By the time the
     MAC is brought back up, the clock signal is still not active since
     phylink_start hasn't been called yet. This brings us back to case 1.

If a PHY driver reads this flag, it should ensure that the receive clock
signal is started as soon as possible, and that it isn't brought down when
the PHY goes into suspend.

Signed-off-by: Russell King <linux@armlinux.org.uk>
[rgantois: commit log]
Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
---
 drivers/net/phy/phylink.c | 10 +++++++++-
 include/linux/phy.h       |  1 +
 include/linux/phylink.h   |  4 ++++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 25c19496a336..f26b13d916d4 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1837,6 +1837,8 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy,
 static int phylink_attach_phy(struct phylink *pl, struct phy_device *phy,
 			      phy_interface_t interface)
 {
+	u32 flags = 0;
+
 	if (WARN_ON(pl->cfg_link_an_mode == MLO_AN_FIXED ||
 		    (pl->cfg_link_an_mode == MLO_AN_INBAND &&
 		     phy_interface_mode_is_8023z(interface) && !pl->sfp_bus)))
@@ -1845,7 +1847,10 @@ static int phylink_attach_phy(struct phylink *pl, struct phy_device *phy,
 	if (pl->phydev)
 		return -EBUSY;
 
-	return phy_attach_direct(pl->netdev, phy, 0, interface);
+	if (pl->config->mac_requires_rxc)
+		flags |= PHY_F_RXC_ALWAYS_ON;
+
+	return phy_attach_direct(pl->netdev, phy, flags, interface);
 }
 
 /**
@@ -1948,6 +1953,9 @@ int phylink_fwnode_phy_connect(struct phylink *pl,
 		pl->link_config.interface = pl->link_interface;
 	}
 
+	if (pl->config->mac_requires_rxc)
+		flags |= PHY_F_RXC_ALWAYS_ON;
+
 	ret = phy_attach_direct(pl->netdev, phy_dev, flags,
 				pl->link_interface);
 	phy_device_free(phy_dev);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index bd285950972c..c6cb53412273 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -764,6 +764,7 @@ struct phy_device {
 
 /* Generic phy_device::dev_flags */
 #define PHY_F_NO_IRQ		0x80000000
+#define PHY_F_RXC_ALWAYS_ON	BIT(30)
 
 static inline struct phy_device *to_phy_device(const struct device *dev)
 {
diff --git a/include/linux/phylink.h b/include/linux/phylink.h
index 875439ab45de..8430ac7ead11 100644
--- a/include/linux/phylink.h
+++ b/include/linux/phylink.h
@@ -204,6 +204,9 @@ enum phylink_op_type {
  * @poll_fixed_state: if true, starts link_poll,
  *		      if MAC link is at %MLO_AN_FIXED mode.
  * @mac_managed_pm: if true, indicate the MAC driver is responsible for PHY PM.
+ * @mac_requires_rxc: if true, the MAC always requires a receive clock from PHY.
+ *                    The PHY driver should start the clock signal as soon as
+ *                    possible and avoid stopping it during suspend events.
  * @ovr_an_inband: if true, override PCS to MLO_AN_INBAND
  * @get_fixed_state: callback to execute to determine the fixed link state,
  *		     if MAC link is at %MLO_AN_FIXED mode.
@@ -216,6 +219,7 @@ struct phylink_config {
 	enum phylink_op_type type;
 	bool poll_fixed_state;
 	bool mac_managed_pm;
+	bool mac_requires_rxc;
 	bool ovr_an_inband;
 	void (*get_fixed_state)(struct phylink_config *config,
 				struct phylink_link_state *state);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net 2/5] net: phy: add rxc_always_on flag to phylink_pcs
  2024-01-03 14:28 [PATCH net 0/5] Fix missing PHY-to-MAC RX clock Romain Gantois
  2024-01-03 14:28 ` [PATCH net 1/5] net: phy: add PHY_F_RXC_ALWAYS_ON to PHY dev flags Romain Gantois
@ 2024-01-03 14:28 ` Romain Gantois
  2024-01-03 14:28 ` [PATCH net 3/5] net: stmmac: Signal to PHY/PCS drivers to keep RX clock on Romain Gantois
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Romain Gantois @ 2024-01-03 14:28 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu, Russell King, Andrew Lunn,
	Jakub Kicinski, Heiner Kallweit
  Cc: Romain Gantois, David S. Miller, Eric Dumazet, Paolo Abeni,
	Maxime Coquelin, Clément Léger, Marek Vasut,
	Clark Wang, Miquel Raynal, Sylvain Girard, Pascal EBERHARD,
	netdev, linux-stm32, linux-arm-kernel, linux-renesas-soc

Some MAC drivers (e.g. stmmac) require a continuous receive clock signal to
be generated by a PCS that is handled by a standalone PCS driver.

Such a PCS driver does not have access to a PHY device, thus cannot check
the PHY_F_RXC_ALWAYS_ON flag. They cannot check max_requires_rxc in the
phylink config either, since it is a private member. Therefore, a new flag
is needed to signal to the PCS that it should keep the RX clock signal up
at all times.

Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
---
 drivers/net/phy/phylink.c | 3 +++
 include/linux/phylink.h   | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index f26b13d916d4..a5a5fe91d213 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -663,6 +663,9 @@ static int phylink_validate_mac_and_pcs(struct phylink *pl,
 			return -EINVAL;
 		}
 
+		if (pl->config->mac_requires_rxc)
+			pcs->rxc_always_on = true;
+
 		/* Validate the link parameters with the PCS */
 		if (pcs->ops->pcs_validate) {
 			ret = pcs->ops->pcs_validate(pcs, supported, state);
diff --git a/include/linux/phylink.h b/include/linux/phylink.h
index 8430ac7ead11..e1527e35f997 100644
--- a/include/linux/phylink.h
+++ b/include/linux/phylink.h
@@ -462,6 +462,10 @@ struct phylink_pcs_ops;
  * @phylink: pointer to &struct phylink_config
  * @neg_mode: provide PCS neg mode via "mode" argument
  * @poll: poll the PCS for link changes
+ * @rxc_always_on: The MAC driver requires the reference clock
+ *                 to always be on. Standalone PCS drivers who
+ *                 do not have access to a PHY device can check
+ *                 this instead of PHY_F_RXC_ALWAYS_ON.
  *
  * This structure is designed to be embedded within the PCS private data,
  * and will be passed between phylink and the PCS.
@@ -474,6 +478,7 @@ struct phylink_pcs {
 	struct phylink *phylink;
 	bool neg_mode;
 	bool poll;
+	bool rxc_always_on;
 };
 
 /**
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net 3/5] net: stmmac: Signal to PHY/PCS drivers to keep RX clock on
  2024-01-03 14:28 [PATCH net 0/5] Fix missing PHY-to-MAC RX clock Romain Gantois
  2024-01-03 14:28 ` [PATCH net 1/5] net: phy: add PHY_F_RXC_ALWAYS_ON to PHY dev flags Romain Gantois
  2024-01-03 14:28 ` [PATCH net 2/5] net: phy: add rxc_always_on flag to phylink_pcs Romain Gantois
@ 2024-01-03 14:28 ` Romain Gantois
  2024-01-03 14:28 ` [PATCH net 4/5] net: phy: at803x: Avoid hibernating if MAC requires RX clock Romain Gantois
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Romain Gantois @ 2024-01-03 14:28 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu, Russell King, Andrew Lunn,
	Jakub Kicinski, Heiner Kallweit
  Cc: David S. Miller, Eric Dumazet, Paolo Abeni, Maxime Coquelin,
	Clément Léger, Marek Vasut, Clark Wang, Miquel Raynal,
	Sylvain Girard, Pascal EBERHARD, netdev, linux-stm32,
	linux-arm-kernel, linux-renesas-soc, Romain Gantois

From: Russell King <linux@armlinux.org.uk>

There is a reocurring issue with stmmac controllers where the MAC fails to
initialize its hardware if an RX clock signal isn't provided on the MAC/PHY
link.

This causes issues when PHY or PCS devices either go into suspend while
cutting the RX clock or do not bring the clock signal up early enough for
the MAC to initialize successfully.

Set the mac_requires_rxc flag in the stmmac phylink config so that PHY/PCS
drivers know to keep the RX clock up at all times.

Reported-by: Clark Wang <xiaoning.wang@nxp.com>
Link: https://lore.kernel.org/all/20230202081559.3553637-1-xiaoning.wang@nxp.com/
Reported-by: Clément Léger <clement.leger@bootlin.com>
Link: https://lore.kernel.org/linux-arm-kernel/20230116103926.276869-4-clement.leger@bootlin.com/
Signed-off-by: Russell King <linux@armlinux.org.uk>
[rgantois: commit log]
Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 37e64283f910..ffecc28de234 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1221,6 +1221,11 @@ static int stmmac_phy_setup(struct stmmac_priv *priv)
 	priv->phylink_config.type = PHYLINK_NETDEV;
 	priv->phylink_config.mac_managed_pm = true;
 
+	/* stmmac always requires a receive clock in order for things like
+	 * hardware reset to work.
+	 */
+	priv->phylink_config.mac_requires_rxc = true;
+
 	mdio_bus_data = priv->plat->mdio_bus_data;
 	if (mdio_bus_data)
 		priv->phylink_config.ovr_an_inband =
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net 4/5] net: phy: at803x: Avoid hibernating if MAC requires RX clock
  2024-01-03 14:28 [PATCH net 0/5] Fix missing PHY-to-MAC RX clock Romain Gantois
                   ` (2 preceding siblings ...)
  2024-01-03 14:28 ` [PATCH net 3/5] net: stmmac: Signal to PHY/PCS drivers to keep RX clock on Romain Gantois
@ 2024-01-03 14:28 ` Romain Gantois
  2024-01-03 14:28 ` [PATCH net 5/5] net: pcs: rzn1-miic: Init RX clock early if MAC requires it Romain Gantois
  2024-01-03 21:28 ` [PATCH net 0/5] Fix missing PHY-to-MAC RX clock Jakub Kicinski
  5 siblings, 0 replies; 10+ messages in thread
From: Romain Gantois @ 2024-01-03 14:28 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu, Russell King, Andrew Lunn,
	Jakub Kicinski, Heiner Kallweit
  Cc: David S. Miller, Eric Dumazet, Paolo Abeni, Maxime Coquelin,
	Clément Léger, Marek Vasut, Clark Wang, Miquel Raynal,
	Sylvain Girard, Pascal EBERHARD, netdev, linux-stm32,
	linux-arm-kernel, linux-renesas-soc, Romain Gantois

From: Russell King <linux@armlinux.org.uk>

Stmmac controllers connected to an at803x PHY cannot resume properly after
suspend when WoL is enabled. This happens because the MAC requires an RX
clock generated by the PHY to initialize its hardware properly. But the RX
clock is cut when the PHY suspends and isn't brought up until the MAC
driver resumes the phylink.

Prevent the at803x PHY driver from going into suspend if the attached MAC
driver always requires an RX clock signal.

Reported-by: Clark Wang <xiaoning.wang@nxp.com>
Link: https://lore.kernel.org/all/20230202081559.3553637-1-xiaoning.wang@nxp.com/
Signed-off-by: Russell King <linux@armlinux.org.uk>
[rgantois: commit log]
Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
---
 drivers/net/phy/at803x.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index 37fb033e1c29..410776281ff6 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -995,7 +995,8 @@ static int at803x_hibernation_mode_config(struct phy_device *phydev)
 	/* The default after hardware reset is hibernation mode enabled. After
 	 * software reset, the value is retained.
 	 */
-	if (!(priv->flags & AT803X_DISABLE_HIBERNATION_MODE))
+	if (!(priv->flags & AT803X_DISABLE_HIBERNATION_MODE) &&
+	    !(phydev->dev_flags & PHY_F_RXC_ALWAYS_ON))
 		return 0;
 
 	return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_HIB_CTRL,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net 5/5] net: pcs: rzn1-miic: Init RX clock early if MAC requires it
  2024-01-03 14:28 [PATCH net 0/5] Fix missing PHY-to-MAC RX clock Romain Gantois
                   ` (3 preceding siblings ...)
  2024-01-03 14:28 ` [PATCH net 4/5] net: phy: at803x: Avoid hibernating if MAC requires RX clock Romain Gantois
@ 2024-01-03 14:28 ` Romain Gantois
  2024-01-03 15:01   ` Russell King (Oracle)
  2024-01-03 21:28 ` [PATCH net 0/5] Fix missing PHY-to-MAC RX clock Jakub Kicinski
  5 siblings, 1 reply; 10+ messages in thread
From: Romain Gantois @ 2024-01-03 14:28 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu, Russell King, Andrew Lunn,
	Jakub Kicinski, Heiner Kallweit
  Cc: Romain Gantois, David S. Miller, Eric Dumazet, Paolo Abeni,
	Maxime Coquelin, Clément Léger, Marek Vasut,
	Clark Wang, Miquel Raynal, Sylvain Girard, Pascal EBERHARD,
	netdev, linux-stm32, linux-arm-kernel, linux-renesas-soc

The GMAC1 controller in the RZN1 IP requires the RX MII clock signal to be
started before it initializes its own hardware, thus before it calls
phylink_start.

Check the rxc_always_on pcs flag and enable the clock signal during the
link validation phase.

Reported-by: Clément Léger <clement.leger@bootlin.com>
Link: https://lore.kernel.org/linux-arm-kernel/20230116103926.276869-4-clement.leger@bootlin.com/
Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
---
 drivers/net/pcs/pcs-rzn1-miic.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-miic.c
index 97139c07130f..bf796491b826 100644
--- a/drivers/net/pcs/pcs-rzn1-miic.c
+++ b/drivers/net/pcs/pcs-rzn1-miic.c
@@ -271,12 +271,20 @@ static void miic_link_up(struct phylink_pcs *pcs, unsigned int mode,
 static int miic_validate(struct phylink_pcs *pcs, unsigned long *supported,
 			 const struct phylink_link_state *state)
 {
-	if (phy_interface_mode_is_rgmii(state->interface) ||
-	    state->interface == PHY_INTERFACE_MODE_RMII ||
-	    state->interface == PHY_INTERFACE_MODE_MII)
-		return 1;
+	int ret = 1;
 
-	return -EINVAL;
+	if (!phy_interface_mode_is_rgmii(state->interface) &&
+	    state->interface != PHY_INTERFACE_MODE_RMII &&
+	    state->interface != PHY_INTERFACE_MODE_MII)
+		return -EINVAL;
+
+	if (pcs->rxc_always_on) {
+		ret = miic_config(pcs, 0, state->interface, NULL, false);
+		if (ret)
+			pr_err("Error: Failed to init RX clock in RZN1 MIIC PCS!");
+	}
+
+	return ret;
 }
 
 static const struct phylink_pcs_ops miic_phylink_ops = {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH net 5/5] net: pcs: rzn1-miic: Init RX clock early if MAC requires it
  2024-01-03 14:28 ` [PATCH net 5/5] net: pcs: rzn1-miic: Init RX clock early if MAC requires it Romain Gantois
@ 2024-01-03 15:01   ` Russell King (Oracle)
  2024-01-03 15:45     ` Romain Gantois
  0 siblings, 1 reply; 10+ messages in thread
From: Russell King (Oracle) @ 2024-01-03 15:01 UTC (permalink / raw)
  To: Romain Gantois
  Cc: Alexandre Torgue, Jose Abreu, Andrew Lunn, Jakub Kicinski,
	Heiner Kallweit, David S. Miller, Eric Dumazet, Paolo Abeni,
	Maxime Coquelin, Clément Léger, Marek Vasut,
	Clark Wang, Miquel Raynal, Sylvain Girard, Pascal EBERHARD,
	netdev, linux-stm32, linux-arm-kernel, linux-renesas-soc

On Wed, Jan 03, 2024 at 03:28:25PM +0100, Romain Gantois wrote:
> The GMAC1 controller in the RZN1 IP requires the RX MII clock signal to be
> started before it initializes its own hardware, thus before it calls
> phylink_start.
> 
> Check the rxc_always_on pcs flag and enable the clock signal during the
> link validation phase.

However, validation is *not* supposed to change the configuration of
the hardware. Validation may fail. The "interface" that gets passed
to validation may never ever be selected. This change feels like
nothing more than a hack.

Since the MAC driver has to itself provide the PCS to phylink via the
mac_select_pcs() method, the MAC driver already has knowledge of which
PCS it is going to be using. Therefore, I think it may make sense
to do something like this:

int phylink_pcs_preconfig(struct phylink *pl, struct phylink_pcs *pcs)
{
	if (pl->config->mac_requires_rxc)
		pcs->rxc_always_on = true;

	if (pcs->ops->preconfig)
		pcs->ops->pcs_preconfig(pcs);
}

and have stmmac call phylink_pcs_preconfig() for each PCS that it will
be using during initialisation / resume paths?

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net 5/5] net: pcs: rzn1-miic: Init RX clock early if MAC requires it
  2024-01-03 15:01   ` Russell King (Oracle)
@ 2024-01-03 15:45     ` Romain Gantois
  0 siblings, 0 replies; 10+ messages in thread
From: Romain Gantois @ 2024-01-03 15:45 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Romain Gantois, Alexandre Torgue, Jose Abreu, Andrew Lunn,
	Jakub Kicinski, Heiner Kallweit, David S. Miller, Eric Dumazet,
	Paolo Abeni, Maxime Coquelin, Clément Léger,
	Marek Vasut, Clark Wang, Miquel Raynal, Sylvain Girard,
	Pascal EBERHARD, netdev, linux-stm32, linux-arm-kernel,
	linux-renesas-soc

Hello Russel,

On Wed, 3 Jan 2024, Russell King (Oracle) wrote:
...
> Since the MAC driver has to itself provide the PCS to phylink via the
> mac_select_pcs() method, the MAC driver already has knowledge of which
> PCS it is going to be using. Therefore, I think it may make sense
> to do something like this:
> 
> int phylink_pcs_preconfig(struct phylink *pl, struct phylink_pcs *pcs)
> {
> 	if (pl->config->mac_requires_rxc)
> 		pcs->rxc_always_on = true;
> 
> 	if (pcs->ops->preconfig)
> 		pcs->ops->pcs_preconfig(pcs);
> }
> 
> and have stmmac call phylink_pcs_preconfig() for each PCS that it will
> be using during initialisation / resume paths?

Yes, that is definitely a much cleaner solution. I'll reimplement the PCS 
changes in this way.

Best Regards,

-- 
Romain Gantois, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net 0/5] Fix missing PHY-to-MAC RX clock
  2024-01-03 14:28 [PATCH net 0/5] Fix missing PHY-to-MAC RX clock Romain Gantois
                   ` (4 preceding siblings ...)
  2024-01-03 14:28 ` [PATCH net 5/5] net: pcs: rzn1-miic: Init RX clock early if MAC requires it Romain Gantois
@ 2024-01-03 21:28 ` Jakub Kicinski
  2024-01-04  8:01   ` Romain Gantois
  5 siblings, 1 reply; 10+ messages in thread
From: Jakub Kicinski @ 2024-01-03 21:28 UTC (permalink / raw)
  To: Romain Gantois
  Cc: Alexandre Torgue, Jose Abreu, Russell King, Andrew Lunn,
	Heiner Kallweit, David S. Miller, Eric Dumazet, Paolo Abeni,
	Maxime Coquelin, Clément Léger, Marek Vasut,
	Clark Wang, Miquel Raynal, Sylvain Girard, Pascal EBERHARD,
	netdev, linux-stm32, linux-arm-kernel, linux-renesas-soc

On Wed,  3 Jan 2024 15:28:20 +0100 Romain Gantois wrote:
> There is an issue with some stmmac/PHY combinations that has been reported
> some time ago in a couple of different series:
> 
> Clark Wang's report: https://lore.kernel.org/all/20230202081559.3553637-1-xiaoning.wang@nxp.com/
> Clément Léger's report: https://lore.kernel.org/linux-arm-kernel/20230116103926.276869-4-clement.leger@bootlin.com/

If those stmmac/PHY combinations never worked upstream please tag 
as [PATCH net-next], we should consider this work to be a be a new
feature / HW support. If they used to work - we'll need some Fixes
tags.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net 0/5] Fix missing PHY-to-MAC RX clock
  2024-01-03 21:28 ` [PATCH net 0/5] Fix missing PHY-to-MAC RX clock Jakub Kicinski
@ 2024-01-04  8:01   ` Romain Gantois
  0 siblings, 0 replies; 10+ messages in thread
From: Romain Gantois @ 2024-01-04  8:01 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Romain Gantois, Alexandre Torgue, Jose Abreu, Russell King,
	Andrew Lunn, Heiner Kallweit, David S. Miller, Eric Dumazet,
	Paolo Abeni, Maxime Coquelin, Clément Léger,
	Marek Vasut, Clark Wang, Miquel Raynal, Sylvain Girard,
	Pascal EBERHARD, netdev, linux-stm32, linux-arm-kernel,
	linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 860 bytes --]

Hello Jakub,

On Wed, 3 Jan 2024, Jakub Kicinski wrote:

> On Wed,  3 Jan 2024 15:28:20 +0100 Romain Gantois wrote:
> > There is an issue with some stmmac/PHY combinations that has been reported
> > some time ago in a couple of different series:
> > 
> > Clark Wang's report: https://lore.kernel.org/all/20230202081559.3553637-1-xiaoning.wang@nxp.com/
> > Clément Léger's report: https://lore.kernel.org/linux-arm-kernel/20230116103926.276869-4-clement.leger@bootlin.com/
> 
> If those stmmac/PHY combinations never worked upstream please tag 
> as [PATCH net-next], we should consider this work to be a be a new
> feature / HW support. If they used to work - we'll need some Fixes
> tags.

These never worked properly upstream so I'll send it to net-next.

Best Regards,

-- 
Romain Gantois, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-01-04  8:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-03 14:28 [PATCH net 0/5] Fix missing PHY-to-MAC RX clock Romain Gantois
2024-01-03 14:28 ` [PATCH net 1/5] net: phy: add PHY_F_RXC_ALWAYS_ON to PHY dev flags Romain Gantois
2024-01-03 14:28 ` [PATCH net 2/5] net: phy: add rxc_always_on flag to phylink_pcs Romain Gantois
2024-01-03 14:28 ` [PATCH net 3/5] net: stmmac: Signal to PHY/PCS drivers to keep RX clock on Romain Gantois
2024-01-03 14:28 ` [PATCH net 4/5] net: phy: at803x: Avoid hibernating if MAC requires RX clock Romain Gantois
2024-01-03 14:28 ` [PATCH net 5/5] net: pcs: rzn1-miic: Init RX clock early if MAC requires it Romain Gantois
2024-01-03 15:01   ` Russell King (Oracle)
2024-01-03 15:45     ` Romain Gantois
2024-01-03 21:28 ` [PATCH net 0/5] Fix missing PHY-to-MAC RX clock Jakub Kicinski
2024-01-04  8:01   ` Romain Gantois

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).