[P_SPEED_STATUS] = 0x09,
[S_TAIL_TAG_CTRL] = 0x0C,
[P_STP_CTRL] = 0x02,
+ [S_START_CTRL] = 0x01,
+ [S_BROADCAST_CTRL] = 0x06,
+ [S_MULTICAST_CTRL] = 0x04,
};
static const u32 ksz8795_masks[] = {
[P_SPEED_STATUS] = 0x0F,
[S_TAIL_TAG_CTRL] = 0x03,
[P_STP_CTRL] = 0x02,
+ [S_START_CTRL] = 0x01,
+ [S_BROADCAST_CTRL] = 0x06,
+ [S_MULTICAST_CTRL] = 0x04,
};
static const u32 ksz8863_masks[] = {
static const u16 ksz9477_regs[] = {
[P_STP_CTRL] = 0x0B04,
+ [S_START_CTRL] = 0x0300,
+ [S_BROADCAST_CTRL] = 0x0332,
+ [S_MULTICAST_CTRL] = 0x0331,
};
.regs = ksz8795_regs,
.masks = ksz8795_masks,
.shifts = ksz8795_shifts,
- .broadcast_ctrl_reg = 0x06,
- .multicast_ctrl_reg = 0x04,
- .start_ctrl_reg = 0x01,
.supports_mii = {false, false, false, false, true},
.supports_rmii = {false, false, false, false, true},
.supports_rgmii = {false, false, false, false, true},
.regs = ksz8795_regs,
.masks = ksz8795_masks,
.shifts = ksz8795_shifts,
- .broadcast_ctrl_reg = 0x06,
- .multicast_ctrl_reg = 0x04,
- .start_ctrl_reg = 0x01,
.supports_mii = {false, false, false, false, true},
.supports_rmii = {false, false, false, false, true},
.supports_rgmii = {false, false, false, false, true},
.regs = ksz8795_regs,
.masks = ksz8795_masks,
.shifts = ksz8795_shifts,
- .broadcast_ctrl_reg = 0x06,
- .multicast_ctrl_reg = 0x04,
- .start_ctrl_reg = 0x01,
.supports_mii = {false, false, false, false, true},
.supports_rmii = {false, false, false, false, true},
.supports_rgmii = {false, false, false, false, true},
.regs = ksz8863_regs,
.masks = ksz8863_masks,
.shifts = ksz8863_shifts,
- .broadcast_ctrl_reg = 0x06,
- .multicast_ctrl_reg = 0x04,
- .start_ctrl_reg = 0x01,
.supports_mii = {false, false, true},
.supports_rmii = {false, false, true},
.internal_phy = {true, true, false},
.mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
.reg_mib_cnt = MIB_COUNTER_NUM,
.regs = ksz9477_regs,
- .broadcast_ctrl_reg = 0x0332,
- .multicast_ctrl_reg = 0x0331,
- .start_ctrl_reg = 0x0300,
.supports_mii = {false, false, false, false,
false, true, false},
.supports_rmii = {false, false, false, false,
.mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
.reg_mib_cnt = MIB_COUNTER_NUM,
.regs = ksz9477_regs,
- .broadcast_ctrl_reg = 0x0332,
- .multicast_ctrl_reg = 0x0331,
- .start_ctrl_reg = 0x0300,
.supports_mii = {false, false, false, false,
false, true, true},
.supports_rmii = {false, false, false, false,
.mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
.reg_mib_cnt = MIB_COUNTER_NUM,
.regs = ksz9477_regs,
- .broadcast_ctrl_reg = 0x0332,
- .multicast_ctrl_reg = 0x0331,
- .start_ctrl_reg = 0x0300,
.supports_mii = {false, false, true},
.supports_rmii = {false, false, true},
.supports_rgmii = {false, false, true},
.mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
.reg_mib_cnt = MIB_COUNTER_NUM,
.regs = ksz9477_regs,
- .broadcast_ctrl_reg = 0x0332,
- .multicast_ctrl_reg = 0x0331,
- .start_ctrl_reg = 0x0300,
.supports_mii = {false, false, false, false,
false, true, true},
.supports_rmii = {false, false, false, false,
.mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
.reg_mib_cnt = MIB_COUNTER_NUM,
.regs = ksz9477_regs,
- .broadcast_ctrl_reg = 0x0332,
- .multicast_ctrl_reg = 0x0331,
- .start_ctrl_reg = 0x0300,
.supports_mii = {false, false, false, false, true},
.supports_rmii = {false, false, false, false, true},
.supports_rgmii = {false, false, false, false, true},
.mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
.reg_mib_cnt = MIB_COUNTER_NUM,
.regs = ksz9477_regs,
- .broadcast_ctrl_reg = 0x0332,
- .multicast_ctrl_reg = 0x0331,
- .start_ctrl_reg = 0x0300,
.supports_mii = {false, false, false, false, true, true},
.supports_rmii = {false, false, false, false, true, true},
.supports_rgmii = {false, false, false, false, true, true},
.mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
.reg_mib_cnt = MIB_COUNTER_NUM,
.regs = ksz9477_regs,
- .broadcast_ctrl_reg = 0x0332,
- .multicast_ctrl_reg = 0x0331,
- .start_ctrl_reg = 0x0300,
.supports_mii = {false, false, false, false,
true, true, false, false},
.supports_rmii = {false, false, false, false,
.mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
.reg_mib_cnt = MIB_COUNTER_NUM,
.regs = ksz9477_regs,
- .broadcast_ctrl_reg = 0x0332,
- .multicast_ctrl_reg = 0x0331,
- .start_ctrl_reg = 0x0300,
.supports_mii = {false, false, false, false,
true, true, false, false},
.supports_rmii = {false, false, false, false,
.mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
.reg_mib_cnt = MIB_COUNTER_NUM,
.regs = ksz9477_regs,
- .broadcast_ctrl_reg = 0x0332,
- .multicast_ctrl_reg = 0x0331,
- .start_ctrl_reg = 0x0300,
.supports_mii = {false, false, false, false,
true, true, false, false},
.supports_rmii = {false, false, false, false,
static int ksz_setup(struct dsa_switch *ds)
{
struct ksz_device *dev = ds->priv;
+ 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)
}
/* set broadcast storm protection 10% rate */
- regmap_update_bits(dev->regmap[1], dev->info->broadcast_ctrl_reg,
+ regmap_update_bits(dev->regmap[1], regs[S_BROADCAST_CTRL],
BROADCAST_STORM_RATE,
(BROADCAST_STORM_VALUE *
BROADCAST_STORM_PROT_RATE) / 100);
dev->dev_ops->enable_stp_addr(dev);
- regmap_update_bits(dev->regmap[0], dev->info->multicast_ctrl_reg,
+ regmap_update_bits(dev->regmap[0], regs[S_MULTICAST_CTRL],
MULTICAST_STORM_DISABLE, MULTICAST_STORM_DISABLE);
ksz_init_mib_timer(dev);
}
/* start switch */
- regmap_update_bits(dev->regmap[0], dev->info->start_ctrl_reg,
+ regmap_update_bits(dev->regmap[0], regs[S_START_CTRL],
SW_START, SW_START);
return 0;