mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-28 17:48:58 +00:00
75 lines
2.7 KiB
Diff
75 lines
2.7 KiB
Diff
|
From c12db737cf62ca262c01ec6d4ba942b34db35d8b Mon Sep 17 00:00:00 2001
|
||
|
From: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||
|
Date: Fri, 27 Dec 2019 19:45:22 +0200
|
||
|
Subject: [PATCH] net: phylink: add support for polling MAC PCS
|
||
|
|
||
|
Some MAC PCS blocks are unable to provide interrupts when their status
|
||
|
changes. As we already have support in phylink for polling status, use
|
||
|
this to provide a hook for MACs to enable polling mode.
|
||
|
|
||
|
The patch idea was picked up from Russell King's suggestion on the macb
|
||
|
phylink patch thread here [0] but the implementation was changed.
|
||
|
Instead of introducing a new phylink_start_poll() function, which would
|
||
|
make the implementation cumbersome for common PHYLINK implementations
|
||
|
for multiple types of devices, like DSA, just add a boolean property to
|
||
|
the phylink_config structure, which is just as backwards-compatible.
|
||
|
|
||
|
https://lkml.org/lkml/2019/12/16/603
|
||
|
|
||
|
Suggested-by: Russell King <rmk+kernel@armlinux.org.uk>
|
||
|
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||
|
[rebase]
|
||
|
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
|
||
|
|
||
|
Conflicts:
|
||
|
drivers/net/phy/phylink.c
|
||
|
|
||
|
with upstream commit 24cf0e693bb5 ("net: phylink: split link_an_mode
|
||
|
configured and current settings") submitted for net-next and merged
|
||
|
during v5.5-rc1.
|
||
|
---
|
||
|
Documentation/networking/sfp-phylink.rst | 3 ++-
|
||
|
drivers/net/phy/phylink.c | 3 ++-
|
||
|
include/linux/phylink.h | 2 ++
|
||
|
3 files changed, 6 insertions(+), 2 deletions(-)
|
||
|
|
||
|
--- a/Documentation/networking/sfp-phylink.rst
|
||
|
+++ b/Documentation/networking/sfp-phylink.rst
|
||
|
@@ -251,7 +251,8 @@ this documentation.
|
||
|
phylink_mac_change(priv->phylink, link_is_up);
|
||
|
|
||
|
where ``link_is_up`` is true if the link is currently up or false
|
||
|
- otherwise.
|
||
|
+ otherwise. If a MAC is unable to provide these interrupts, then
|
||
|
+ it should set ``priv->phylink_config.pcs_poll = true;`` in step 9.
|
||
|
|
||
|
11. Verify that the driver does not call::
|
||
|
|
||
|
--- a/drivers/net/phy/phylink.c
|
||
|
+++ b/drivers/net/phy/phylink.c
|
||
|
@@ -1008,7 +1008,8 @@ void phylink_start(struct phylink *pl)
|
||
|
if (irq <= 0)
|
||
|
mod_timer(&pl->link_poll, jiffies + HZ);
|
||
|
}
|
||
|
- if (pl->cfg_link_an_mode == MLO_AN_FIXED && pl->get_fixed_state)
|
||
|
+ if ((pl->cfg_link_an_mode == MLO_AN_FIXED && pl->get_fixed_state) ||
|
||
|
+ pl->config->pcs_poll)
|
||
|
mod_timer(&pl->link_poll, jiffies + HZ);
|
||
|
if (pl->phydev)
|
||
|
phy_start(pl->phydev);
|
||
|
--- a/include/linux/phylink.h
|
||
|
+++ b/include/linux/phylink.h
|
||
|
@@ -63,10 +63,12 @@ enum phylink_op_type {
|
||
|
* struct phylink_config - PHYLINK configuration structure
|
||
|
* @dev: a pointer to a struct device associated with the MAC
|
||
|
* @type: operation type of PHYLINK instance
|
||
|
+ * @pcs_poll: MAC PCS cannot provide link change interrupt
|
||
|
*/
|
||
|
struct phylink_config {
|
||
|
struct device *dev;
|
||
|
enum phylink_op_type type;
|
||
|
+ bool pcs_poll;
|
||
|
};
|
||
|
|
||
|
/**
|