mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 10:09:10 +02:00
net: dsa: microchip: remove dev_ops->setup() and teardown()
All switch families have been converted to have their own ds->ops->setup() methods and to call the common ksz_teardown(). Remove the no longer used ksz_setup() function and the associated ksz_dev_ops callbacks. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: Bastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com> Link: https://patch.msgid.link/20260521-clean-ksz-2nd-series-v3-5-75c38971c19a@bootlin.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
4c54f910ee
commit
df478153cb
|
|
@ -2745,136 +2745,6 @@ int ksz_pirq_setup(struct ksz_device *dev, u8 p)
|
|||
return ksz_irq_common_setup(dev, pirq);
|
||||
}
|
||||
|
||||
int ksz_setup(struct dsa_switch *ds)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
u16 storm_mask, storm_rate;
|
||||
struct dsa_port *dp;
|
||||
struct ksz_port *p;
|
||||
const u16 *regs;
|
||||
int ret;
|
||||
|
||||
regs = dev->info->regs;
|
||||
|
||||
dev->vlan_cache = devm_kcalloc(dev->dev, sizeof(struct vlan_table),
|
||||
dev->info->num_vlans, GFP_KERNEL);
|
||||
if (!dev->vlan_cache)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = dev->dev_ops->reset(dev);
|
||||
if (ret) {
|
||||
dev_err(ds->dev, "failed to reset switch\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ksz_parse_drive_strength(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (ksz_has_sgmii_port(dev) && dev->dev_ops->pcs_create) {
|
||||
ret = dev->dev_ops->pcs_create(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* set broadcast storm protection 10% rate */
|
||||
storm_mask = BROADCAST_STORM_RATE;
|
||||
storm_rate = (BROADCAST_STORM_VALUE * BROADCAST_STORM_PROT_RATE) / 100;
|
||||
if (ksz_is_ksz8463(dev)) {
|
||||
storm_mask = swab16(storm_mask);
|
||||
storm_rate = swab16(storm_rate);
|
||||
}
|
||||
regmap_update_bits(ksz_regmap_16(dev), regs[S_BROADCAST_CTRL],
|
||||
storm_mask, storm_rate);
|
||||
|
||||
dev->dev_ops->config_cpu_port(ds);
|
||||
|
||||
dev->dev_ops->enable_stp_addr(dev);
|
||||
|
||||
ds->num_tx_queues = dev->info->num_tx_queues;
|
||||
|
||||
regmap_update_bits(ksz_regmap_8(dev), regs[S_MULTICAST_CTRL],
|
||||
MULTICAST_STORM_DISABLE, MULTICAST_STORM_DISABLE);
|
||||
|
||||
ksz_init_mib_timer(dev);
|
||||
|
||||
ds->configure_vlan_while_not_filtering = false;
|
||||
ds->dscp_prio_mapping_is_global = true;
|
||||
|
||||
if (dev->dev_ops->setup) {
|
||||
ret = dev->dev_ops->setup(ds);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Start with learning disabled on standalone user ports, and enabled
|
||||
* on the CPU port. In lack of other finer mechanisms, learning on the
|
||||
* CPU port will avoid flooding bridge local addresses on the network
|
||||
* in some cases.
|
||||
*/
|
||||
p = &dev->ports[dev->cpu_port];
|
||||
p->learning = true;
|
||||
|
||||
if (dev->irq > 0) {
|
||||
ret = ksz_girq_setup(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
dsa_switch_for_each_user_port(dp, dev->ds) {
|
||||
ret = ksz_pirq_setup(dev, dp->index);
|
||||
if (ret)
|
||||
goto port_release;
|
||||
|
||||
if (dev->info->ptp_capable) {
|
||||
ret = ksz_ptp_irq_setup(ds, dp->index);
|
||||
if (ret)
|
||||
goto pirq_release;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dev->info->ptp_capable) {
|
||||
ret = ksz_ptp_clock_register(ds);
|
||||
if (ret) {
|
||||
dev_err(dev->dev, "Failed to register PTP clock: %d\n",
|
||||
ret);
|
||||
goto port_release;
|
||||
}
|
||||
}
|
||||
|
||||
ret = ksz_mdio_register(dev);
|
||||
if (ret < 0) {
|
||||
dev_err(dev->dev, "failed to register the mdio");
|
||||
goto out_ptp_clock_unregister;
|
||||
}
|
||||
|
||||
ret = ksz_dcb_init(dev);
|
||||
if (ret)
|
||||
goto out_ptp_clock_unregister;
|
||||
|
||||
/* start switch */
|
||||
regmap_update_bits(ksz_regmap_8(dev), regs[S_START_CTRL],
|
||||
SW_START, SW_START);
|
||||
|
||||
return 0;
|
||||
|
||||
out_ptp_clock_unregister:
|
||||
if (dev->info->ptp_capable)
|
||||
ksz_ptp_clock_unregister(ds);
|
||||
port_release:
|
||||
if (dev->irq > 0) {
|
||||
dsa_switch_for_each_user_port_continue_reverse(dp, dev->ds) {
|
||||
if (dev->info->ptp_capable)
|
||||
ksz_ptp_irq_free(ds, dp->index);
|
||||
pirq_release:
|
||||
ksz_irq_free(&dev->ports[dp->index].pirq);
|
||||
}
|
||||
ksz_irq_free(&dev->girq);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ksz_teardown(struct dsa_switch *ds)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
|
|
@ -2893,9 +2763,6 @@ void ksz_teardown(struct dsa_switch *ds)
|
|||
|
||||
ksz_irq_free(&dev->girq);
|
||||
}
|
||||
|
||||
if (dev->dev_ops->teardown)
|
||||
dev->dev_ops->teardown(ds);
|
||||
}
|
||||
|
||||
static void port_r_cnt(struct ksz_device *dev, int port)
|
||||
|
|
|
|||
|
|
@ -359,8 +359,6 @@ struct alu_struct {
|
|||
};
|
||||
|
||||
struct ksz_dev_ops {
|
||||
int (*setup)(struct dsa_switch *ds);
|
||||
void (*teardown)(struct dsa_switch *ds);
|
||||
u32 (*get_port_addr)(int port, int offset);
|
||||
void (*cfg_port_member)(struct ksz_device *dev, int port, u8 member);
|
||||
void (*port_setup)(struct ksz_device *dev, int port, bool cpu_port);
|
||||
|
|
@ -417,12 +415,7 @@ struct ksz_dev_ops {
|
|||
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);
|
||||
void (*config_cpu_port)(struct dsa_switch *ds);
|
||||
int (*enable_stp_addr)(struct ksz_device *dev);
|
||||
int (*reset)(struct ksz_device *dev);
|
||||
int (*init)(struct ksz_device *dev);
|
||||
|
||||
int (*pcs_create)(struct ksz_device *dev);
|
||||
};
|
||||
|
||||
struct ksz_device *ksz_switch_alloc(struct device *base,
|
||||
|
|
@ -433,7 +426,6 @@ void ksz_switch_remove(struct ksz_device *dev);
|
|||
int ksz_switch_suspend(struct device *dev);
|
||||
int ksz_switch_resume(struct device *dev);
|
||||
|
||||
int ksz_setup(struct dsa_switch *ds);
|
||||
void ksz_teardown(struct dsa_switch *ds);
|
||||
int ksz_port_setup(struct dsa_switch *ds, int port);
|
||||
void ksz_port_teardown(struct dsa_switch *ds, int port);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user