Skip to content

Commit b7d286f

Browse files
Russell Kingdavem330
authored andcommitted
net: marvell: mvpp2: add mvpp2_is_xlg() helper
Add a mvpp2_is_xlg() helper to identify whether the interface mode should be using the XLGMAC rather than the GMAC. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 86e5813 commit b7d286f

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,11 @@ mvpp2_shared_interrupt_mask_unmask(struct mvpp2_port *port, bool mask)
965965
}
966966

967967
/* Port configuration routines */
968+
static bool mvpp2_is_xlg(phy_interface_t interface)
969+
{
970+
return interface == PHY_INTERFACE_MODE_10GKR ||
971+
interface == PHY_INTERFACE_MODE_XAUI;
972+
}
968973

969974
static void mvpp22_gop_init_rgmii(struct mvpp2_port *port)
970975
{
@@ -1181,9 +1186,7 @@ static void mvpp2_port_enable(struct mvpp2_port *port)
11811186
u32 val;
11821187

11831188
/* Only GOP port 0 has an XLG MAC */
1184-
if (port->gop_id == 0 &&
1185-
(port->phy_interface == PHY_INTERFACE_MODE_XAUI ||
1186-
port->phy_interface == PHY_INTERFACE_MODE_10GKR)) {
1189+
if (port->gop_id == 0 && mvpp2_is_xlg(port->phy_interface)) {
11871190
val = readl(port->base + MVPP22_XLG_CTRL0_REG);
11881191
val |= MVPP22_XLG_CTRL0_PORT_EN |
11891192
MVPP22_XLG_CTRL0_MAC_RESET_DIS;
@@ -1202,9 +1205,7 @@ static void mvpp2_port_disable(struct mvpp2_port *port)
12021205
u32 val;
12031206

12041207
/* Only GOP port 0 has an XLG MAC */
1205-
if (port->gop_id == 0 &&
1206-
(port->phy_interface == PHY_INTERFACE_MODE_XAUI ||
1207-
port->phy_interface == PHY_INTERFACE_MODE_10GKR)) {
1208+
if (port->gop_id == 0 && mvpp2_is_xlg(port->phy_interface)) {
12081209
val = readl(port->base + MVPP22_XLG_CTRL0_REG);
12091210
val &= ~MVPP22_XLG_CTRL0_PORT_EN;
12101211
writel(val, port->base + MVPP22_XLG_CTRL0_REG);
@@ -3146,18 +3147,15 @@ static void mvpp22_mode_reconfigure(struct mvpp2_port *port)
31463147
ctrl3 = readl(port->base + MVPP22_XLG_CTRL3_REG);
31473148
ctrl3 &= ~MVPP22_XLG_CTRL3_MACMODESELECT_MASK;
31483149

3149-
if (port->phy_interface == PHY_INTERFACE_MODE_XAUI ||
3150-
port->phy_interface == PHY_INTERFACE_MODE_10GKR)
3150+
if (mvpp2_is_xlg(port->phy_interface))
31513151
ctrl3 |= MVPP22_XLG_CTRL3_MACMODESELECT_10G;
31523152
else
31533153
ctrl3 |= MVPP22_XLG_CTRL3_MACMODESELECT_GMAC;
31543154

31553155
writel(ctrl3, port->base + MVPP22_XLG_CTRL3_REG);
31563156
}
31573157

3158-
if (port->gop_id == 0 &&
3159-
(port->phy_interface == PHY_INTERFACE_MODE_XAUI ||
3160-
port->phy_interface == PHY_INTERFACE_MODE_10GKR))
3158+
if (port->gop_id == 0 && mvpp2_is_xlg(port->phy_interface))
31613159
mvpp2_xlg_max_rx_size_set(port);
31623160
else
31633161
mvpp2_gmac_max_rx_size_set(port);

0 commit comments

Comments
 (0)