All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	privat@egil-hjelmeland.no, andrew@lunn.ch,
	vivien.didelot@savoirfairelinux.com, davem@davemloft.net,
	rmk+kernel@armlinux.org.uk, sean.wang@mediatek.com,
	Woojung.Huh@microchip.com, john@phrozen.org, cphealy@gmail.com
Subject: [PATCH net-next 9/9] net: dsa: bcm_sf2: Get rid of PHYLIB functions
Date: Sat,  5 May 2018 12:04:25 -0700	[thread overview]
Message-ID: <20180505190425.14378-10-f.fainelli@gmail.com> (raw)
In-Reply-To: <20180505190425.14378-1-f.fainelli@gmail.com>

Now that we have converted the bcm_sf2 driver to implement PHYLINK MAC
operations, we can remove the PHYLIB callbacks: adjust_link() and
fixed_link_update() which are no longer called by DSA.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/dsa/bcm_sf2.c | 149 --------------------------------------
 1 file changed, 149 deletions(-)

diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index a20608b0329e..ac621f44237a 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -480,153 +480,6 @@ static u32 bcm_sf2_sw_get_phy_flags(struct dsa_switch *ds, int port)
 	return priv->hw_params.gphy_rev;
 }
 
-static void bcm_sf2_sw_adjust_link(struct dsa_switch *ds, int port,
-				   struct phy_device *phydev)
-{
-	struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
-	struct ethtool_eee *p = &priv->dev->ports[port].eee;
-	u32 id_mode_dis = 0, port_mode;
-	const char *str = NULL;
-	u32 reg, offset;
-
-	if (priv->type == BCM7445_DEVICE_ID)
-		offset = CORE_STS_OVERRIDE_GMIIP_PORT(port);
-	else
-		offset = CORE_STS_OVERRIDE_GMIIP2_PORT(port);
-
-	switch (phydev->interface) {
-	case PHY_INTERFACE_MODE_RGMII:
-		str = "RGMII (no delay)";
-		id_mode_dis = 1;
-	case PHY_INTERFACE_MODE_RGMII_TXID:
-		if (!str)
-			str = "RGMII (TX delay)";
-		port_mode = EXT_GPHY;
-		break;
-	case PHY_INTERFACE_MODE_MII:
-		str = "MII";
-		port_mode = EXT_EPHY;
-		break;
-	case PHY_INTERFACE_MODE_REVMII:
-		str = "Reverse MII";
-		port_mode = EXT_REVMII;
-		break;
-	default:
-		/* All other PHYs: internal and MoCA */
-		goto force_link;
-	}
-
-	/* If the link is down, just disable the interface to conserve power */
-	if (!phydev->link) {
-		reg = reg_readl(priv, REG_RGMII_CNTRL_P(port));
-		reg &= ~RGMII_MODE_EN;
-		reg_writel(priv, reg, REG_RGMII_CNTRL_P(port));
-		goto force_link;
-	}
-
-	/* Clear id_mode_dis bit, and the existing port mode, but
-	 * make sure we enable the RGMII block for data to pass
-	 */
-	reg = reg_readl(priv, REG_RGMII_CNTRL_P(port));
-	reg &= ~ID_MODE_DIS;
-	reg &= ~(PORT_MODE_MASK << PORT_MODE_SHIFT);
-	reg &= ~(RX_PAUSE_EN | TX_PAUSE_EN);
-
-	reg |= port_mode | RGMII_MODE_EN;
-	if (id_mode_dis)
-		reg |= ID_MODE_DIS;
-
-	if (phydev->pause) {
-		if (phydev->asym_pause)
-			reg |= TX_PAUSE_EN;
-		reg |= RX_PAUSE_EN;
-	}
-
-	reg_writel(priv, reg, REG_RGMII_CNTRL_P(port));
-
-	pr_info("Port %d configured for %s\n", port, str);
-
-force_link:
-	/* Force link settings detected from the PHY */
-	reg = SW_OVERRIDE;
-	switch (phydev->speed) {
-	case SPEED_1000:
-		reg |= SPDSTS_1000 << SPEED_SHIFT;
-		break;
-	case SPEED_100:
-		reg |= SPDSTS_100 << SPEED_SHIFT;
-		break;
-	}
-
-	if (phydev->link)
-		reg |= LINK_STS;
-	if (phydev->duplex == DUPLEX_FULL)
-		reg |= DUPLX_MODE;
-
-	core_writel(priv, reg, offset);
-
-	if (!phydev->is_pseudo_fixed_link)
-		p->eee_enabled = b53_eee_init(ds, port, phydev);
-}
-
-static void bcm_sf2_sw_fixed_link_update(struct dsa_switch *ds, int port,
-					 struct fixed_phy_status *status)
-{
-	struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
-	u32 duplex, pause, offset;
-	u32 reg;
-
-	if (priv->type == BCM7445_DEVICE_ID)
-		offset = CORE_STS_OVERRIDE_GMIIP_PORT(port);
-	else
-		offset = CORE_STS_OVERRIDE_GMIIP2_PORT(port);
-
-	duplex = core_readl(priv, CORE_DUPSTS);
-	pause = core_readl(priv, CORE_PAUSESTS);
-
-	status->link = 0;
-
-	/* MoCA port is special as we do not get link status from CORE_LNKSTS,
-	 * which means that we need to force the link at the port override
-	 * level to get the data to flow. We do use what the interrupt handler
-	 * did determine before.
-	 *
-	 * For the other ports, we just force the link status, since this is
-	 * a fixed PHY device.
-	 */
-	if (port == priv->moca_port) {
-		status->link = priv->port_sts[port].link;
-		/* For MoCA interfaces, also force a link down notification
-		 * since some version of the user-space daemon (mocad) use
-		 * cmd->autoneg to force the link, which messes up the PHY
-		 * state machine and make it go in PHY_FORCING state instead.
-		 */
-		if (!status->link)
-			netif_carrier_off(ds->ports[port].slave);
-		status->duplex = 1;
-	} else {
-		status->link = 1;
-		status->duplex = !!(duplex & (1 << port));
-	}
-
-	reg = core_readl(priv, offset);
-	reg |= SW_OVERRIDE;
-	if (status->link)
-		reg |= LINK_STS;
-	else
-		reg &= ~LINK_STS;
-	core_writel(priv, reg, offset);
-
-	if ((pause & (1 << port)) &&
-	    (pause & (1 << (port + PAUSESTS_TX_PAUSE_SHIFT)))) {
-		status->asym_pause = 1;
-		status->pause = 1;
-	}
-
-	if (pause & (1 << port))
-		status->pause = 1;
-}
-
 static void bcm_sf2_sw_validate(struct dsa_switch *ds, int port,
 				unsigned long *supported,
 				struct phylink_link_state *state)
