net: dsa: microchip: remove setup_rgmii_delay() KSZ operation

setup_rgmii_delay() operation is only used once during the common phylink
MAC configuration. Only the lan937x switch implements this
setup_rgmii_delay().

Remove the setup_rgmii_delay operation from ksz_dev_ops.
Implement a lan937x-specific phylink MAC configuration that does this
RGMII delay setup.
Export ksz_set_xmii since it's needed by the lan937x implementation.

Signed-off-by: Bastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>
Link: https://patch.msgid.link/20260608-clean-ksz-3rd-v2-5-6e61b7be23c4@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Bastien Curutchet (Schneider Electric) 2026-06-08 16:10:08 +02:00 committed by Jakub Kicinski
parent c90e80103b
commit b97d51f450
3 changed files with 18 additions and 10 deletions

View File

@ -3127,8 +3127,7 @@ int ksz_set_mac_eee(struct dsa_switch *ds, int port,
return 0;
}
static void ksz_set_xmii(struct ksz_device *dev, int port,
phy_interface_t interface)
void ksz_set_xmii(struct ksz_device *dev, int port, phy_interface_t interface)
{
const u8 *bitval = dev->info->xmii_ctrl1;
struct ksz_port *p = &dev->ports[port];
@ -3242,12 +3241,8 @@ void ksz_phylink_mac_config(struct phylink_config *config,
struct ksz_device *dev = dp->ds->priv;
int port = dp->index;
if (ksz_phylink_need_config(config, mode)) {
if (ksz_phylink_need_config(config, mode))
ksz_set_xmii(dev, port, state->interface);
if (dev->dev_ops->setup_rgmii_delay)
dev->dev_ops->setup_rgmii_delay(dev, port);
}
}
bool ksz_get_gbit(struct ksz_device *dev, int port)

View File

@ -414,7 +414,6 @@ struct ksz_dev_ops {
u8 data);
void (*freeze_mib)(struct ksz_device *dev, int port, bool freeze);
void (*port_init_cnt)(struct ksz_device *dev, int port);
void (*setup_rgmii_delay)(struct ksz_device *dev, int port);
int (*tc_cbs_set_cinc)(struct ksz_device *dev, int port, u32 val);
int (*init)(struct ksz_device *dev);
};
@ -472,6 +471,7 @@ void ksz_phylink_get_caps(struct dsa_switch *ds, int port,
void ksz_phylink_mac_disable_tx_lpi(struct phylink_config *config);
int ksz_phylink_mac_enable_tx_lpi(struct phylink_config *config,
u32 timer, bool tx_clock_stop);
void ksz_set_xmii(struct ksz_device *dev, int port, phy_interface_t interface);
bool ksz_phylink_need_config(struct phylink_config *config, unsigned int mode);
void ksz_phylink_mac_config(struct phylink_config *config,
unsigned int mode,

View File

@ -643,6 +643,20 @@ static void lan937x_setup_rgmii_delay(struct ksz_device *dev, int port)
}
}
static void lan937x_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;
int port = dp->index;
if (ksz_phylink_need_config(config, mode)) {
ksz_set_xmii(dev, port, state->interface);
lan937x_setup_rgmii_delay(dev, port);
}
}
static int lan937x_tc_cbs_set_cinc(struct ksz_device *dev, int port, u32 val)
{
return ksz_pwrite32(dev, port, REG_PORT_MTI_CREDIT_INCREMENT, val);
@ -821,7 +835,7 @@ static int lan937x_connect_tag_protocol(struct dsa_switch *ds,
}
const struct phylink_mac_ops lan937x_phylink_mac_ops = {
.mac_config = ksz_phylink_mac_config,
.mac_config = lan937x_phylink_mac_config,
.mac_link_down = ksz_phylink_mac_link_down,
.mac_link_up = ksz9477_phylink_mac_link_up,
.mac_disable_tx_lpi = ksz_phylink_mac_disable_tx_lpi,
@ -838,7 +852,6 @@ const struct ksz_dev_ops lan937x_dev_ops = {
.r_mib_stat64 = ksz_r_mib_stats64,
.freeze_mib = ksz9477_freeze_mib,
.port_init_cnt = ksz9477_port_init_cnt,
.setup_rgmii_delay = lan937x_setup_rgmii_delay,
.tc_cbs_set_cinc = lan937x_tc_cbs_set_cinc,
.init = lan937x_switch_init,
};