generic: backport the phylink PSGMII in-band classification

phylink_get_inband_type() omits PHY_INTERFACE_MODE_PSGMII, so
phylink_pcs_neg_mode() returns early with PHYLINK_PCS_NEG_NONE for a
PSGMII port, and the in-band capabilities a PCS advertises are never
consulted: qca-uniphy answers pcs_inband_caps() with
LINK_INBAND_DISABLE | LINK_INBAND_ENABLE for every interface it drives,
PSGMII included.

Backport upstream commit 5ba017f9efef ("net: phylink: treat PSGMII as an
inband capable interface"), which classifies PSGMII as INBAND_CISCO_SGMII
beside SGMII and QSGMII and extends the generic clause 22 PCS helpers to
match, to both kernel copies the tree carries.

No board in the tree declares managed = "in-band-status" on a PSGMII
port, so every PSGMII port moves from PHYLINK_PCS_NEG_NONE to
PHYLINK_PCS_NEG_OUTBAND, PHY-managed and fixed links alike. A PCS
driver can distinguish the two with phylink_expects_phy() and force
its channel only on a fixed link.

The 6.12 copy adapts the phylink_mii_c22_pcs_decode_state() hunk, whose
SGMII case carries no neg_mode guard on that kernel.

Exercised on a Xiaomi AX3600 (IPQ8074, kernel 6.18), whose four ports are
PSGMII channels of one UNIPHY. With two of them declared as fixed links,
the channel force bit the qca-uniphy PCS drives reads 0 without this
patch and 1 with it, the channel speed field following the declared
speed, while the two channels still behind a PHY are untouched either
way. On the unmodified device tree nothing changes: every port links as
before and every channel register reads the value it held.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/24791
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Julius Bairaktaris authored and Robert Marko committed 2026-09-07 18:37:41 +02:00
1 parent 77824a92b8
commit 2de0893dd2
16 files changed
+191 -49

No files matched your search

@@ -0,0 +1,71 @@
From 5ba017f9efef3cf65cc60005aae4cbbf70b9b2b8 Mon Sep 17 00:00:00 2001
From: Sandeep Sondagar <sandeepsondagar@gmail.com>
Date: Sun, 9 Aug 2026 21:31:41 +0530
Subject: [PATCH] net: phylink: treat PSGMII as an inband capable interface
PSGMII (the Qualcomm 5-port SGMII) conveys the link negotiation result
from the PHY back to the MAC through per-channel in-band SGMII words,
exactly like SGMII and QSGMII.
However, PHY_INTERFACE_MODE_PSGMII is missing from
phylink_get_inband_type(), so phylink reports INBAND_NONE for it and
phylink_pcs_neg_mode() falls back to PHYLINK_PCS_NEG_NONE. The PCS is
then programmed in force mode and its control-register speed bits (which
default to 1000base) are used, so a slower copper link - e.g. 100base-T
- is reported as 1Gbps and cannot pass traffic.
Classify PSGMII alongside SGMII and QSGMII as INBAND_CISCO_SGMII so the
PCS negotiates in-band and the resolved link speed comes from the PHY
in-band word.
Also add PSGMII to the generic clause 22 PCS helper functions which
handle the SGMII in-band word. Without this, a PCS using these helpers
would still fall through to the default handling and force the link
state to false in phylink_mii_c22_pcs_decode_state(), fail to encode
the SGMII advertisement, and get rejected by phylink_get_link_timer_ns().
Signed-off-by: Sandeep Sondagar <sandeepsondagar@gmail.com>
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Link: https://patch.msgid.link/20260809-phylink-psgmii-v3-1-908dcd3a9e3d@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
drivers/net/phy/phylink.c | 3 +++
include/linux/phylink.h | 1 +
2 files changed, 4 insertions(+)
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1171,6 +1171,7 @@ static enum inband_type phylink_get_inba
{
switch (interface) {
case PHY_INTERFACE_MODE_SGMII:
+ case PHY_INTERFACE_MODE_PSGMII:
case PHY_INTERFACE_MODE_QSGMII:
case PHY_INTERFACE_MODE_QUSGMII:
case PHY_INTERFACE_MODE_USXGMII:
@@ -3956,6 +3957,7 @@ void phylink_mii_c22_pcs_decode_state(st
break;
case PHY_INTERFACE_MODE_SGMII:
+ case PHY_INTERFACE_MODE_PSGMII:
case PHY_INTERFACE_MODE_QSGMII:
phylink_decode_sgmii_word(state, lpa);
break;
@@ -4031,6 +4033,7 @@ int phylink_mii_c22_pcs_encode_advertise
adv |= ADVERTISE_1000XPSE_ASYM;
return adv;
case PHY_INTERFACE_MODE_SGMII:
+ case PHY_INTERFACE_MODE_PSGMII:
case PHY_INTERFACE_MODE_QSGMII:
return 0x0001;
default:
--- a/include/linux/phylink.h
+++ b/include/linux/phylink.h
@@ -674,6 +674,7 @@ static inline int phylink_get_link_timer
{
switch (interface) {
case PHY_INTERFACE_MODE_SGMII:
+ case PHY_INTERFACE_MODE_PSGMII:
case PHY_INTERFACE_MODE_QSGMII:
case PHY_INTERFACE_MODE_USXGMII:
case PHY_INTERFACE_MODE_10G_QXGMII:
@@ -0,0 +1,71 @@
From 5ba017f9efef3cf65cc60005aae4cbbf70b9b2b8 Mon Sep 17 00:00:00 2001
From: Sandeep Sondagar <sandeepsondagar@gmail.com>
Date: Sun, 9 Aug 2026 21:31:41 +0530
Subject: [PATCH] net: phylink: treat PSGMII as an inband capable interface
PSGMII (the Qualcomm 5-port SGMII) conveys the link negotiation result
from the PHY back to the MAC through per-channel in-band SGMII words,
exactly like SGMII and QSGMII.
However, PHY_INTERFACE_MODE_PSGMII is missing from
phylink_get_inband_type(), so phylink reports INBAND_NONE for it and
phylink_pcs_neg_mode() falls back to PHYLINK_PCS_NEG_NONE. The PCS is
then programmed in force mode and its control-register speed bits (which
default to 1000base) are used, so a slower copper link - e.g. 100base-T
- is reported as 1Gbps and cannot pass traffic.
Classify PSGMII alongside SGMII and QSGMII as INBAND_CISCO_SGMII so the
PCS negotiates in-band and the resolved link speed comes from the PHY
in-band word.
Also add PSGMII to the generic clause 22 PCS helper functions which
handle the SGMII in-band word. Without this, a PCS using these helpers
would still fall through to the default handling and force the link
state to false in phylink_mii_c22_pcs_decode_state(), fail to encode
the SGMII advertisement, and get rejected by phylink_get_link_timer_ns().
Signed-off-by: Sandeep Sondagar <sandeepsondagar@gmail.com>
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Link: https://patch.msgid.link/20260809-phylink-psgmii-v3-1-908dcd3a9e3d@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
drivers/net/phy/phylink.c | 3 +++
include/linux/phylink.h | 1 +
2 files changed, 4 insertions(+)
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1036,6 +1036,7 @@ static enum inband_type phylink_get_inba
{
switch (interface) {
case PHY_INTERFACE_MODE_SGMII:
+ case PHY_INTERFACE_MODE_PSGMII:
case PHY_INTERFACE_MODE_QSGMII:
case PHY_INTERFACE_MODE_QUSGMII:
case PHY_INTERFACE_MODE_USXGMII:
@@ -4093,6 +4094,7 @@ void phylink_mii_c22_pcs_decode_state(st
break;
case PHY_INTERFACE_MODE_SGMII:
+ case PHY_INTERFACE_MODE_PSGMII:
case PHY_INTERFACE_MODE_QSGMII:
if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED)
phylink_decode_sgmii_word(state, lpa);
@@ -4173,6 +4175,7 @@ int phylink_mii_c22_pcs_encode_advertise
adv |= ADVERTISE_1000XPSE_ASYM;
return adv;
case PHY_INTERFACE_MODE_SGMII:
+ case PHY_INTERFACE_MODE_PSGMII:
case PHY_INTERFACE_MODE_QSGMII:
return 0x0001;
default:
--- a/include/linux/phylink.h
+++ b/include/linux/phylink.h
@@ -762,6 +762,7 @@ static inline int phylink_get_link_timer
{
switch (interface) {
case PHY_INTERFACE_MODE_SGMII:
+ case PHY_INTERFACE_MODE_PSGMII:
case PHY_INTERFACE_MODE_QSGMII:
case PHY_INTERFACE_MODE_USXGMII:
case PHY_INTERFACE_MODE_10G_QXGMII:
@@ -20,7 +20,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -2314,7 +2314,7 @@ int phylink_fwnode_phy_connect(struct ph
@@ -2315,7 +2315,7 @@ int phylink_fwnode_phy_connect(struct ph
{
struct fwnode_handle *phy_fwnode;
struct phy_device *phy_dev;
@@ -29,7 +29,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
/* Fixed links and 802.3z are handled without needing a PHY */
if (pl->cfg_link_an_mode == MLO_AN_FIXED ||
@@ -2344,6 +2344,25 @@ int phylink_fwnode_phy_connect(struct ph
@@ -2345,6 +2345,25 @@ int phylink_fwnode_phy_connect(struct ph
if (pl->config->mac_requires_rxc)
flags |= PHY_F_RXC_ALWAYS_ON;
@@ -41,7 +41,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
if (state->interface == PHY_INTERFACE_MODE_NA)
return phylink_validate_mask(pl, NULL, supported, state,
@@ -1948,6 +1953,9 @@ struct phylink *phylink_create(struct ph
@@ -1949,6 +1954,9 @@ struct phylink *phylink_create(struct ph
mutex_init(&pl->state_mutex);
INIT_WORK(&pl->resolve, phylink_resolve);
@@ -51,7 +51,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
pl->config = config;
if (config->type == PHYLINK_NETDEV) {
pl->netdev = to_net_dev(config->dev);
@@ -2092,7 +2100,7 @@ static int phylink_validate_phy(struct p
@@ -2093,7 +2101,7 @@ static int phylink_validate_phy(struct p
* those which the host supports.
*/
phy_interface_and(interfaces, phy->possible_interfaces,
@@ -60,7 +60,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
if (phy_interface_empty(interfaces)) {
phylink_err(pl, "PHY has no common interfaces\n");
@@ -3566,14 +3574,14 @@ static int phylink_sfp_config_optical(st
@@ -3567,14 +3575,14 @@ static int phylink_sfp_config_optical(st
phylink_dbg(pl, "optical SFP: interfaces=[mac=%*pbl, sfp=%*pbl]\n",
(int)PHY_INTERFACE_MODE_MAX,
@@ -77,7 +77,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
pl->sfp_interfaces);
if (phy_interface_empty(interfaces)) {
phylink_err(pl, "unsupported SFP module: no common interface modes\n");
@@ -3731,7 +3739,7 @@ static int phylink_sfp_connect_phy(void
@@ -3732,7 +3740,7 @@ static int phylink_sfp_connect_phy(void
/* Set the PHY's host supported interfaces */
phy_interface_and(phy->host_interfaces, phylink_sfp_interfaces,
@@ -189,7 +189,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
return 0;
return phylink_pcs_inband_caps(pcs, interface);
@@ -1397,10 +1444,36 @@ static void phylink_major_config(struct
@@ -1398,10 +1445,36 @@ static void phylink_major_config(struct
pl->major_config_failed = true;
return;
}
@@ -227,7 +227,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
phylink_pcs_neg_mode(pl, pcs, state->interface, state->advertising);
phylink_dbg(pl, "major config, active %s/%s/%s\n",
@@ -1427,11 +1500,13 @@ static void phylink_major_config(struct
@@ -1428,11 +1501,13 @@ static void phylink_major_config(struct
if (pcs_changed) {
phylink_pcs_disable(pl->pcs);
@@ -245,7 +245,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
pl->pcs = pcs;
}
@@ -1909,6 +1984,44 @@ int phylink_set_fixed_link(struct phylin
@@ -1910,6 +1985,44 @@ int phylink_set_fixed_link(struct phylin
}
EXPORT_SYMBOL_GPL(phylink_set_fixed_link);
@@ -290,7 +290,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
/**
* phylink_create() - create a phylink instance
* @config: a pointer to the target &struct phylink_config
@@ -1931,6 +2044,7 @@ struct phylink *phylink_create(struct ph
@@ -1932,6 +2045,7 @@ struct phylink *phylink_create(struct ph
const struct phylink_mac_ops *mac_ops)
{
bool using_mac_select_pcs = false;
@@ -298,7 +298,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
struct phylink *pl;
int ret;
@@ -1952,9 +2066,21 @@ struct phylink *phylink_create(struct ph
@@ -1953,9 +2067,21 @@ struct phylink *phylink_create(struct ph
mutex_init(&pl->state_mutex);
INIT_WORK(&pl->resolve, phylink_resolve);
@@ -320,7 +320,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
pl->config = config;
if (config->type == PHYLINK_NETDEV) {
@@ -2025,10 +2151,16 @@ EXPORT_SYMBOL_GPL(phylink_create);
@@ -2026,10 +2152,16 @@ EXPORT_SYMBOL_GPL(phylink_create);
*/
void phylink_destroy(struct phylink *pl)
{
@@ -337,7 +337,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
cancel_work_sync(&pl->resolve);
kfree(pl);
}
@@ -2473,6 +2605,7 @@ static irqreturn_t phylink_link_handler(
@@ -2474,6 +2606,7 @@ static irqreturn_t phylink_link_handler(
*/
void phylink_start(struct phylink *pl)
{
@@ -345,7 +345,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
bool poll = false;
ASSERT_RTNL();
@@ -2499,6 +2632,10 @@ void phylink_start(struct phylink *pl)
@@ -2500,6 +2633,10 @@ void phylink_start(struct phylink *pl)
pl->pcs_state = PCS_STATE_STARTED;
@@ -356,7 +356,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
phylink_enable_and_run_resolve(pl, PHYLINK_DISABLE_STOPPED);
if (pl->cfg_link_an_mode == MLO_AN_FIXED && pl->link_gpio) {
@@ -2543,6 +2680,8 @@ EXPORT_SYMBOL_GPL(phylink_start);
@@ -2544,6 +2681,8 @@ EXPORT_SYMBOL_GPL(phylink_start);
*/
void phylink_stop(struct phylink *pl)
{
@@ -365,7 +365,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
ASSERT_RTNL();
if (pl->sfp_bus)
@@ -2560,6 +2699,14 @@ void phylink_stop(struct phylink *pl)
@@ -2561,6 +2700,14 @@ void phylink_stop(struct phylink *pl)
pl->pcs_state = PCS_STATE_DOWN;
phylink_pcs_disable(pl->pcs);
@@ -93,7 +93,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
static unsigned int phylink_pcs_inband_caps(struct phylink_pcs *pcs,
phy_interface_t interface)
{
@@ -1818,6 +1868,10 @@ static void phylink_resolve(struct work_
@@ -1819,6 +1869,10 @@ static void phylink_resolve(struct work_
if (pl->phydev)
link_state.link &= pl->phy_state.link;
@@ -104,7 +104,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
/* Only update if the PHY link is up */
if (pl->phydev && pl->phy_state.link) {
/* If the interface has changed, force a link down
@@ -1852,7 +1906,7 @@ static void phylink_resolve(struct work_
@@ -1853,7 +1907,7 @@ static void phylink_resolve(struct work_
phylink_apply_manual_flow(pl, &link_state);
if ((mac_config && link_state.interface != pl->link_config.interface) ||
@@ -113,7 +113,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
/* The interface has changed or a forced major configuration
* was requested, so force the link down and then reconfigure.
*/
@@ -1863,6 +1917,7 @@ static void phylink_resolve(struct work_
@@ -1864,6 +1918,7 @@ static void phylink_resolve(struct work_
phylink_major_config(pl, false, &link_state);
pl->link_config.interface = link_state.interface;
pl->force_major_config = false;
@@ -110,7 +110,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
/* What interface are supported by the current link.
* Can change on removal or addition of new PCS.
@@ -2077,6 +2079,51 @@ out:
@@ -2078,6 +2080,51 @@ out:
return ret;
}
@@ -162,7 +162,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
/**
* phylink_create() - create a phylink instance
* @config: a pointer to the target &struct phylink_config
@@ -2137,6 +2184,11 @@ struct phylink *phylink_create(struct ph
@@ -2138,6 +2185,11 @@ struct phylink *phylink_create(struct ph
pl->supported_interfaces,
pcs->supported_interfaces);
@@ -35,7 +35,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
/* Query inband for a specific interface mode, asking the MAC for the
* PCS which will be used to handle the interface mode.
*/
@@ -1817,6 +1823,8 @@ static void phylink_link_down(struct phy
@@ -1818,6 +1824,8 @@ static void phylink_link_down(struct phy
if (ndev)
netif_carrier_off(ndev);
@@ -46,7 +46,7 @@ Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
---
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -2735,6 +2735,12 @@ void phylink_start(struct phylink *pl)
@@ -2736,6 +2736,12 @@ void phylink_start(struct phylink *pl)
pl->pcs_state = PCS_STATE_STARTING;
@@ -59,7 +59,7 @@ Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
/* Apply the link configuration to the MAC when starting. This allows
* a fixed-link to start with the correct parameters, and also
* ensures that we set the appropriate advertisement for Serdes links.
@@ -2747,10 +2753,6 @@ void phylink_start(struct phylink *pl)
@@ -2748,10 +2754,6 @@ void phylink_start(struct phylink *pl)
pl->pcs_state = PCS_STATE_STARTED;
@@ -20,7 +20,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -2283,7 +2283,7 @@ int phylink_fwnode_phy_connect(struct ph
@@ -2284,7 +2284,7 @@ int phylink_fwnode_phy_connect(struct ph
{
struct fwnode_handle *phy_fwnode;
struct phy_device *phy_dev;
@@ -29,7 +29,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
/* Fixed links and 802.3z are handled without needing a PHY */
if (pl->cfg_link_an_mode == MLO_AN_FIXED ||
@@ -2313,6 +2313,25 @@ int phylink_fwnode_phy_connect(struct ph
@@ -2314,6 +2314,25 @@ int phylink_fwnode_phy_connect(struct ph
if (pl->config->mac_requires_rxc)
flags |= PHY_F_RXC_ALWAYS_ON;
@@ -41,7 +41,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
if (state->interface == PHY_INTERFACE_MODE_NA)
return phylink_validate_mask(pl, NULL, supported, state,
@@ -1857,6 +1862,9 @@ struct phylink *phylink_create(struct ph
@@ -1858,6 +1863,9 @@ struct phylink *phylink_create(struct ph
mutex_init(&pl->state_mutex);
INIT_WORK(&pl->resolve, phylink_resolve);
@@ -51,7 +51,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
pl->config = config;
if (config->type == PHYLINK_NETDEV) {
pl->netdev = to_net_dev(config->dev);
@@ -2016,7 +2024,7 @@ static int phylink_validate_phy(struct p
@@ -2017,7 +2025,7 @@ static int phylink_validate_phy(struct p
* those which the host supports.
*/
phy_interface_and(interfaces, phy->possible_interfaces,
@@ -60,7 +60,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
if (phy_interface_empty(interfaces)) {
phylink_err(pl, "PHY has no common interfaces\n");
@@ -2758,12 +2766,12 @@ static phy_interface_t phylink_sfp_selec
@@ -2759,12 +2767,12 @@ static phy_interface_t phylink_sfp_selec
return interface;
}
@@ -75,7 +75,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
return PHY_INTERFACE_MODE_NA;
}
@@ -3691,14 +3699,14 @@ static int phylink_sfp_config_optical(st
@@ -3692,14 +3700,14 @@ static int phylink_sfp_config_optical(st
phylink_dbg(pl, "optical SFP: interfaces=[mac=%*pbl, sfp=%*pbl]\n",
(int)PHY_INTERFACE_MODE_MAX,
@@ -92,7 +92,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
pl->sfp_interfaces);
if (phy_interface_empty(pl->sfp_interfaces)) {
phylink_err(pl, "unsupported SFP module: no common interface modes\n");
@@ -3869,7 +3877,7 @@ static int phylink_sfp_connect_phy(void
@@ -3870,7 +3878,7 @@ static int phylink_sfp_connect_phy(void
/* Set the PHY's host supported interfaces */
phy_interface_and(phy->host_interfaces, phylink_sfp_interfaces,
@@ -196,7 +196,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
return 0;
return phylink_pcs_inband_caps(pcs, interface);
@@ -1261,10 +1310,36 @@ static void phylink_major_config(struct
@@ -1262,10 +1311,36 @@ static void phylink_major_config(struct
pl->major_config_failed = true;
return;
}
@@ -234,7 +234,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
phylink_pcs_neg_mode(pl, pcs, state->interface, state->advertising);
phylink_dbg(pl, "major config, active %s/%s/%s\n",
@@ -1291,11 +1366,13 @@ static void phylink_major_config(struct
@@ -1292,11 +1367,13 @@ static void phylink_major_config(struct
if (pcs_changed) {
phylink_pcs_disable(pl->pcs);
@@ -252,7 +252,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
pl->pcs = pcs;
}
@@ -1823,6 +1900,44 @@ int phylink_set_fixed_link(struct phylin
@@ -1824,6 +1901,44 @@ int phylink_set_fixed_link(struct phylin
}
EXPORT_SYMBOL_GPL(phylink_set_fixed_link);
@@ -297,7 +297,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
/**
* phylink_create() - create a phylink instance
* @config: a pointer to the target &struct phylink_config
@@ -1844,6 +1959,7 @@ struct phylink *phylink_create(struct ph
@@ -1845,6 +1960,7 @@ struct phylink *phylink_create(struct ph
phy_interface_t iface,
const struct phylink_mac_ops *mac_ops)
{
@@ -305,7 +305,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
struct phylink *pl;
int ret;
@@ -1861,9 +1977,21 @@ struct phylink *phylink_create(struct ph
@@ -1862,9 +1978,21 @@ struct phylink *phylink_create(struct ph
mutex_init(&pl->phydev_mutex);
mutex_init(&pl->state_mutex);
INIT_WORK(&pl->resolve, phylink_resolve);
@@ -327,7 +327,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
pl->config = config;
if (config->type == PHYLINK_NETDEV) {
@@ -1943,10 +2071,16 @@ EXPORT_SYMBOL_GPL(phylink_create);
@@ -1944,10 +2072,16 @@ EXPORT_SYMBOL_GPL(phylink_create);
*/
void phylink_destroy(struct phylink *pl)
{
@@ -344,7 +344,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
cancel_work_sync(&pl->resolve);
kfree(pl);
}
@@ -2448,6 +2582,7 @@ static irqreturn_t phylink_link_handler(
@@ -2449,6 +2583,7 @@ static irqreturn_t phylink_link_handler(
*/
void phylink_start(struct phylink *pl)
{
@@ -352,7 +352,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
bool poll = false;
ASSERT_RTNL();
@@ -2474,6 +2609,10 @@ void phylink_start(struct phylink *pl)
@@ -2475,6 +2610,10 @@ void phylink_start(struct phylink *pl)
pl->pcs_state = PCS_STATE_STARTED;
@@ -363,7 +363,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
phylink_enable_and_run_resolve(pl, PHYLINK_DISABLE_STOPPED);
if (pl->cfg_link_an_mode == MLO_AN_FIXED && pl->link_gpio) {
@@ -2518,6 +2657,8 @@ EXPORT_SYMBOL_GPL(phylink_start);
@@ -2519,6 +2658,8 @@ EXPORT_SYMBOL_GPL(phylink_start);
*/
void phylink_stop(struct phylink *pl)
{
@@ -372,7 +372,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
ASSERT_RTNL();
if (pl->sfp_bus)
@@ -2535,6 +2676,14 @@ void phylink_stop(struct phylink *pl)
@@ -2536,6 +2677,14 @@ void phylink_stop(struct phylink *pl)
pl->pcs_state = PCS_STATE_DOWN;
phylink_pcs_disable(pl->pcs);
@@ -93,7 +93,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
static unsigned int phylink_pcs_inband_caps(struct phylink_pcs *pcs,
phy_interface_t interface)
{
@@ -1732,6 +1782,10 @@ static void phylink_resolve(struct work_
@@ -1733,6 +1783,10 @@ static void phylink_resolve(struct work_
if (phy)
link_state.link &= pl->phy_state.link;
@@ -104,7 +104,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
/* Only update if the PHY link is up */
if (phy && pl->phy_state.link) {
/* If the interface has changed, force a link down
@@ -1766,7 +1820,7 @@ static void phylink_resolve(struct work_
@@ -1767,7 +1821,7 @@ static void phylink_resolve(struct work_
phylink_apply_manual_flow(pl, &link_state);
if ((mac_config && link_state.interface != pl->link_config.interface) ||
@@ -113,7 +113,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
/* The interface has changed or a forced major configuration
* was requested, so force the link down and then reconfigure.
*/
@@ -1777,6 +1831,7 @@ static void phylink_resolve(struct work_
@@ -1778,6 +1832,7 @@ static void phylink_resolve(struct work_
phylink_major_config(pl, false, &link_state);
pl->link_config.interface = link_state.interface;
pl->force_major_config = false;
@@ -110,7 +110,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
/* What interface are supported by the current link.
* Can change on removal or addition of new PCS.
@@ -1993,6 +1995,51 @@ out:
@@ -1994,6 +1996,51 @@ out:
return ret;
}
@@ -162,7 +162,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
/**
* phylink_create() - create a phylink instance
* @config: a pointer to the target &struct phylink_config
@@ -2048,6 +2095,11 @@ struct phylink *phylink_create(struct ph
@@ -2049,6 +2096,11 @@ struct phylink *phylink_create(struct ph
pl->supported_interfaces,
pcs->supported_interfaces);
@@ -35,7 +35,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
static void phylink_pcs_disable_eee(struct phylink_pcs *pcs)
{
if (pcs && pcs->ops->pcs_disable_eee)
@@ -1725,6 +1731,8 @@ static void phylink_link_down(struct phy
@@ -1726,6 +1732,8 @@ static void phylink_link_down(struct phy
phylink_deactivate_lpi(pl);
@@ -46,7 +46,7 @@ Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
---
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -2712,6 +2712,12 @@ void phylink_start(struct phylink *pl)
@@ -2713,6 +2713,12 @@ void phylink_start(struct phylink *pl)
pl->pcs_state = PCS_STATE_STARTING;
@@ -59,7 +59,7 @@ Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
/* Apply the link configuration to the MAC when starting. This allows
* a fixed-link to start with the correct parameters, and also
* ensures that we set the appropriate advertisement for Serdes links.
@@ -2724,10 +2730,6 @@ void phylink_start(struct phylink *pl)
@@ -2725,10 +2731,6 @@ void phylink_start(struct phylink *pl)
pl->pcs_state = PCS_STATE_STARTED;