Commit 968d068e authored by Russell King (Oracle)'s avatar Russell King (Oracle) Committed by Jakub Kicinski

net: dsa: ksz_common: use separate phylink_mac_ops for ksz8830

Use a separate phylink_mac_ops for the KSZ8830 chip-id.
Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://lore.kernel.org/r/E1s0O7R-009gq2-Qm@rmk-PC.armlinux.org.ukSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 9424c073
...@@ -253,6 +253,9 @@ static const struct ksz_drive_strength ksz8830_drive_strengths[] = { ...@@ -253,6 +253,9 @@ static const struct ksz_drive_strength ksz8830_drive_strengths[] = {
{ KSZ8873_DRIVE_STRENGTH_16MA, 16000 }, { KSZ8873_DRIVE_STRENGTH_16MA, 16000 },
}; };
static void ksz8830_phylink_mac_config(struct phylink_config *config,
unsigned int mode,
const struct phylink_link_state *state);
static void ksz_phylink_mac_config(struct phylink_config *config, static void ksz_phylink_mac_config(struct phylink_config *config,
unsigned int mode, unsigned int mode,
const struct phylink_link_state *state); const struct phylink_link_state *state);
...@@ -260,6 +263,12 @@ static void ksz_phylink_mac_link_down(struct phylink_config *config, ...@@ -260,6 +263,12 @@ static void ksz_phylink_mac_link_down(struct phylink_config *config,
unsigned int mode, unsigned int mode,
phy_interface_t interface); phy_interface_t interface);
static const struct phylink_mac_ops ksz8830_phylink_mac_ops = {
.mac_config = ksz8830_phylink_mac_config,
.mac_link_down = ksz_phylink_mac_link_down,
.mac_link_up = ksz8_phylink_mac_link_up,
};
static const struct phylink_mac_ops ksz8_phylink_mac_ops = { static const struct phylink_mac_ops ksz8_phylink_mac_ops = {
.mac_config = ksz_phylink_mac_config, .mac_config = ksz_phylink_mac_config,
.mac_link_down = ksz_phylink_mac_link_down, .mac_link_down = ksz_phylink_mac_link_down,
...@@ -1339,7 +1348,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { ...@@ -1339,7 +1348,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.port_cnt = 3, .port_cnt = 3,
.num_tx_queues = 4, .num_tx_queues = 4,
.ops = &ksz8_dev_ops, .ops = &ksz8_dev_ops,
.phylink_mac_ops = &ksz8_phylink_mac_ops, .phylink_mac_ops = &ksz8830_phylink_mac_ops,
.mib_names = ksz88xx_mib_names, .mib_names = ksz88xx_mib_names,
.mib_cnt = ARRAY_SIZE(ksz88xx_mib_names), .mib_cnt = ARRAY_SIZE(ksz88xx_mib_names),
.reg_mib_cnt = MIB_COUNTER_NUM, .reg_mib_cnt = MIB_COUNTER_NUM,
...@@ -3104,6 +3113,16 @@ phy_interface_t ksz_get_xmii(struct ksz_device *dev, int port, bool gbit) ...@@ -3104,6 +3113,16 @@ phy_interface_t ksz_get_xmii(struct ksz_device *dev, int port, bool gbit)
return interface; return interface;
} }
static void ksz8830_phylink_mac_config(struct phylink_config *config,
unsigned int mode,
const struct phylink_link_state *state)
{
struct dsa_port *dp = dsa_phylink_to_port(config);
struct ksz_device *dev = dp->ds->priv;
dev->ports[dp->index].manual_flow = !(state->pause & MLO_PAUSE_AN);
}
static void ksz_phylink_mac_config(struct phylink_config *config, static void ksz_phylink_mac_config(struct phylink_config *config,
unsigned int mode, unsigned int mode,
const struct phylink_link_state *state) const struct phylink_link_state *state)
...@@ -3112,11 +3131,6 @@ static void ksz_phylink_mac_config(struct phylink_config *config, ...@@ -3112,11 +3131,6 @@ static void ksz_phylink_mac_config(struct phylink_config *config,
struct ksz_device *dev = dp->ds->priv; struct ksz_device *dev = dp->ds->priv;
int port = dp->index; int port = dp->index;
if (ksz_is_ksz88x3(dev)) {
dev->ports[port].manual_flow = !(state->pause & MLO_PAUSE_AN);
return;
}
/* Internal PHYs */ /* Internal PHYs */
if (dev->info->internal_phy[port]) if (dev->info->internal_phy[port])
return; return;
......
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