@@ -1054,8 +907,6 @@ static const struct dsa_switch_ops bcm_sf2_ops = {
 	.get_sset_count		= b53_get_sset_count,
 	.get_ethtool_phy_stats	= b53_get_ethtool_phy_stats,
 	.get_phy_flags		= bcm_sf2_sw_get_phy_flags,
-	.adjust_link		= bcm_sf2_sw_adjust_link,
-	.fixed_link_update	= bcm_sf2_sw_fixed_link_update,
 	.phylink_validate	= bcm_sf2_sw_validate,
 	.phylink_mac_config	= bcm_sf2_sw_mac_config,
 	.phylink_mac_link_down	= bcm_sf2_sw_mac_link_down,
-- 
2.17.0

  parent reply	other threads:[~2018-05-05 19:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-05 19:04 [PATCH net-next 0/9] net: dsa: Plug in PHYLINK support Florian Fainelli
2018-05-05 19:04 ` [PATCH net-next 1/9] net: phy: phylink: Use gpiod_get_value_cansleep() Florian Fainelli
2018-05-05 19:04 ` [PATCH net-next 2/9] net: phy: phylink: Release link GPIO Florian Fainelli
2018-05-05 19:04 ` [PATCH net-next 3/9] net: phy: phylink: Poll link GPIOs Florian Fainelli
2018-05-05 19:04 ` [PATCH net-next 4/9] net: dsa: Add PHYLINK switch operations Florian Fainelli
2018-05-05 19:04 ` [PATCH net-next 5/9] net: dsa: bcm_sf2: Implement phylink_mac_ops Florian Fainelli
2018-05-05 19:04 ` [PATCH net-next 6/9] net: dsa: Eliminate dsa_slave_get_link() Florian Fainelli
2018-05-05 19:04 ` [PATCH net-next 7/9] net: dsa: mv88e6xxx: add PHYLINK support Florian Fainelli
2018-05-06 17:26   ` Andrew Lunn
2018-05-06 17:45     ` Florian Fainelli
2018-05-05 19:04 ` [PATCH net-next 8/9] net: dsa: Plug in " Florian Fainelli
2018-05-05 19:04 ` Florian Fainelli [this message]
2018-05-09  0:17 ` [PATCH net-next 0/9] " David Miller
2018-05-09  0:20   ` Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180505190425.14378-10-f.fainelli@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=Woojung.Huh@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=cphealy@gmail.com \
    --cc=davem@davemloft.net \
    --cc=john@phrozen.org \
    --cc=netdev@vger.kernel.org \
    --cc=privat@egil-hjelmeland.no \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=sean.wang@mediatek.com \
    --cc=vivien.didelot@savoirfairelinux.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.