mirror of
https://github.com/openwrt/openwrt.git
synced 2026-05-05 22:25:44 +04:00
46a454fb9b
Backport upstream patch for AN7583 Ethernet support. While at it also backport some additional fixes required to apply the AN7583 patches cleanly. Refresh all affected patch automatically (aside from the XSI patch that changed the implementation) Link: https://github.com/openwrt/openwrt/pull/20489 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
65 lines
2.2 KiB
Diff
65 lines
2.2 KiB
Diff
From d5fb4ad1beec53ca5d3b44d9b88598ed4ab0b34d Mon Sep 17 00:00:00 2001
|
|
From: Christian Marangi <ansuelsmth@gmail.com>
|
|
Date: Fri, 9 May 2025 16:36:22 +0200
|
|
Subject: [PATCH 1/6] net: phylink: add .pcs_link_down PCS OP
|
|
|
|
Permit for PCS driver to define specific operation to torn down the link
|
|
between the MAC and the PCS.
|
|
|
|
This might be needed for some PCS that reset counter or require special
|
|
reset to correctly work if the link needs to be restored later.
|
|
|
|
On phylink_link_down() call, the additional phylink_pcs_link_down() will
|
|
be called before .mac_link_down to torn down the link.
|
|
|
|
PCS driver will need to define .pcs_link_down to make use of this.
|
|
|
|
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|
---
|
|
drivers/net/phy/phylink.c | 8 ++++++++
|
|
include/linux/phylink.h | 2 ++
|
|
2 files changed, 10 insertions(+)
|
|
|
|
--- a/drivers/net/phy/phylink.c
|
|
+++ b/drivers/net/phy/phylink.c
|
|
@@ -1088,6 +1088,12 @@ static unsigned int phylink_inband_caps(
|
|
return phylink_pcs_inband_caps(pcs, interface);
|
|
}
|
|
|
|
+static void phylink_pcs_link_down(struct phylink_pcs *pcs)
|
|
+{
|
|
+ if (pcs && pcs->ops->pcs_link_down)
|
|
+ pcs->ops->pcs_link_down(pcs);
|
|
+}
|
|
+
|
|
static void phylink_pcs_poll_stop(struct phylink *pl)
|
|
{
|
|
if (pl->cfg_link_an_mode == MLO_AN_INBAND)
|
|
@@ -1642,6 +1648,8 @@ static void phylink_link_down(struct phy
|
|
|
|
if (ndev)
|
|
netif_carrier_off(ndev);
|
|
+ phylink_pcs_link_down(pl->pcs);
|
|
+
|
|
pl->mac_ops->mac_link_down(pl->config, pl->act_link_an_mode,
|
|
pl->cur_interface);
|
|
phylink_info(pl, "Link is Down\n");
|
|
--- a/include/linux/phylink.h
|
|
+++ b/include/linux/phylink.h
|
|
@@ -431,6 +431,7 @@ struct phylink_pcs {
|
|
* (where necessary).
|
|
* @pcs_pre_init: configure PCS components necessary for MAC hardware
|
|
* initialization e.g. RX clock for stmmac.
|
|
+ * @pcs_link_down: torn down link between MAC and PCS.
|
|
*/
|
|
struct phylink_pcs_ops {
|
|
int (*pcs_validate)(struct phylink_pcs *pcs, unsigned long *supported,
|
|
@@ -453,6 +454,7 @@ struct phylink_pcs_ops {
|
|
void (*pcs_link_up)(struct phylink_pcs *pcs, unsigned int neg_mode,
|
|
phy_interface_t interface, int speed, int duplex);
|
|
int (*pcs_pre_init)(struct phylink_pcs *pcs);
|
|
+ void (*pcs_link_down)(struct phylink_pcs *pcs);
|
|
};
|
|
|
|
#if 0 /* For kernel-doc purposes only. */
|