Skip to content

Commit 25179f8

Browse files
Russell King (Oracle)davem330
authored andcommitted
net: dsa: b53: switch to using phylink_generic_validate()
Switch the Broadcom b53 driver to using the phylink_generic_validate() implementation by removing its own .phylink_validate method and associated code. Signed-off-by: Russell King (Oracle) <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent cc6b68f commit 25179f8

File tree

5 files changed

+13
-76
lines changed

5 files changed

+13
-76
lines changed

drivers/net/dsa/b53/b53_common.c

Lines changed: 13 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,48 +1309,6 @@ void b53_port_event(struct dsa_switch *ds, int port)
13091309
}
13101310
EXPORT_SYMBOL(b53_port_event);
13111311

1312-
void b53_phylink_validate(struct dsa_switch *ds, int port,
1313-
unsigned long *supported,
1314-
struct phylink_link_state *state)
1315-
{
1316-
struct b53_device *dev = ds->priv;
1317-
__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
1318-
1319-
if (dev->ops->serdes_phylink_validate)
1320-
dev->ops->serdes_phylink_validate(dev, port, mask, state);
1321-
1322-
/* Allow all the expected bits */
1323-
phylink_set(mask, Autoneg);
1324-
phylink_set_port_modes(mask);
1325-
phylink_set(mask, Pause);
1326-
phylink_set(mask, Asym_Pause);
1327-
1328-
/* With the exclusion of 5325/5365, MII, Reverse MII and 802.3z, we
1329-
* support Gigabit, including Half duplex.
1330-
*
1331-
* FIXME: this is weird - 802.3z is always Gigabit, but we exclude
1332-
* it here. Why? This makes no sense.
1333-
*/
1334-
if (!(state->interface == PHY_INTERFACE_MODE_MII ||
1335-
state->interface == PHY_INTERFACE_MODE_REVMII ||
1336-
phy_interface_mode_is_8023z(state->interface) ||
1337-
is5325(dev) || is5365(dev))) {
1338-
phylink_set(mask, 1000baseT_Full);
1339-
phylink_set(mask, 1000baseT_Half);
1340-
}
1341-
1342-
if (!phy_interface_mode_is_8023z(state->interface)) {
1343-
phylink_set(mask, 10baseT_Half);
1344-
phylink_set(mask, 10baseT_Full);
1345-
phylink_set(mask, 100baseT_Half);
1346-
phylink_set(mask, 100baseT_Full);
1347-
}
1348-
1349-
linkmode_and(supported, supported, mask);
1350-
linkmode_and(state->advertising, state->advertising, mask);
1351-
}
1352-
EXPORT_SYMBOL(b53_phylink_validate);
1353-
13541312
static void b53_phylink_get_caps(struct dsa_switch *ds, int port,
13551313
struct phylink_config *config)
13561314
{
@@ -1362,14 +1320,26 @@ static void b53_phylink_get_caps(struct dsa_switch *ds, int port,
13621320
/* These switches appear to support MII and RevMII too, but beyond
13631321
* this, the code gives very few clues. FIXME: We probably need more
13641322
* interface modes here.
1323+
*
1324+
* According to b53_srab_mux_init(), ports 3..5 can support:
1325+
* SGMII, MII, GMII, RGMII or INTERNAL depending on the MUX setting.
1326+
* However, the interface mode read from the MUX configuration is
1327+
* not passed back to DSA, so phylink uses NA.
1328+
* DT can specify RGMII for ports 0, 1.
1329+
* For MDIO, port 8 can be RGMII_TXID.
13651330
*/
13661331
__set_bit(PHY_INTERFACE_MODE_MII, config->supported_interfaces);
13671332
__set_bit(PHY_INTERFACE_MODE_REVMII, config->supported_interfaces);
13681333

13691334
config->mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE |
13701335
MAC_10 | MAC_100;
13711336

1372-
/* 5325/5365 are not capable of gigabit speeds, everything else is */
1337+
/* 5325/5365 are not capable of gigabit speeds, everything else is.
1338+
* Note: the original code also exclulded Gigagbit for MII, RevMII
1339+
* and 802.3z modes. MII and RevMII are not able to work above 100M,
1340+
* so will be excluded by the generic validator implementation.
1341+
* However, the exclusion of Gigabit for 802.3z just seems wrong.
1342+
*/
13731343
if (!(is5325(dev) || is5365(dev)))
13741344
config->mac_capabilities |= MAC_1000;
13751345

@@ -2288,7 +2258,6 @@ static const struct dsa_switch_ops b53_switch_ops = {
22882258
.phy_write = b53_phy_write16,
22892259
.adjust_link = b53_adjust_link,
22902260
.phylink_get_caps = b53_phylink_get_caps,
2291-
.phylink_validate = b53_phylink_validate,
22922261
.phylink_mac_link_state = b53_phylink_mac_link_state,
22932262
.phylink_mac_config = b53_phylink_mac_config,
22942263
.phylink_mac_an_restart = b53_phylink_mac_an_restart,

drivers/net/dsa/b53/b53_priv.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ struct b53_io_ops {
5858
void (*serdes_link_set)(struct b53_device *dev, int port,
5959
unsigned int mode, phy_interface_t interface,
6060
bool link_up);
61-
void (*serdes_phylink_validate)(struct b53_device *dev, int port,
62-
unsigned long *supported,
63-
struct phylink_link_state *state);
6461
};
6562

6663
#define B53_INVALID_LANE 0xff
@@ -339,9 +336,6 @@ int b53_br_flags(struct dsa_switch *ds, int port,
339336
struct netlink_ext_ack *extack);
340337
int b53_setup_devlink_resources(struct dsa_switch *ds);
341338
void b53_port_event(struct dsa_switch *ds, int port);
342-
void b53_phylink_validate(struct dsa_switch *ds, int port,
343-
unsigned long *supported,
344-
struct phylink_link_state *state);
345339
int b53_phylink_mac_link_state(struct dsa_switch *ds, int port,
346340
struct phylink_link_state *state);
347341
void b53_phylink_mac_config(struct dsa_switch *ds, int port,

drivers/net/dsa/b53/b53_serdes.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -158,28 +158,6 @@ void b53_serdes_link_set(struct b53_device *dev, int port, unsigned int mode,
158158
}
159159
EXPORT_SYMBOL(b53_serdes_link_set);
160160

161-
void b53_serdes_phylink_validate(struct b53_device *dev, int port,
162-
unsigned long *supported,
163-
struct phylink_link_state *state)
164-
{
165-
u8 lane = b53_serdes_map_lane(dev, port);
166-
167-
if (lane == B53_INVALID_LANE)
168-
return;
169-
170-
switch (lane) {
171-
case 0:
172-
phylink_set(supported, 2500baseX_Full);
173-
fallthrough;
174-
case 1:
175-
phylink_set(supported, 1000baseX_Full);
176-
break;
177-
default:
178-
break;
179-
}
180-
}
181-
EXPORT_SYMBOL(b53_serdes_phylink_validate);
182-
183161
void b53_serdes_phylink_get_caps(struct b53_device *dev, int port,
184162
struct phylink_config *config)
185163
{

drivers/net/dsa/b53/b53_serdes.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,6 @@ void b53_serdes_link_set(struct b53_device *dev, int port, unsigned int mode,
117117
phy_interface_t interface, bool link_up);
118118
void b53_serdes_phylink_get_caps(struct b53_device *dev, int port,
119119
struct phylink_config *config);
120-
void b53_serdes_phylink_validate(struct b53_device *dev, int port,
121-
unsigned long *supported,
122-
struct phylink_link_state *state);
123120
#if IS_ENABLED(CONFIG_B53_SERDES)
124121
int b53_serdes_init(struct b53_device *dev, int port);
125122
#else

drivers/net/dsa/b53/b53_srab.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,6 @@ static const struct b53_io_ops b53_srab_ops = {
496496
.serdes_config = b53_serdes_config,
497497
.serdes_an_restart = b53_serdes_an_restart,
498498
.serdes_link_set = b53_serdes_link_set,
499-
.serdes_phylink_validate = b53_serdes_phylink_validate,
500499
#endif
501500
};
502501

0 commit comments

Comments
 (0)