Commit 4a4cec72 authored by Russell King's avatar Russell King Committed by David S. Miller

net: marvell: mvpp2: use phy_interface_mode_is_8023z() helper

Use the phy_interface_mode_is_8023z() helper for detecting interface
modes that use 802.3z serial encoding.  This is equivalent to testing
for both 1000base-X and 2500base-X.
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7194d92b
...@@ -1090,9 +1090,8 @@ static void mvpp22_gop_unmask_irq(struct mvpp2_port *port) ...@@ -1090,9 +1090,8 @@ static void mvpp22_gop_unmask_irq(struct mvpp2_port *port)
u32 val; u32 val;
if (phy_interface_mode_is_rgmii(port->phy_interface) || if (phy_interface_mode_is_rgmii(port->phy_interface) ||
port->phy_interface == PHY_INTERFACE_MODE_SGMII || phy_interface_mode_is_8023z(port->phy_interface) ||
port->phy_interface == PHY_INTERFACE_MODE_1000BASEX || port->phy_interface == PHY_INTERFACE_MODE_SGMII) {
port->phy_interface == PHY_INTERFACE_MODE_2500BASEX) {
/* Enable the GMAC link status irq for this port */ /* Enable the GMAC link status irq for this port */
val = readl(port->base + MVPP22_GMAC_INT_SUM_MASK); val = readl(port->base + MVPP22_GMAC_INT_SUM_MASK);
val |= MVPP22_GMAC_INT_SUM_MASK_LINK_STAT; val |= MVPP22_GMAC_INT_SUM_MASK_LINK_STAT;
...@@ -1122,9 +1121,8 @@ static void mvpp22_gop_mask_irq(struct mvpp2_port *port) ...@@ -1122,9 +1121,8 @@ static void mvpp22_gop_mask_irq(struct mvpp2_port *port)
} }
if (phy_interface_mode_is_rgmii(port->phy_interface) || if (phy_interface_mode_is_rgmii(port->phy_interface) ||
port->phy_interface == PHY_INTERFACE_MODE_SGMII || phy_interface_mode_is_8023z(port->phy_interface) ||
port->phy_interface == PHY_INTERFACE_MODE_1000BASEX || port->phy_interface == PHY_INTERFACE_MODE_SGMII) {
port->phy_interface == PHY_INTERFACE_MODE_2500BASEX) {
val = readl(port->base + MVPP22_GMAC_INT_SUM_MASK); val = readl(port->base + MVPP22_GMAC_INT_SUM_MASK);
val &= ~MVPP22_GMAC_INT_SUM_MASK_LINK_STAT; val &= ~MVPP22_GMAC_INT_SUM_MASK_LINK_STAT;
writel(val, port->base + MVPP22_GMAC_INT_SUM_MASK); writel(val, port->base + MVPP22_GMAC_INT_SUM_MASK);
...@@ -1136,9 +1134,8 @@ static void mvpp22_gop_setup_irq(struct mvpp2_port *port) ...@@ -1136,9 +1134,8 @@ static void mvpp22_gop_setup_irq(struct mvpp2_port *port)
u32 val; u32 val;
if (phy_interface_mode_is_rgmii(port->phy_interface) || if (phy_interface_mode_is_rgmii(port->phy_interface) ||
port->phy_interface == PHY_INTERFACE_MODE_SGMII || phy_interface_mode_is_8023z(port->phy_interface) ||
port->phy_interface == PHY_INTERFACE_MODE_1000BASEX || port->phy_interface == PHY_INTERFACE_MODE_SGMII) {
port->phy_interface == PHY_INTERFACE_MODE_2500BASEX) {
val = readl(port->base + MVPP22_GMAC_INT_MASK); val = readl(port->base + MVPP22_GMAC_INT_MASK);
val |= MVPP22_GMAC_INT_MASK_LINK_STAT; val |= MVPP22_GMAC_INT_MASK_LINK_STAT;
writel(val, port->base + MVPP22_GMAC_INT_MASK); writel(val, port->base + MVPP22_GMAC_INT_MASK);
...@@ -1244,9 +1241,8 @@ static void mvpp2_port_loopback_set(struct mvpp2_port *port, ...@@ -1244,9 +1241,8 @@ static void mvpp2_port_loopback_set(struct mvpp2_port *port,
else else
val &= ~MVPP2_GMAC_GMII_LB_EN_MASK; val &= ~MVPP2_GMAC_GMII_LB_EN_MASK;
if (port->phy_interface == PHY_INTERFACE_MODE_SGMII || if (phy_interface_mode_is_8023z(port->phy_interface) ||
port->phy_interface == PHY_INTERFACE_MODE_1000BASEX || port->phy_interface == PHY_INTERFACE_MODE_SGMII)
port->phy_interface == PHY_INTERFACE_MODE_2500BASEX)
val |= MVPP2_GMAC_PCS_LB_EN_MASK; val |= MVPP2_GMAC_PCS_LB_EN_MASK;
else else
val &= ~MVPP2_GMAC_PCS_LB_EN_MASK; val &= ~MVPP2_GMAC_PCS_LB_EN_MASK;
...@@ -2472,9 +2468,8 @@ static irqreturn_t mvpp2_link_status_isr(int irq, void *dev_id) ...@@ -2472,9 +2468,8 @@ static irqreturn_t mvpp2_link_status_isr(int irq, void *dev_id)
link = true; link = true;
} }
} else if (phy_interface_mode_is_rgmii(port->phy_interface) || } else if (phy_interface_mode_is_rgmii(port->phy_interface) ||
port->phy_interface == PHY_INTERFACE_MODE_SGMII || phy_interface_mode_is_8023z(port->phy_interface) ||
port->phy_interface == PHY_INTERFACE_MODE_1000BASEX || port->phy_interface == PHY_INTERFACE_MODE_SGMII) {
port->phy_interface == PHY_INTERFACE_MODE_2500BASEX) {
val = readl(port->base + MVPP22_GMAC_INT_STAT); val = readl(port->base + MVPP22_GMAC_INT_STAT);
if (val & MVPP22_GMAC_INT_STAT_LINK) { if (val & MVPP22_GMAC_INT_STAT_LINK) {
event = true; event = true;
...@@ -4566,8 +4561,7 @@ static void mvpp2_gmac_config(struct mvpp2_port *port, unsigned int mode, ...@@ -4566,8 +4561,7 @@ static void mvpp2_gmac_config(struct mvpp2_port *port, unsigned int mode,
ctrl0 &= ~MVPP2_GMAC_PORT_TYPE_MASK; ctrl0 &= ~MVPP2_GMAC_PORT_TYPE_MASK;
ctrl2 &= ~(MVPP2_GMAC_PORT_RESET_MASK | MVPP2_GMAC_PCS_ENABLE_MASK); ctrl2 &= ~(MVPP2_GMAC_PORT_RESET_MASK | MVPP2_GMAC_PCS_ENABLE_MASK);
if (state->interface == PHY_INTERFACE_MODE_1000BASEX || if (phy_interface_mode_is_8023z(state->interface)) {
state->interface == PHY_INTERFACE_MODE_2500BASEX) {
/* 1000BaseX and 2500BaseX ports cannot negotiate speed nor can /* 1000BaseX and 2500BaseX ports cannot negotiate speed nor can
* they negotiate duplex: they are always operating with a fixed * they negotiate duplex: they are always operating with a fixed
* speed of 1000/2500Mbps in full duplex, so force 1000/2500 * speed of 1000/2500Mbps in full duplex, so force 1000/2500
...@@ -4587,9 +4581,8 @@ static void mvpp2_gmac_config(struct mvpp2_port *port, unsigned int mode, ...@@ -4587,9 +4581,8 @@ static void mvpp2_gmac_config(struct mvpp2_port *port, unsigned int mode,
if (phylink_test(state->advertising, Asym_Pause)) if (phylink_test(state->advertising, Asym_Pause))
an |= MVPP2_GMAC_FC_ADV_ASM_EN; an |= MVPP2_GMAC_FC_ADV_ASM_EN;
if (state->interface == PHY_INTERFACE_MODE_SGMII || if (phy_interface_mode_is_8023z(state->interface) ||
state->interface == PHY_INTERFACE_MODE_1000BASEX || state->interface == PHY_INTERFACE_MODE_SGMII) {
state->interface == PHY_INTERFACE_MODE_2500BASEX) {
an |= MVPP2_GMAC_IN_BAND_AUTONEG; an |= MVPP2_GMAC_IN_BAND_AUTONEG;
ctrl2 |= MVPP2_GMAC_INBAND_AN_MASK | MVPP2_GMAC_PCS_ENABLE_MASK; ctrl2 |= MVPP2_GMAC_INBAND_AN_MASK | MVPP2_GMAC_PCS_ENABLE_MASK;
...@@ -4650,9 +4643,8 @@ static void mvpp2_mac_config(struct net_device *dev, unsigned int mode, ...@@ -4650,9 +4643,8 @@ static void mvpp2_mac_config(struct net_device *dev, unsigned int mode,
if (state->interface == PHY_INTERFACE_MODE_10GKR) if (state->interface == PHY_INTERFACE_MODE_10GKR)
mvpp2_xlg_config(port, mode, state); mvpp2_xlg_config(port, mode, state);
else if (phy_interface_mode_is_rgmii(state->interface) || else if (phy_interface_mode_is_rgmii(state->interface) ||
state->interface == PHY_INTERFACE_MODE_SGMII || phy_interface_mode_is_8023z(state->interface) ||
state->interface == PHY_INTERFACE_MODE_1000BASEX || state->interface == PHY_INTERFACE_MODE_SGMII)
state->interface == PHY_INTERFACE_MODE_2500BASEX)
mvpp2_gmac_config(port, mode, state); mvpp2_gmac_config(port, mode, state);
if (port->priv->hw_version == MVPP21 && port->flags & MVPP2_F_LOOPBACK) if (port->priv->hw_version == MVPP21 && port->flags & MVPP2_F_LOOPBACK)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment