Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1721729
| From | Antoine Tenart <antoine.tenart@free-electrons.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH net-next v3 08/13] net: mvpp2: dynamic reconfiguration of the comphy/GoP/MAC |
| Date | 2017-08-28 17:10 +0200 |
| Message-ID | <ujtPS-78t-53@gated-at.bofh.it> (permalink) |
| References | <ujtGa-6PN-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
This patch adds logic to reconfigure the comphy/GoP/MAC when the link
state is updated at runtime. This is very useful on boards where many
link speed are supported: depending on what is negotiated the PPv2
driver will automatically reconfigures the link between the PHY and the
MAC.
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
drivers/net/ethernet/marvell/mvpp2.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index 2f05a0b0773c..9e64b1ba3d43 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -5771,9 +5771,28 @@ static void mvpp2_link_event(struct net_device *dev)
{
struct mvpp2_port *port = netdev_priv(dev);
struct phy_device *phydev = dev->phydev;
+ bool link_reconfigured = false;
u32 val;
if (phydev->link) {
+ if (port->phy_interface != phydev->interface && port->comphy) {
+ /* disable current port for reconfiguration */
+ mvpp2_interrupts_disable(port);
+ netif_carrier_off(port->dev);
+ mvpp2_port_disable(port);
+ phy_power_off(port->comphy);
+
+ /* comphy reconfiguration */
+ port->phy_interface = phydev->interface;
+ mvpp22_comphy_init(port);
+
+ /* gop/mac reconfiguration */
+ mvpp22_gop_init(port);
+ mvpp2_port_mii_set(port);
+
+ link_reconfigured = true;
+ }
+
if ((port->speed != phydev->speed) ||
(port->duplex != phydev->duplex)) {
mvpp2_gmac_set_autoneg(port, phydev);
@@ -5783,7 +5802,7 @@ static void mvpp2_link_event(struct net_device *dev)
}
}
- if (phydev->link != port->link) {
+ if (phydev->link != port->link || link_reconfigured) {
port->link = phydev->link;
if (phydev->link) {
--
2.13.5
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH net-next v3 00/13] net: mvpp2: comphy configuration Antoine Tenart <antoine.tenart@free-electrons.com> - 2017-08-28 17:10 +0200 [PATCH net-next v3 07/13] net: mvpp2: do not set GMAC autoneg when using XLG MAC Antoine Tenart <antoine.tenart@free-electrons.com> - 2017-08-28 17:10 +0200 [PATCH net-next v3 13/13] arm64: defconfig: enable Marvell CP110 comphy Antoine Tenart <antoine.tenart@free-electrons.com> - 2017-08-28 17:10 +0200 [PATCH net-next v3 08/13] net: mvpp2: dynamic reconfiguration of the comphy/GoP/MAC Antoine Tenart <antoine.tenart@free-electrons.com> - 2017-08-28 17:10 +0200
csiph-web