提交 19470306 编写于 作者: D David S. Miller

Merge branch 'dsa-prefix-Global-macros'

Vivien Didelot says:

====================
net: dsa: prefix Global macros

This patch series is the 2/3 step of the register definitions cleanup.
It brings no functional changes.

It prefixes and documents all Global (1) registers with MV88E6XXX_G1_
(or a specific model like MV88E6352_G1_STS_PPU_STATE), and prefers a
16-bit hexadecimal representation of the Marvell registers layout.

The next and last patchset will prefix the Global 2 registers.
====================
Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
...@@ -261,7 +261,7 @@ static irqreturn_t mv88e6xxx_g1_irq_thread_fn(int irq, void *dev_id) ...@@ -261,7 +261,7 @@ static irqreturn_t mv88e6xxx_g1_irq_thread_fn(int irq, void *dev_id)
int err; int err;
mutex_lock(&chip->reg_lock); mutex_lock(&chip->reg_lock);
err = mv88e6xxx_g1_read(chip, GLOBAL_STATUS, &reg); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, &reg);
mutex_unlock(&chip->reg_lock); mutex_unlock(&chip->reg_lock);
if (err) if (err)
...@@ -292,14 +292,14 @@ static void mv88e6xxx_g1_irq_bus_sync_unlock(struct irq_data *d) ...@@ -292,14 +292,14 @@ static void mv88e6xxx_g1_irq_bus_sync_unlock(struct irq_data *d)
u16 reg; u16 reg;
int err; int err;
err = mv88e6xxx_g1_read(chip, GLOBAL_CONTROL, &reg); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &reg);
if (err) if (err)
goto out; goto out;
reg &= ~mask; reg &= ~mask;
reg |= (~chip->g1_irq.masked & mask); reg |= (~chip->g1_irq.masked & mask);
err = mv88e6xxx_g1_write(chip, GLOBAL_CONTROL, reg); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, reg);
if (err) if (err)
goto out; goto out;
...@@ -338,9 +338,9 @@ static void mv88e6xxx_g1_irq_free(struct mv88e6xxx_chip *chip) ...@@ -338,9 +338,9 @@ static void mv88e6xxx_g1_irq_free(struct mv88e6xxx_chip *chip)
int irq, virq; int irq, virq;
u16 mask; u16 mask;
mv88e6xxx_g1_read(chip, GLOBAL_CONTROL, &mask); mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &mask);
mask |= GENMASK(chip->g1_irq.nirqs, 0); mask |= GENMASK(chip->g1_irq.nirqs, 0);
mv88e6xxx_g1_write(chip, GLOBAL_CONTROL, mask); mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, mask);
free_irq(chip->irq, chip); free_irq(chip->irq, chip);
...@@ -370,18 +370,18 @@ static int mv88e6xxx_g1_irq_setup(struct mv88e6xxx_chip *chip) ...@@ -370,18 +370,18 @@ static int mv88e6xxx_g1_irq_setup(struct mv88e6xxx_chip *chip)
chip->g1_irq.chip = mv88e6xxx_g1_irq_chip; chip->g1_irq.chip = mv88e6xxx_g1_irq_chip;
chip->g1_irq.masked = ~0; chip->g1_irq.masked = ~0;
err = mv88e6xxx_g1_read(chip, GLOBAL_CONTROL, &mask); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &mask);
if (err) if (err)
goto out_mapping; goto out_mapping;
mask &= ~GENMASK(chip->g1_irq.nirqs, 0); mask &= ~GENMASK(chip->g1_irq.nirqs, 0);
err = mv88e6xxx_g1_write(chip, GLOBAL_CONTROL, mask); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, mask);
if (err) if (err)
goto out_disable; goto out_disable;
/* Reading the interrupt status clears (most of) them */ /* Reading the interrupt status clears (most of) them */
err = mv88e6xxx_g1_read(chip, GLOBAL_STATUS, &reg); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, &reg);
if (err) if (err)
goto out_disable; goto out_disable;
...@@ -396,7 +396,7 @@ static int mv88e6xxx_g1_irq_setup(struct mv88e6xxx_chip *chip) ...@@ -396,7 +396,7 @@ static int mv88e6xxx_g1_irq_setup(struct mv88e6xxx_chip *chip)
out_disable: out_disable:
mask |= GENMASK(chip->g1_irq.nirqs, 0); mask |= GENMASK(chip->g1_irq.nirqs, 0);
mv88e6xxx_g1_write(chip, GLOBAL_CONTROL, mask); mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, mask);
out_mapping: out_mapping:
for (irq = 0; irq < 16; irq++) { for (irq = 0; irq < 16; irq++) {
...@@ -725,7 +725,7 @@ static void mv88e6095_stats_get_stats(struct mv88e6xxx_chip *chip, int port, ...@@ -725,7 +725,7 @@ static void mv88e6095_stats_get_stats(struct mv88e6xxx_chip *chip, int port,
{ {
return mv88e6xxx_stats_get_stats(chip, port, data, return mv88e6xxx_stats_get_stats(chip, port, data,
STATS_TYPE_BANK0 | STATS_TYPE_PORT, STATS_TYPE_BANK0 | STATS_TYPE_PORT,
0, GLOBAL_STATS_OP_HIST_RX_TX); 0, MV88E6XXX_G1_STATS_OP_HIST_RX_TX);
} }
static void mv88e6320_stats_get_stats(struct mv88e6xxx_chip *chip, int port, static void mv88e6320_stats_get_stats(struct mv88e6xxx_chip *chip, int port,
...@@ -733,8 +733,8 @@ static void mv88e6320_stats_get_stats(struct mv88e6xxx_chip *chip, int port, ...@@ -733,8 +733,8 @@ static void mv88e6320_stats_get_stats(struct mv88e6xxx_chip *chip, int port,
{ {
return mv88e6xxx_stats_get_stats(chip, port, data, return mv88e6xxx_stats_get_stats(chip, port, data,
STATS_TYPE_BANK0 | STATS_TYPE_BANK1, STATS_TYPE_BANK0 | STATS_TYPE_BANK1,
GLOBAL_STATS_OP_BANK_1_BIT_9, MV88E6XXX_G1_STATS_OP_BANK_1_BIT_9,
GLOBAL_STATS_OP_HIST_RX_TX); MV88E6XXX_G1_STATS_OP_HIST_RX_TX);
} }
static void mv88e6390_stats_get_stats(struct mv88e6xxx_chip *chip, int port, static void mv88e6390_stats_get_stats(struct mv88e6xxx_chip *chip, int port,
...@@ -742,7 +742,8 @@ static void mv88e6390_stats_get_stats(struct mv88e6xxx_chip *chip, int port, ...@@ -742,7 +742,8 @@ static void mv88e6390_stats_get_stats(struct mv88e6xxx_chip *chip, int port,
{ {
return mv88e6xxx_stats_get_stats(chip, port, data, return mv88e6xxx_stats_get_stats(chip, port, data,
STATS_TYPE_BANK0 | STATS_TYPE_BANK1, STATS_TYPE_BANK0 | STATS_TYPE_BANK1,
GLOBAL_STATS_OP_BANK_1_BIT_10, 0); MV88E6XXX_G1_STATS_OP_BANK_1_BIT_10,
0);
} }
static void mv88e6xxx_get_stats(struct mv88e6xxx_chip *chip, int port, static void mv88e6xxx_get_stats(struct mv88e6xxx_chip *chip, int port,
...@@ -1047,7 +1048,8 @@ static int mv88e6xxx_port_vlan_dump(struct dsa_switch *ds, int port, ...@@ -1047,7 +1048,8 @@ static int mv88e6xxx_port_vlan_dump(struct dsa_switch *ds, int port,
if (!next.valid) if (!next.valid)
break; break;
if (next.member[port] == GLOBAL_VTU_DATA_MEMBER_TAG_NON_MEMBER) if (next.member[port] ==
MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER)
continue; continue;
/* reinit and dump this VLAN obj */ /* reinit and dump this VLAN obj */
...@@ -1055,7 +1057,8 @@ static int mv88e6xxx_port_vlan_dump(struct dsa_switch *ds, int port, ...@@ -1055,7 +1057,8 @@ static int mv88e6xxx_port_vlan_dump(struct dsa_switch *ds, int port,
vlan->vid_end = next.vid; vlan->vid_end = next.vid;
vlan->flags = 0; vlan->flags = 0;
if (next.member[port] == GLOBAL_VTU_DATA_MEMBER_TAG_UNTAGGED) if (next.member[port] ==
MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_UNTAGGED)
vlan->flags |= BRIDGE_VLAN_INFO_UNTAGGED; vlan->flags |= BRIDGE_VLAN_INFO_UNTAGGED;
if (next.vid == pvid) if (next.vid == pvid)
...@@ -1143,7 +1146,7 @@ static int mv88e6xxx_vtu_get(struct mv88e6xxx_chip *chip, u16 vid, ...@@ -1143,7 +1146,7 @@ static int mv88e6xxx_vtu_get(struct mv88e6xxx_chip *chip, u16 vid,
/* Exclude all ports */ /* Exclude all ports */
for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) for (i = 0; i < mv88e6xxx_num_ports(chip); ++i)
entry->member[i] = entry->member[i] =
GLOBAL_VTU_DATA_MEMBER_TAG_NON_MEMBER; MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER;
return mv88e6xxx_atu_new(chip, &entry->fid); return mv88e6xxx_atu_new(chip, &entry->fid);
} }
...@@ -1185,7 +1188,7 @@ static int mv88e6xxx_port_check_hw_vlan(struct dsa_switch *ds, int port, ...@@ -1185,7 +1188,7 @@ static int mv88e6xxx_port_check_hw_vlan(struct dsa_switch *ds, int port,
continue; continue;
if (vlan.member[i] == if (vlan.member[i] ==
GLOBAL_VTU_DATA_MEMBER_TAG_NON_MEMBER) MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER)
continue; continue;
if (ds->ports[i].bridge_dev == if (ds->ports[i].bridge_dev ==
...@@ -1281,11 +1284,11 @@ static void mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port, ...@@ -1281,11 +1284,11 @@ static void mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port,
return; return;
if (dsa_is_dsa_port(ds, port) || dsa_is_cpu_port(ds, port)) if (dsa_is_dsa_port(ds, port) || dsa_is_cpu_port(ds, port))
member = GLOBAL_VTU_DATA_MEMBER_TAG_UNMODIFIED; member = MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_UNMODIFIED;
else if (untagged) else if (untagged)
member = GLOBAL_VTU_DATA_MEMBER_TAG_UNTAGGED; member = MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_UNTAGGED;
else else
member = GLOBAL_VTU_DATA_MEMBER_TAG_TAGGED; member = MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_TAGGED;
mutex_lock(&chip->reg_lock); mutex_lock(&chip->reg_lock);
...@@ -1312,15 +1315,16 @@ static int _mv88e6xxx_port_vlan_del(struct mv88e6xxx_chip *chip, ...@@ -1312,15 +1315,16 @@ static int _mv88e6xxx_port_vlan_del(struct mv88e6xxx_chip *chip,
return err; return err;
/* Tell switchdev if this VLAN is handled in software */ /* Tell switchdev if this VLAN is handled in software */
if (vlan.member[port] == GLOBAL_VTU_DATA_MEMBER_TAG_NON_MEMBER) if (vlan.member[port] == MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER)
return -EOPNOTSUPP; return -EOPNOTSUPP;
vlan.member[port] = GLOBAL_VTU_DATA_MEMBER_TAG_NON_MEMBER; vlan.member[port] = MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER;
/* keep the VLAN unless all ports are excluded */ /* keep the VLAN unless all ports are excluded */
vlan.valid = false; vlan.valid = false;
for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) { for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) {
if (vlan.member[i] != GLOBAL_VTU_DATA_MEMBER_TAG_NON_MEMBER) { if (vlan.member[i] !=
MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER) {
vlan.valid = true; vlan.valid = true;
break; break;
} }
...@@ -1383,7 +1387,7 @@ static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port, ...@@ -1383,7 +1387,7 @@ static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port,
if (err) if (err)
return err; return err;
entry.state = GLOBAL_ATU_DATA_STATE_UNUSED; entry.state = MV88E6XXX_G1_ATU_DATA_STATE_UNUSED;
ether_addr_copy(entry.mac, addr); ether_addr_copy(entry.mac, addr);
eth_addr_dec(entry.mac); eth_addr_dec(entry.mac);
...@@ -1392,17 +1396,17 @@ static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port, ...@@ -1392,17 +1396,17 @@ static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port,
return err; return err;
/* Initialize a fresh ATU entry if it isn't found */ /* Initialize a fresh ATU entry if it isn't found */
if (entry.state == GLOBAL_ATU_DATA_STATE_UNUSED || if (entry.state == MV88E6XXX_G1_ATU_DATA_STATE_UNUSED ||
!ether_addr_equal(entry.mac, addr)) { !ether_addr_equal(entry.mac, addr)) {
memset(&entry, 0, sizeof(entry)); memset(&entry, 0, sizeof(entry));
ether_addr_copy(entry.mac, addr); ether_addr_copy(entry.mac, addr);
} }
/* Purge the ATU entry only if no port is using it anymore */ /* Purge the ATU entry only if no port is using it anymore */
if (state == GLOBAL_ATU_DATA_STATE_UNUSED) { if (state == MV88E6XXX_G1_ATU_DATA_STATE_UNUSED) {
entry.portvec &= ~BIT(port); entry.portvec &= ~BIT(port);
if (!entry.portvec) if (!entry.portvec)
entry.state = GLOBAL_ATU_DATA_STATE_UNUSED; entry.state = MV88E6XXX_G1_ATU_DATA_STATE_UNUSED;
} else { } else {
entry.portvec |= BIT(port); entry.portvec |= BIT(port);
entry.state = state; entry.state = state;
...@@ -1429,7 +1433,7 @@ static void mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port, ...@@ -1429,7 +1433,7 @@ static void mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port,
mutex_lock(&chip->reg_lock); mutex_lock(&chip->reg_lock);
if (mv88e6xxx_port_db_load_purge(chip, port, fdb->addr, fdb->vid, if (mv88e6xxx_port_db_load_purge(chip, port, fdb->addr, fdb->vid,
GLOBAL_ATU_DATA_STATE_UC_STATIC)) MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC))
dev_err(ds->dev, "p%d: failed to load unicast MAC address\n", dev_err(ds->dev, "p%d: failed to load unicast MAC address\n",
port); port);
mutex_unlock(&chip->reg_lock); mutex_unlock(&chip->reg_lock);
...@@ -1443,7 +1447,7 @@ static int mv88e6xxx_port_fdb_del(struct dsa_switch *ds, int port, ...@@ -1443,7 +1447,7 @@ static int mv88e6xxx_port_fdb_del(struct dsa_switch *ds, int port,
mutex_lock(&chip->reg_lock); mutex_lock(&chip->reg_lock);
err = mv88e6xxx_port_db_load_purge(chip, port, fdb->addr, fdb->vid, err = mv88e6xxx_port_db_load_purge(chip, port, fdb->addr, fdb->vid,
GLOBAL_ATU_DATA_STATE_UNUSED); MV88E6XXX_G1_ATU_DATA_STATE_UNUSED);
mutex_unlock(&chip->reg_lock); mutex_unlock(&chip->reg_lock);
return err; return err;
...@@ -1457,7 +1461,7 @@ static int mv88e6xxx_port_db_dump_fid(struct mv88e6xxx_chip *chip, ...@@ -1457,7 +1461,7 @@ static int mv88e6xxx_port_db_dump_fid(struct mv88e6xxx_chip *chip,
struct mv88e6xxx_atu_entry addr; struct mv88e6xxx_atu_entry addr;
int err; int err;
addr.state = GLOBAL_ATU_DATA_STATE_UNUSED; addr.state = MV88E6XXX_G1_ATU_DATA_STATE_UNUSED;
eth_broadcast_addr(addr.mac); eth_broadcast_addr(addr.mac);
do { do {
...@@ -1465,7 +1469,7 @@ static int mv88e6xxx_port_db_dump_fid(struct mv88e6xxx_chip *chip, ...@@ -1465,7 +1469,7 @@ static int mv88e6xxx_port_db_dump_fid(struct mv88e6xxx_chip *chip,
if (err) if (err)
return err; return err;
if (addr.state == GLOBAL_ATU_DATA_STATE_UNUSED) if (addr.state == MV88E6XXX_G1_ATU_DATA_STATE_UNUSED)
break; break;
if (addr.trunk || (addr.portvec & BIT(port)) == 0) if (addr.trunk || (addr.portvec & BIT(port)) == 0)
...@@ -1480,7 +1484,7 @@ static int mv88e6xxx_port_db_dump_fid(struct mv88e6xxx_chip *chip, ...@@ -1480,7 +1484,7 @@ static int mv88e6xxx_port_db_dump_fid(struct mv88e6xxx_chip *chip,
fdb = SWITCHDEV_OBJ_PORT_FDB(obj); fdb = SWITCHDEV_OBJ_PORT_FDB(obj);
fdb->vid = vid; fdb->vid = vid;
ether_addr_copy(fdb->addr, addr.mac); ether_addr_copy(fdb->addr, addr.mac);
if (addr.state == GLOBAL_ATU_DATA_STATE_UC_STATIC) if (addr.state == MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC)
fdb->ndm_state = NUD_NOARP; fdb->ndm_state = NUD_NOARP;
else else
fdb->ndm_state = NUD_REACHABLE; fdb->ndm_state = NUD_REACHABLE;
...@@ -1979,25 +1983,6 @@ static void mv88e6xxx_port_disable(struct dsa_switch *ds, int port, ...@@ -1979,25 +1983,6 @@ static void mv88e6xxx_port_disable(struct dsa_switch *ds, int port,
mutex_unlock(&chip->reg_lock); mutex_unlock(&chip->reg_lock);
} }
static int mv88e6xxx_g1_set_switch_mac(struct mv88e6xxx_chip *chip, u8 *addr)
{
int err;
err = mv88e6xxx_g1_write(chip, GLOBAL_MAC_01, (addr[0] << 8) | addr[1]);
if (err)
return err;
err = mv88e6xxx_g1_write(chip, GLOBAL_MAC_23, (addr[2] << 8) | addr[3]);
if (err)
return err;
err = mv88e6xxx_g1_write(chip, GLOBAL_MAC_45, (addr[4] << 8) | addr[5]);
if (err)
return err;
return 0;
}
static int mv88e6xxx_set_ageing_time(struct dsa_switch *ds, static int mv88e6xxx_set_ageing_time(struct dsa_switch *ds,
unsigned int ageing_time) unsigned int ageing_time)
{ {
...@@ -2030,40 +2015,40 @@ static int mv88e6xxx_g1_setup(struct mv88e6xxx_chip *chip) ...@@ -2030,40 +2015,40 @@ static int mv88e6xxx_g1_setup(struct mv88e6xxx_chip *chip)
} }
/* Disable remote management, and set the switch's DSA device number. */ /* Disable remote management, and set the switch's DSA device number. */
err = mv88e6xxx_g1_write(chip, GLOBAL_CONTROL_2, err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL2,
GLOBAL_CONTROL_2_MULTIPLE_CASCADE | MV88E6XXX_G1_CTL2_MULTIPLE_CASCADE |
(ds->index & 0x1f)); (ds->index & 0x1f));
if (err) if (err)
return err; return err;
/* Configure the IP ToS mapping registers. */ /* Configure the IP ToS mapping registers. */
err = mv88e6xxx_g1_write(chip, GLOBAL_IP_PRI_0, 0x0000); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_0, 0x0000);
if (err) if (err)
return err; return err;
err = mv88e6xxx_g1_write(chip, GLOBAL_IP_PRI_1, 0x0000); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_1, 0x0000);
if (err) if (err)
return err; return err;
err = mv88e6xxx_g1_write(chip, GLOBAL_IP_PRI_2, 0x5555); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_2, 0x5555);
if (err) if (err)
return err; return err;
err = mv88e6xxx_g1_write(chip, GLOBAL_IP_PRI_3, 0x5555); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_3, 0x5555);
if (err) if (err)
return err; return err;
err = mv88e6xxx_g1_write(chip, GLOBAL_IP_PRI_4, 0xaaaa); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_4, 0xaaaa);
if (err) if (err)
return err; return err;
err = mv88e6xxx_g1_write(chip, GLOBAL_IP_PRI_5, 0xaaaa); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_5, 0xaaaa);
if (err) if (err)
return err; return err;
err = mv88e6xxx_g1_write(chip, GLOBAL_IP_PRI_6, 0xffff); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_6, 0xffff);
if (err) if (err)
return err; return err;
err = mv88e6xxx_g1_write(chip, GLOBAL_IP_PRI_7, 0xffff); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_7, 0xffff);
if (err) if (err)
return err; return err;
/* Configure the IEEE 802.1p priority mapping register. */ /* Configure the IEEE 802.1p priority mapping register. */
err = mv88e6xxx_g1_write(chip, GLOBAL_IEEE_PRI, 0xfa41); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IEEE_PRI, 0xfa41);
if (err) if (err)
return err; return err;
...@@ -2073,8 +2058,9 @@ static int mv88e6xxx_g1_setup(struct mv88e6xxx_chip *chip) ...@@ -2073,8 +2058,9 @@ static int mv88e6xxx_g1_setup(struct mv88e6xxx_chip *chip)
return err; return err;
/* Clear the statistics counters for all ports */ /* Clear the statistics counters for all ports */
err = mv88e6xxx_g1_write(chip, GLOBAL_STATS_OP, err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_STATS_OP,
GLOBAL_STATS_OP_FLUSH_ALL); MV88E6XXX_G1_STATS_OP_BUSY |
MV88E6XXX_G1_STATS_OP_FLUSH_ALL);
if (err) if (err)
return err; return err;
...@@ -3774,7 +3760,7 @@ static void mv88e6xxx_port_mdb_add(struct dsa_switch *ds, int port, ...@@ -3774,7 +3760,7 @@ static void mv88e6xxx_port_mdb_add(struct dsa_switch *ds, int port,
mutex_lock(&chip->reg_lock); mutex_lock(&chip->reg_lock);
if (mv88e6xxx_port_db_load_purge(chip, port, mdb->addr, mdb->vid, if (mv88e6xxx_port_db_load_purge(chip, port, mdb->addr, mdb->vid,
GLOBAL_ATU_DATA_STATE_MC_STATIC)) MV88E6XXX_G1_ATU_DATA_STATE_MC_STATIC))
dev_err(ds->dev, "p%d: failed to load multicast MAC address\n", dev_err(ds->dev, "p%d: failed to load multicast MAC address\n",
port); port);
mutex_unlock(&chip->reg_lock); mutex_unlock(&chip->reg_lock);
...@@ -3788,7 +3774,7 @@ static int mv88e6xxx_port_mdb_del(struct dsa_switch *ds, int port, ...@@ -3788,7 +3774,7 @@ static int mv88e6xxx_port_mdb_del(struct dsa_switch *ds, int port,
mutex_lock(&chip->reg_lock); mutex_lock(&chip->reg_lock);
err = mv88e6xxx_port_db_load_purge(chip, port, mdb->addr, mdb->vid, err = mv88e6xxx_port_db_load_purge(chip, port, mdb->addr, mdb->vid,
GLOBAL_ATU_DATA_STATE_UNUSED); MV88E6XXX_G1_ATU_DATA_STATE_UNUSED);
mutex_unlock(&chip->reg_lock); mutex_unlock(&chip->reg_lock);
return err; return err;
......
...@@ -127,12 +127,12 @@ enum mv88e6xxx_cap { ...@@ -127,12 +127,12 @@ enum mv88e6xxx_cap {
/* Per VLAN Spanning Tree Unit (STU). /* Per VLAN Spanning Tree Unit (STU).
* The Port State database, if present, is accessed through VTU * The Port State database, if present, is accessed through VTU
* operations and dedicated SID registers. See GLOBAL_VTU_SID. * operations and dedicated SID registers. See MV88E6352_G1_VTU_SID.
*/ */
MV88E6XXX_CAP_STU, MV88E6XXX_CAP_STU,
/* VLAN Table Unit. /* VLAN Table Unit.
* The VTU is used to program 802.1Q VLANs. See GLOBAL_VTU_OP. * The VTU is used to program 802.1Q VLANs. See MV88E6XXX_G1_VTU_OP.
*/ */
MV88E6XXX_CAP_VTU, MV88E6XXX_CAP_VTU,
}; };
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
* (at your option) any later version. * (at your option) any later version.
*/ */
#include <linux/bitfield.h>
#include "chip.h" #include "chip.h"
#include "global1.h" #include "global1.h"
...@@ -42,13 +44,13 @@ static int mv88e6185_g1_wait_ppu_disabled(struct mv88e6xxx_chip *chip) ...@@ -42,13 +44,13 @@ static int mv88e6185_g1_wait_ppu_disabled(struct mv88e6xxx_chip *chip)
int i, err; int i, err;
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
err = mv88e6xxx_g1_read(chip, GLOBAL_STATUS, &state); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, &state);
if (err) if (err)
return err; return err;
/* Check the value of the PPUState bits 15:14 */ /* Check the value of the PPUState bits 15:14 */
state &= GLOBAL_STATUS_PPU_STATE_MASK; state &= MV88E6185_G1_STS_PPU_STATE_MASK;
if (state != GLOBAL_STATUS_PPU_STATE_POLLING) if (state != MV88E6185_G1_STS_PPU_STATE_POLLING)
return 0; return 0;
usleep_range(1000, 2000); usleep_range(1000, 2000);
...@@ -63,13 +65,13 @@ static int mv88e6185_g1_wait_ppu_polling(struct mv88e6xxx_chip *chip) ...@@ -63,13 +65,13 @@ static int mv88e6185_g1_wait_ppu_polling(struct mv88e6xxx_chip *chip)
int i, err; int i, err;
for (i = 0; i < 16; ++i) { for (i = 0; i < 16; ++i) {
err = mv88e6xxx_g1_read(chip, GLOBAL_STATUS, &state); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, &state);
if (err) if (err)
return err; return err;
/* Check the value of the PPUState bits 15:14 */ /* Check the value of the PPUState bits 15:14 */
state &= GLOBAL_STATUS_PPU_STATE_MASK; state &= MV88E6185_G1_STS_PPU_STATE_MASK;
if (state == GLOBAL_STATUS_PPU_STATE_POLLING) if (state == MV88E6185_G1_STS_PPU_STATE_POLLING)
return 0; return 0;
usleep_range(1000, 2000); usleep_range(1000, 2000);
...@@ -84,12 +86,12 @@ static int mv88e6352_g1_wait_ppu_polling(struct mv88e6xxx_chip *chip) ...@@ -84,12 +86,12 @@ static int mv88e6352_g1_wait_ppu_polling(struct mv88e6xxx_chip *chip)
int i, err; int i, err;
for (i = 0; i < 16; ++i) { for (i = 0; i < 16; ++i) {
err = mv88e6xxx_g1_read(chip, GLOBAL_STATUS, &state); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, &state);
if (err) if (err)
return err; return err;
/* Check the value of the PPUState (or InitState) bit 15 */ /* Check the value of the PPUState (or InitState) bit 15 */
if (state & GLOBAL_STATUS_PPU_STATE) if (state & MV88E6352_G1_STS_PPU_STATE)
return 0; return 0;
usleep_range(1000, 2000); usleep_range(1000, 2000);
...@@ -109,11 +111,11 @@ static int mv88e6xxx_g1_wait_init_ready(struct mv88e6xxx_chip *chip) ...@@ -109,11 +111,11 @@ static int mv88e6xxx_g1_wait_init_ready(struct mv88e6xxx_chip *chip)
* have finished their initialization and are ready to accept frames. * have finished their initialization and are ready to accept frames.
*/ */
while (time_before(jiffies, timeout)) { while (time_before(jiffies, timeout)) {
err = mv88e6xxx_g1_read(chip, GLOBAL_STATUS, &val); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, &val);
if (err) if (err)
return err; return err;
if (val & GLOBAL_STATUS_INIT_READY) if (val & MV88E6XXX_G1_STS_INIT_READY)
break; break;
usleep_range(1000, 2000); usleep_range(1000, 2000);
...@@ -125,6 +127,33 @@ static int mv88e6xxx_g1_wait_init_ready(struct mv88e6xxx_chip *chip) ...@@ -125,6 +127,33 @@ static int mv88e6xxx_g1_wait_init_ready(struct mv88e6xxx_chip *chip)
return 0; return 0;
} }
/* Offset 0x01: Switch MAC Address Register Bytes 0 & 1
* Offset 0x02: Switch MAC Address Register Bytes 2 & 3
* Offset 0x03: Switch MAC Address Register Bytes 4 & 5
*/
int mv88e6xxx_g1_set_switch_mac(struct mv88e6xxx_chip *chip, u8 *addr)
{
u16 reg;
int err;
reg = (addr[0] << 8) | addr[1];
err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_MAC_01, reg);
if (err)
return err;
reg = (addr[2] << 8) | addr[3];
err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_MAC_23, reg);
if (err)
return err;
reg = (addr[4] << 8) | addr[5];
err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_MAC_45, reg);
if (err)
return err;
return 0;
}
/* Offset 0x04: Switch Global Control Register */ /* Offset 0x04: Switch Global Control Register */
int mv88e6185_g1_reset(struct mv88e6xxx_chip *chip) int mv88e6185_g1_reset(struct mv88e6xxx_chip *chip)
...@@ -135,14 +164,14 @@ int mv88e6185_g1_reset(struct mv88e6xxx_chip *chip) ...@@ -135,14 +164,14 @@ int mv88e6185_g1_reset(struct mv88e6xxx_chip *chip)
/* Set the SWReset bit 15 along with the PPUEn bit 14, to also restart /* Set the SWReset bit 15 along with the PPUEn bit 14, to also restart
* the PPU, including re-doing PHY detection and initialization * the PPU, including re-doing PHY detection and initialization
*/ */
err = mv88e6xxx_g1_read(chip, GLOBAL_CONTROL, &val); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &val);
if (err) if (err)
return err; return err;
val |= GLOBAL_CONTROL_SW_RESET; val |= MV88E6XXX_G1_CTL1_SW_RESET;
val |= GLOBAL_CONTROL_PPU_ENABLE; val |= MV88E6XXX_G1_CTL1_PPU_ENABLE;
err = mv88e6xxx_g1_write(chip, GLOBAL_CONTROL, val); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, val);
if (err) if (err)
return err; return err;
...@@ -159,13 +188,13 @@ int mv88e6352_g1_reset(struct mv88e6xxx_chip *chip) ...@@ -159,13 +188,13 @@ int mv88e6352_g1_reset(struct mv88e6xxx_chip *chip)
int err; int err;
/* Set the SWReset bit 15 */ /* Set the SWReset bit 15 */
err = mv88e6xxx_g1_read(chip, GLOBAL_CONTROL, &val); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &val);
if (err) if (err)
return err; return err;
val |= GLOBAL_CONTROL_SW_RESET; val |= MV88E6XXX_G1_CTL1_SW_RESET;
err = mv88e6xxx_g1_write(chip, GLOBAL_CONTROL, val); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, val);
if (err) if (err)
return err; return err;
...@@ -181,13 +210,13 @@ int mv88e6185_g1_ppu_enable(struct mv88e6xxx_chip *chip) ...@@ -181,13 +210,13 @@ int mv88e6185_g1_ppu_enable(struct mv88e6xxx_chip *chip)
u16 val; u16 val;
int err; int err;
err = mv88e6xxx_g1_read(chip, GLOBAL_CONTROL, &val); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &val);
if (err) if (err)
return err; return err;
val |= GLOBAL_CONTROL_PPU_ENABLE; val |= MV88E6XXX_G1_CTL1_PPU_ENABLE;
err = mv88e6xxx_g1_write(chip, GLOBAL_CONTROL, val); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, val);
if (err) if (err)
return err; return err;
...@@ -199,13 +228,13 @@ int mv88e6185_g1_ppu_disable(struct mv88e6xxx_chip *chip) ...@@ -199,13 +228,13 @@ int mv88e6185_g1_ppu_disable(struct mv88e6xxx_chip *chip)
u16 val; u16 val;
int err; int err;
err = mv88e6xxx_g1_read(chip, GLOBAL_CONTROL, &val); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &val);
if (err) if (err)
return err; return err;
val &= ~GLOBAL_CONTROL_PPU_ENABLE; val &= ~MV88E6XXX_G1_CTL1_PPU_ENABLE;
err = mv88e6xxx_g1_write(chip, GLOBAL_CONTROL, val); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, val);
if (err) if (err)
return err; return err;
...@@ -220,17 +249,17 @@ int mv88e6095_g1_set_egress_port(struct mv88e6xxx_chip *chip, int port) ...@@ -220,17 +249,17 @@ int mv88e6095_g1_set_egress_port(struct mv88e6xxx_chip *chip, int port)
u16 reg; u16 reg;
int err; int err;
err = mv88e6xxx_g1_read(chip, GLOBAL_MONITOR_CONTROL, &reg); err = mv88e6xxx_g1_read(chip, MV88E6185_G1_MONITOR_CTL, &reg);
if (err) if (err)
return err; return err;
reg &= ~(GLOBAL_MONITOR_CONTROL_INGRESS_MASK | reg &= ~(MV88E6185_G1_MONITOR_CTL_INGRESS_DEST_MASK |
GLOBAL_MONITOR_CONTROL_EGRESS_MASK); MV88E6185_G1_MONITOR_CTL_EGRESS_DEST_MASK);
reg |= port << GLOBAL_MONITOR_CONTROL_INGRESS_SHIFT | reg |= port << __bf_shf(MV88E6185_G1_MONITOR_CTL_INGRESS_DEST_MASK) |
port << GLOBAL_MONITOR_CONTROL_EGRESS_SHIFT; port << __bf_shf(MV88E6185_G1_MONITOR_CTL_EGRESS_DEST_MASK);
return mv88e6xxx_g1_write(chip, GLOBAL_MONITOR_CONTROL, reg); return mv88e6xxx_g1_write(chip, MV88E6185_G1_MONITOR_CTL, reg);
} }
/* Older generations also call this the ARP destination. It has been /* Older generations also call this the ARP destination. It has been
...@@ -242,14 +271,14 @@ int mv88e6095_g1_set_cpu_port(struct mv88e6xxx_chip *chip, int port) ...@@ -242,14 +271,14 @@ int mv88e6095_g1_set_cpu_port(struct mv88e6xxx_chip *chip, int port)
u16 reg; u16 reg;
int err; int err;
err = mv88e6xxx_g1_read(chip, GLOBAL_MONITOR_CONTROL, &reg); err = mv88e6xxx_g1_read(chip, MV88E6185_G1_MONITOR_CTL, &reg);
if (err) if (err)
return err; return err;
reg &= ~GLOBAL_MONITOR_CONTROL_ARP_MASK; reg &= ~MV88E6185_G1_MONITOR_CTL_ARP_DEST_MASK;
reg |= port << GLOBAL_MONITOR_CONTROL_ARP_SHIFT; reg |= port << __bf_shf(MV88E6185_G1_MONITOR_CTL_ARP_DEST_MASK);
return mv88e6xxx_g1_write(chip, GLOBAL_MONITOR_CONTROL, reg); return mv88e6xxx_g1_write(chip, MV88E6185_G1_MONITOR_CTL, reg);
} }
static int mv88e6390_g1_monitor_write(struct mv88e6xxx_chip *chip, static int mv88e6390_g1_monitor_write(struct mv88e6xxx_chip *chip,
...@@ -257,55 +286,66 @@ static int mv88e6390_g1_monitor_write(struct mv88e6xxx_chip *chip, ...@@ -257,55 +286,66 @@ static int mv88e6390_g1_monitor_write(struct mv88e6xxx_chip *chip,
{ {
u16 reg; u16 reg;
reg = GLOBAL_MONITOR_CONTROL_UPDATE | pointer | data; reg = MV88E6390_G1_MONITOR_MGMT_CTL_UPDATE | pointer | data;
return mv88e6xxx_g1_write(chip, GLOBAL_MONITOR_CONTROL, reg); return mv88e6xxx_g1_write(chip, MV88E6390_G1_MONITOR_MGMT_CTL, reg);
} }
int mv88e6390_g1_set_egress_port(struct mv88e6xxx_chip *chip, int port) int mv88e6390_g1_set_egress_port(struct mv88e6xxx_chip *chip, int port)
{ {
u16 ptr;
int err; int err;
err = mv88e6390_g1_monitor_write(chip, GLOBAL_MONITOR_CONTROL_INGRESS, ptr = MV88E6390_G1_MONITOR_MGMT_CTL_PTR_INGRESS_DEST;
port); err = mv88e6390_g1_monitor_write(chip, ptr, port);
if (err)
return err;
ptr = MV88E6390_G1_MONITOR_MGMT_CTL_PTR_EGRESS_DEST;
err = mv88e6390_g1_monitor_write(chip, ptr, port);
if (err) if (err)
return err; return err;
return mv88e6390_g1_monitor_write(chip, GLOBAL_MONITOR_CONTROL_EGRESS, return 0;
port);
} }
int mv88e6390_g1_set_cpu_port(struct mv88e6xxx_chip *chip, int port) int mv88e6390_g1_set_cpu_port(struct mv88e6xxx_chip *chip, int port)
{ {
return mv88e6390_g1_monitor_write(chip, GLOBAL_MONITOR_CONTROL_CPU_DEST, u16 ptr = MV88E6390_G1_MONITOR_MGMT_CTL_PTR_CPU_DEST;
port);
return mv88e6390_g1_monitor_write(chip, ptr, port);
} }
int mv88e6390_g1_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip) int mv88e6390_g1_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip)
{ {
u16 ptr;
int err; int err;
/* 01:c2:80:00:00:00:00-01:c2:80:00:00:00:07 are Management */ /* 01:c2:80:00:00:00:00-01:c2:80:00:00:00:07 are Management */
err = mv88e6390_g1_monitor_write( ptr = MV88E6390_G1_MONITOR_MGMT_CTL_PTR_0180C280000000XLO;
chip, GLOBAL_MONITOR_CONTROL_0180C280000000XLO, 0xff); err = mv88e6390_g1_monitor_write(chip, ptr, 0xff);
if (err) if (err)
return err; return err;
/* 01:c2:80:00:00:00:08-01:c2:80:00:00:00:0f are Management */ /* 01:c2:80:00:00:00:08-01:c2:80:00:00:00:0f are Management */
err = mv88e6390_g1_monitor_write( ptr = MV88E6390_G1_MONITOR_MGMT_CTL_PTR_0180C280000000XHI;
chip, GLOBAL_MONITOR_CONTROL_0180C280000000XHI, 0xff); err = mv88e6390_g1_monitor_write(chip, ptr, 0xff);
if (err) if (err)
return err; return err;
/* 01:c2:80:00:00:00:20-01:c2:80:00:00:00:27 are Management */ /* 01:c2:80:00:00:00:20-01:c2:80:00:00:00:27 are Management */
err = mv88e6390_g1_monitor_write( ptr = MV88E6390_G1_MONITOR_MGMT_CTL_PTR_0180C280000002XLO;
chip, GLOBAL_MONITOR_CONTROL_0180C280000002XLO, 0xff); err = mv88e6390_g1_monitor_write(chip, ptr, 0xff);
if (err) if (err)
return err; return err;
/* 01:c2:80:00:00:00:28-01:c2:80:00:00:00:2f are Management */ /* 01:c2:80:00:00:00:28-01:c2:80:00:00:00:2f are Management */
return mv88e6390_g1_monitor_write( ptr = MV88E6390_G1_MONITOR_MGMT_CTL_PTR_0180C280000002XHI;
chip, GLOBAL_MONITOR_CONTROL_0180C280000002XHI, 0xff); err = mv88e6390_g1_monitor_write(chip, ptr, 0xff);
if (err)
return err;
return 0;
} }
/* Offset 0x1c: Global Control 2 */ /* Offset 0x1c: Global Control 2 */
...@@ -315,13 +355,13 @@ int mv88e6390_g1_stats_set_histogram(struct mv88e6xxx_chip *chip) ...@@ -315,13 +355,13 @@ int mv88e6390_g1_stats_set_histogram(struct mv88e6xxx_chip *chip)
u16 val; u16 val;
int err; int err;
err = mv88e6xxx_g1_read(chip, GLOBAL_CONTROL_2, &val); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL2, &val);
if (err) if (err)
return err; return err;
val |= GLOBAL_CONTROL_2_HIST_RX_TX; val |= MV88E6XXX_G1_CTL2_HIST_RX_TX;
err = mv88e6xxx_g1_write(chip, GLOBAL_CONTROL_2, val); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL2, val);
return err; return err;
} }
...@@ -330,7 +370,8 @@ int mv88e6390_g1_stats_set_histogram(struct mv88e6xxx_chip *chip) ...@@ -330,7 +370,8 @@ int mv88e6390_g1_stats_set_histogram(struct mv88e6xxx_chip *chip)
int mv88e6xxx_g1_stats_wait(struct mv88e6xxx_chip *chip) int mv88e6xxx_g1_stats_wait(struct mv88e6xxx_chip *chip)
{ {
return mv88e6xxx_g1_wait(chip, GLOBAL_STATS_OP, GLOBAL_STATS_OP_BUSY); return mv88e6xxx_g1_wait(chip, MV88E6XXX_G1_STATS_OP,
MV88E6XXX_G1_STATS_OP_BUSY);
} }
int mv88e6xxx_g1_stats_snapshot(struct mv88e6xxx_chip *chip, int port) int mv88e6xxx_g1_stats_snapshot(struct mv88e6xxx_chip *chip, int port)
...@@ -338,9 +379,10 @@ int mv88e6xxx_g1_stats_snapshot(struct mv88e6xxx_chip *chip, int port) ...@@ -338,9 +379,10 @@ int mv88e6xxx_g1_stats_snapshot(struct mv88e6xxx_chip *chip, int port)
int err; int err;
/* Snapshot the hardware statistics counters for this port. */ /* Snapshot the hardware statistics counters for this port. */
err = mv88e6xxx_g1_write(chip, GLOBAL_STATS_OP, err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_STATS_OP,
GLOBAL_STATS_OP_CAPTURE_PORT | MV88E6XXX_G1_STATS_OP_BUSY |
GLOBAL_STATS_OP_HIST_RX_TX | port); MV88E6XXX_G1_STATS_OP_CAPTURE_PORT |
MV88E6XXX_G1_STATS_OP_HIST_RX_TX | port);
if (err) if (err)
return err; return err;
...@@ -362,8 +404,9 @@ int mv88e6390_g1_stats_snapshot(struct mv88e6xxx_chip *chip, int port) ...@@ -362,8 +404,9 @@ int mv88e6390_g1_stats_snapshot(struct mv88e6xxx_chip *chip, int port)
port = (port + 1) << 5; port = (port + 1) << 5;
/* Snapshot the hardware statistics counters for this port. */ /* Snapshot the hardware statistics counters for this port. */
err = mv88e6xxx_g1_write(chip, GLOBAL_STATS_OP, err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_STATS_OP,
GLOBAL_STATS_OP_CAPTURE_PORT | port); MV88E6XXX_G1_STATS_OP_BUSY |
MV88E6XXX_G1_STATS_OP_CAPTURE_PORT | port);
if (err) if (err)
return err; return err;
...@@ -379,8 +422,9 @@ void mv88e6xxx_g1_stats_read(struct mv88e6xxx_chip *chip, int stat, u32 *val) ...@@ -379,8 +422,9 @@ void mv88e6xxx_g1_stats_read(struct mv88e6xxx_chip *chip, int stat, u32 *val)
*val = 0; *val = 0;
err = mv88e6xxx_g1_write(chip, GLOBAL_STATS_OP, err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_STATS_OP,
GLOBAL_STATS_OP_READ_CAPTURED | stat); MV88E6XXX_G1_STATS_OP_BUSY |
MV88E6XXX_G1_STATS_OP_READ_CAPTURED | stat);
if (err) if (err)
return; return;
...@@ -388,13 +432,13 @@ void mv88e6xxx_g1_stats_read(struct mv88e6xxx_chip *chip, int stat, u32 *val) ...@@ -388,13 +432,13 @@ void mv88e6xxx_g1_stats_read(struct mv88e6xxx_chip *chip, int stat, u32 *val)
if (err) if (err)
return; return;
err = mv88e6xxx_g1_read(chip, GLOBAL_STATS_COUNTER_32, &reg); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STATS_COUNTER_32, &reg);
if (err) if (err)
return; return;
value = reg << 16; value = reg << 16;
err = mv88e6xxx_g1_read(chip, GLOBAL_STATS_COUNTER_01, &reg); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STATS_COUNTER_01, &reg);
if (err) if (err)
return; return;
......
...@@ -17,151 +17,214 @@ ...@@ -17,151 +17,214 @@
#include "chip.h" #include "chip.h"
#define GLOBAL_STATUS 0x00 /* Offset 0x00: Switch Global Status Register */
#define GLOBAL_STATUS_PPU_STATE BIT(15) /* 6351 and 6171 */ #define MV88E6XXX_G1_STS 0x00
#define GLOBAL_STATUS_PPU_STATE_MASK (0x3 << 14) /* 6165 6185 */ #define MV88E6352_G1_STS_PPU_STATE 0x8000
#define GLOBAL_STATUS_PPU_STATE_DISABLED_RST (0x0 << 14) #define MV88E6185_G1_STS_PPU_STATE_MASK 0xc000
#define GLOBAL_STATUS_PPU_STATE_INITIALIZING (0x1 << 14) #define MV88E6185_G1_STS_PPU_STATE_DISABLED_RST 0x0000
#define GLOBAL_STATUS_PPU_STATE_DISABLED (0x2 << 14) #define MV88E6185_G1_STS_PPU_STATE_INITIALIZING 0x4000
#define GLOBAL_STATUS_PPU_STATE_POLLING (0x3 << 14) #define MV88E6185_G1_STS_PPU_STATE_DISABLED 0x8000
#define GLOBAL_STATUS_INIT_READY BIT(11) #define MV88E6185_G1_STS_PPU_STATE_POLLING 0xc000
#define GLOBAL_STATUS_IRQ_AVB 8 #define MV88E6XXX_G1_STS_INIT_READY 0x0800
#define GLOBAL_STATUS_IRQ_DEVICE 7 #define MV88E6XXX_G1_STS_IRQ_AVB 8
#define GLOBAL_STATUS_IRQ_STATS 6 #define MV88E6XXX_G1_STS_IRQ_DEVICE 7
#define GLOBAL_STATUS_IRQ_VTU_PROBLEM 5 #define MV88E6XXX_G1_STS_IRQ_STATS 6
#define GLOBAL_STATUS_IRQ_VTU_DONE 4 #define MV88E6XXX_G1_STS_IRQ_VTU_PROBLEM 5
#define GLOBAL_STATUS_IRQ_ATU_PROBLEM 3 #define MV88E6XXX_G1_STS_IRQ_VTU_DONE 4
#define GLOBAL_STATUS_IRQ_ATU_DONE 2 #define MV88E6XXX_G1_STS_IRQ_ATU_PROBLEM 3
#define GLOBAL_STATUS_IRQ_TCAM_DONE 1 #define MV88E6XXX_G1_STS_IRQ_ATU_DONE 2
#define GLOBAL_STATUS_IRQ_EEPROM_DONE 0 #define MV88E6XXX_G1_STS_IRQ_TCAM_DONE 1
#define GLOBAL_MAC_01 0x01 #define MV88E6XXX_G1_STS_IRQ_EEPROM_DONE 0
#define GLOBAL_MAC_23 0x02
#define GLOBAL_MAC_45 0x03 /* Offset 0x01: Switch MAC Address Register Bytes 0 & 1
#define GLOBAL_ATU_FID 0x01 * Offset 0x02: Switch MAC Address Register Bytes 2 & 3
#define GLOBAL_VTU_FID 0x02 * Offset 0x03: Switch MAC Address Register Bytes 4 & 5
#define GLOBAL_VTU_FID_MASK 0xfff */
#define GLOBAL_VTU_SID 0x03 /* 6097 6165 6351 6352 */ #define MV88E6XXX_G1_MAC_01 0x01
#define GLOBAL_VTU_SID_MASK 0x3f #define MV88E6XXX_G1_MAC_23 0x02
#define GLOBAL_CONTROL 0x04 #define MV88E6XXX_G1_MAC_45 0x03
#define GLOBAL_CONTROL_SW_RESET BIT(15)
#define GLOBAL_CONTROL_PPU_ENABLE BIT(14) /* Offset 0x01: ATU FID Register */
#define GLOBAL_CONTROL_DISCARD_EXCESS BIT(13) /* 6352 */ #define MV88E6352_G1_ATU_FID 0x01
#define GLOBAL_CONTROL_SCHED_PRIO BIT(11) /* 6152 */
#define GLOBAL_CONTROL_MAX_FRAME_1632 BIT(10) /* 6152 */ /* Offset 0x02: VTU FID Register */
#define GLOBAL_CONTROL_RELOAD_EEPROM BIT(9) /* 6152 */ #define MV88E6352_G1_VTU_FID 0x02
#define GLOBAL_CONTROL_DEVICE_EN BIT(7) #define MV88E6352_G1_VTU_FID_MASK 0x0fff
#define GLOBAL_CONTROL_STATS_DONE_EN BIT(6)
#define GLOBAL_CONTROL_VTU_PROBLEM_EN BIT(5) /* Offset 0x03: VTU SID Register */
#define GLOBAL_CONTROL_VTU_DONE_EN BIT(4) #define MV88E6352_G1_VTU_SID 0x03
#define GLOBAL_CONTROL_ATU_PROBLEM_EN BIT(3) #define MV88E6352_G1_VTU_SID_MASK 0x3f
#define GLOBAL_CONTROL_ATU_DONE_EN BIT(2)
#define GLOBAL_CONTROL_TCAM_EN BIT(1) /* Offset 0x04: Switch Global Control Register */
#define GLOBAL_CONTROL_EEPROM_DONE_EN BIT(0) #define MV88E6XXX_G1_CTL1 0x04
#define GLOBAL_VTU_OP 0x05 #define MV88E6XXX_G1_CTL1_SW_RESET 0x8000
#define GLOBAL_VTU_OP_BUSY BIT(15) #define MV88E6XXX_G1_CTL1_PPU_ENABLE 0x4000
#define GLOBAL_VTU_OP_FLUSH_ALL ((0x01 << 12) | GLOBAL_VTU_OP_BUSY) #define MV88E6352_G1_CTL1_DISCARD_EXCESS 0x2000
#define GLOBAL_VTU_OP_VTU_LOAD_PURGE ((0x03 << 12) | GLOBAL_VTU_OP_BUSY) #define MV88E6185_G1_CTL1_SCHED_PRIO 0x0800
#define GLOBAL_VTU_OP_VTU_GET_NEXT ((0x04 << 12) | GLOBAL_VTU_OP_BUSY) #define MV88E6185_G1_CTL1_MAX_FRAME_1632 0x0400
#define GLOBAL_VTU_OP_STU_LOAD_PURGE ((0x05 << 12) | GLOBAL_VTU_OP_BUSY) #define MV88E6185_G1_CTL1_RELOAD_EEPROM 0x0200
#define GLOBAL_VTU_OP_STU_GET_NEXT ((0x06 << 12) | GLOBAL_VTU_OP_BUSY) #define MV88E6XXX_G1_CTL1_DEVICE_EN 0x0080
#define GLOBAL_VTU_VID 0x06 #define MV88E6XXX_G1_CTL1_STATS_DONE_EN 0x0040
#define GLOBAL_VTU_VID_MASK 0xfff #define MV88E6XXX_G1_CTL1_VTU_PROBLEM_EN 0x0020
#define GLOBAL_VTU_VID_PAGE BIT(13) #define MV88E6XXX_G1_CTL1_VTU_DONE_EN 0x0010
#define GLOBAL_VTU_VID_VALID BIT(12) #define MV88E6XXX_G1_CTL1_ATU_PROBLEM_EN 0x0008
#define GLOBAL_VTU_DATA_0_3 0x07 #define MV88E6XXX_G1_CTL1_ATU_DONE_EN 0x0004
#define GLOBAL_VTU_DATA_4_7 0x08 #define MV88E6XXX_G1_CTL1_TCAM_EN 0x0002
#define GLOBAL_VTU_DATA_8_11 0x09 #define MV88E6XXX_G1_CTL1_EEPROM_DONE_EN 0x0001
#define GLOBAL_VTU_STU_DATA_MASK 0x03
#define GLOBAL_VTU_DATA_MEMBER_TAG_UNMODIFIED 0x00 /* Offset 0x05: VTU Operation Register */
#define GLOBAL_VTU_DATA_MEMBER_TAG_UNTAGGED 0x01 #define MV88E6XXX_G1_VTU_OP 0x05
#define GLOBAL_VTU_DATA_MEMBER_TAG_TAGGED 0x02 #define MV88E6XXX_G1_VTU_OP_BUSY 0x8000
#define GLOBAL_VTU_DATA_MEMBER_TAG_NON_MEMBER 0x03 #define MV88E6XXX_G1_VTU_OP_MASK 0x7000
#define GLOBAL_STU_DATA_PORT_STATE_DISABLED 0x00 #define MV88E6XXX_G1_VTU_OP_FLUSH_ALL 0x1000
#define GLOBAL_STU_DATA_PORT_STATE_BLOCKING 0x01 #define MV88E6XXX_G1_VTU_OP_NOOP 0x2000
#define GLOBAL_STU_DATA_PORT_STATE_LEARNING 0x02 #define MV88E6XXX_G1_VTU_OP_VTU_LOAD_PURGE 0x3000
#define GLOBAL_STU_DATA_PORT_STATE_FORWARDING 0x03 #define MV88E6XXX_G1_VTU_OP_VTU_GET_NEXT 0x4000
#define GLOBAL_ATU_CONTROL 0x0a #define MV88E6XXX_G1_VTU_OP_STU_LOAD_PURGE 0x5000
#define GLOBAL_ATU_CONTROL_LEARN2ALL BIT(3) #define MV88E6XXX_G1_VTU_OP_STU_GET_NEXT 0x6000
#define GLOBAL_ATU_OP 0x0b
#define GLOBAL_ATU_OP_BUSY BIT(15) /* Offset 0x06: VTU VID Register */
#define GLOBAL_ATU_OP_NOP (0 << 12) #define MV88E6XXX_G1_VTU_VID 0x06
#define GLOBAL_ATU_OP_FLUSH_MOVE_ALL ((1 << 12) | GLOBAL_ATU_OP_BUSY) #define MV88E6XXX_G1_VTU_VID_MASK 0x0fff
#define GLOBAL_ATU_OP_FLUSH_MOVE_NON_STATIC ((2 << 12) | GLOBAL_ATU_OP_BUSY) #define MV88E6390_G1_VTU_VID_PAGE 0x2000
#define GLOBAL_ATU_OP_LOAD_DB ((3 << 12) | GLOBAL_ATU_OP_BUSY) #define MV88E6XXX_G1_VTU_VID_VALID 0x1000
#define GLOBAL_ATU_OP_GET_NEXT_DB ((4 << 12) | GLOBAL_ATU_OP_BUSY)
#define GLOBAL_ATU_OP_FLUSH_MOVE_ALL_DB ((5 << 12) | GLOBAL_ATU_OP_BUSY) /* Offset 0x07: VTU/STU Data Register 1
#define GLOBAL_ATU_OP_FLUSH_MOVE_NON_STATIC_DB ((6 << 12) | GLOBAL_ATU_OP_BUSY) * Offset 0x08: VTU/STU Data Register 2
#define GLOBAL_ATU_OP_GET_CLR_VIOLATION ((7 << 12) | GLOBAL_ATU_OP_BUSY) * Offset 0x09: VTU/STU Data Register 3
#define GLOBAL_ATU_DATA 0x0c */
#define GLOBAL_ATU_DATA_TRUNK BIT(15) #define MV88E6XXX_G1_VTU_DATA1 0x07
#define GLOBAL_ATU_DATA_TRUNK_ID_MASK 0x00f0 #define MV88E6XXX_G1_VTU_DATA2 0x08
#define GLOBAL_ATU_DATA_TRUNK_ID_SHIFT 4 #define MV88E6XXX_G1_VTU_DATA3 0x09
#define GLOBAL_ATU_DATA_PORT_VECTOR_MASK 0x3ff0 #define MV88E6XXX_G1_VTU_STU_DATA_MASK 0x0003
#define GLOBAL_ATU_DATA_PORT_VECTOR_SHIFT 4 #define MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_UNMODIFIED 0x0000
#define GLOBAL_ATU_DATA_STATE_MASK 0x0f #define MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_UNTAGGED 0x0001
#define GLOBAL_ATU_DATA_STATE_UNUSED 0x00 #define MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_TAGGED 0x0002
#define GLOBAL_ATU_DATA_STATE_UC_MGMT 0x0d #define MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER 0x0003
#define GLOBAL_ATU_DATA_STATE_UC_STATIC 0x0e #define MV88E6XXX_G1_STU_DATA_PORT_STATE_DISABLED 0x0000
#define GLOBAL_ATU_DATA_STATE_UC_PRIO_OVER 0x0f #define MV88E6XXX_G1_STU_DATA_PORT_STATE_BLOCKING 0x0001
#define GLOBAL_ATU_DATA_STATE_MC_NONE_RATE 0x05 #define MV88E6XXX_G1_STU_DATA_PORT_STATE_LEARNING 0x0002
#define GLOBAL_ATU_DATA_STATE_MC_STATIC 0x07 #define MV88E6XXX_G1_STU_DATA_PORT_STATE_FORWARDING 0x0003
#define GLOBAL_ATU_DATA_STATE_MC_MGMT 0x0e
#define GLOBAL_ATU_DATA_STATE_MC_PRIO_OVER 0x0f /* Offset 0x0A: ATU Control Register */
#define GLOBAL_ATU_MAC_01 0x0d #define MV88E6XXX_G1_ATU_CTL 0x0a
#define GLOBAL_ATU_MAC_23 0x0e #define MV88E6XXX_G1_ATU_CTL_LEARN2ALL 0x0008
#define GLOBAL_ATU_MAC_45 0x0f
#define GLOBAL_IP_PRI_0 0x10 /* Offset 0x0B: ATU Operation Register */
#define GLOBAL_IP_PRI_1 0x11 #define MV88E6XXX_G1_ATU_OP 0x0b
#define GLOBAL_IP_PRI_2 0x12 #define MV88E6XXX_G1_ATU_OP_BUSY 0x8000
#define GLOBAL_IP_PRI_3 0x13 #define MV88E6XXX_G1_ATU_OP_MASK 0x7000
#define GLOBAL_IP_PRI_4 0x14 #define MV88E6XXX_G1_ATU_OP_NOOP 0x0000
#define GLOBAL_IP_PRI_5 0x15 #define MV88E6XXX_G1_ATU_OP_FLUSH_MOVE_ALL 0x1000
#define GLOBAL_IP_PRI_6 0x16 #define MV88E6XXX_G1_ATU_OP_FLUSH_MOVE_NON_STATIC 0x2000
#define GLOBAL_IP_PRI_7 0x17 #define MV88E6XXX_G1_ATU_OP_LOAD_DB 0x3000
#define GLOBAL_IEEE_PRI 0x18 #define MV88E6XXX_G1_ATU_OP_GET_NEXT_DB 0x4000
#define GLOBAL_CORE_TAG_TYPE 0x19 #define MV88E6XXX_G1_ATU_OP_FLUSH_MOVE_ALL_DB 0x5000
#define GLOBAL_MONITOR_CONTROL 0x1a #define MV88E6XXX_G1_ATU_OP_FLUSH_MOVE_NON_STATIC_DB 0x6000
#define GLOBAL_MONITOR_CONTROL_INGRESS_SHIFT 12 #define MV88E6XXX_G1_ATU_OP_GET_CLR_VIOLATION 0x7000
#define GLOBAL_MONITOR_CONTROL_INGRESS_MASK (0xf << 12)
#define GLOBAL_MONITOR_CONTROL_EGRESS_SHIFT 8 /* Offset 0x0C: ATU Data Register */
#define GLOBAL_MONITOR_CONTROL_EGRESS_MASK (0xf << 8) #define MV88E6XXX_G1_ATU_DATA 0x0c
#define GLOBAL_MONITOR_CONTROL_ARP_SHIFT 4 #define MV88E6XXX_G1_ATU_DATA_TRUNK 0x8000
#define GLOBAL_MONITOR_CONTROL_ARP_MASK (0xf << 4) #define MV88E6XXX_G1_ATU_DATA_TRUNK_ID_MASK 0x00f0
#define GLOBAL_MONITOR_CONTROL_MIRROR_SHIFT 0 #define MV88E6XXX_G1_ATU_DATA_PORT_VECTOR_MASK 0x3ff0
#define GLOBAL_MONITOR_CONTROL_ARP_DISABLED (0xf0) #define MV88E6XXX_G1_ATU_DATA_STATE_MASK 0x000f
#define GLOBAL_MONITOR_CONTROL_UPDATE BIT(15) #define MV88E6XXX_G1_ATU_DATA_STATE_UNUSED 0x0000
#define GLOBAL_MONITOR_CONTROL_0180C280000000XLO (0x00 << 8) #define MV88E6XXX_G1_ATU_DATA_STATE_UC_MGMT 0x000d
#define GLOBAL_MONITOR_CONTROL_0180C280000000XHI (0x01 << 8) #define MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC 0x000e
#define GLOBAL_MONITOR_CONTROL_0180C280000002XLO (0x02 << 8) #define MV88E6XXX_G1_ATU_DATA_STATE_UC_PRIO_OVER 0x000f
#define GLOBAL_MONITOR_CONTROL_0180C280000002XHI (0x03 << 8) #define MV88E6XXX_G1_ATU_DATA_STATE_MC_NONE_RATE 0x0005
#define GLOBAL_MONITOR_CONTROL_INGRESS (0x20 << 8) #define MV88E6XXX_G1_ATU_DATA_STATE_MC_STATIC 0x0007
#define GLOBAL_MONITOR_CONTROL_EGRESS (0x21 << 8) #define MV88E6XXX_G1_ATU_DATA_STATE_MC_MGMT 0x000e
#define GLOBAL_MONITOR_CONTROL_CPU_DEST (0x30 << 8) #define MV88E6XXX_G1_ATU_DATA_STATE_MC_PRIO_OVER 0x000f
#define GLOBAL_CONTROL_2 0x1c
#define GLOBAL_CONTROL_2_NO_CASCADE 0xe000 /* Offset 0x0D: ATU MAC Address Register Bytes 0 & 1
#define GLOBAL_CONTROL_2_MULTIPLE_CASCADE 0xf000 * Offset 0x0E: ATU MAC Address Register Bytes 2 & 3
#define GLOBAL_CONTROL_2_HIST_RX (0x1 << 6) * Offset 0x0F: ATU MAC Address Register Bytes 4 & 5
#define GLOBAL_CONTROL_2_HIST_TX (0x2 << 6) */
#define GLOBAL_CONTROL_2_HIST_RX_TX (0x3 << 6) #define MV88E6XXX_G1_ATU_MAC01 0x0d
#define GLOBAL_STATS_OP 0x1d #define MV88E6XXX_G1_ATU_MAC23 0x0e
#define GLOBAL_STATS_OP_BUSY BIT(15) #define MV88E6XXX_G1_ATU_MAC45 0x0f
#define GLOBAL_STATS_OP_NOP (0 << 12)
#define GLOBAL_STATS_OP_FLUSH_ALL ((1 << 12) | GLOBAL_STATS_OP_BUSY) /* Offset 0x10: IP-PRI Mapping Register 0
#define GLOBAL_STATS_OP_FLUSH_PORT ((2 << 12) | GLOBAL_STATS_OP_BUSY) * Offset 0x11: IP-PRI Mapping Register 1
#define GLOBAL_STATS_OP_READ_CAPTURED ((4 << 12) | GLOBAL_STATS_OP_BUSY) * Offset 0x12: IP-PRI Mapping Register 2
#define GLOBAL_STATS_OP_CAPTURE_PORT ((5 << 12) | GLOBAL_STATS_OP_BUSY) * Offset 0x13: IP-PRI Mapping Register 3
#define GLOBAL_STATS_OP_HIST_RX ((1 << 10) | GLOBAL_STATS_OP_BUSY) * Offset 0x14: IP-PRI Mapping Register 4
#define GLOBAL_STATS_OP_HIST_TX ((2 << 10) | GLOBAL_STATS_OP_BUSY) * Offset 0x15: IP-PRI Mapping Register 5
#define GLOBAL_STATS_OP_HIST_RX_TX ((3 << 10) | GLOBAL_STATS_OP_BUSY) * Offset 0x16: IP-PRI Mapping Register 6
#define GLOBAL_STATS_OP_BANK_1_BIT_9 BIT(9) * Offset 0x17: IP-PRI Mapping Register 7
#define GLOBAL_STATS_OP_BANK_1_BIT_10 BIT(10) */
#define GLOBAL_STATS_COUNTER_32 0x1e #define MV88E6XXX_G1_IP_PRI_0 0x10
#define GLOBAL_STATS_COUNTER_01 0x1f #define MV88E6XXX_G1_IP_PRI_1 0x11
#define MV88E6XXX_G1_IP_PRI_2 0x12
#define MV88E6XXX_G1_IP_PRI_3 0x13
#define MV88E6XXX_G1_IP_PRI_4 0x14
#define MV88E6XXX_G1_IP_PRI_5 0x15
#define MV88E6XXX_G1_IP_PRI_6 0x16
#define MV88E6XXX_G1_IP_PRI_7 0x17
/* Offset 0x18: IEEE-PRI Register */
#define MV88E6XXX_G1_IEEE_PRI 0x18
/* Offset 0x19: Core Tag Type */
#define MV88E6185_G1_CORE_TAG_TYPE 0x19
/* Offset 0x1A: Monitor Control */
#define MV88E6185_G1_MONITOR_CTL 0x1a
#define MV88E6185_G1_MONITOR_CTL_INGRESS_DEST_MASK 0xf000
#define MV88E6185_G1_MONITOR_CTL_EGRESS_DEST_MASK 0x0f00
#define MV88E6185_G1_MONITOR_CTL_ARP_DEST_MASK 0x00f0
#define MV88E6352_G1_MONITOR_CTL_CPU_DEST_MASK 0x00f0
#define MV88E6352_G1_MONITOR_CTL_MIRROR_DEST_MASK 0x000f
/* Offset 0x1A: Monitor & MGMT Control Register */
#define MV88E6390_G1_MONITOR_MGMT_CTL 0x1a
#define MV88E6390_G1_MONITOR_MGMT_CTL_UPDATE 0x8000
#define MV88E6390_G1_MONITOR_MGMT_CTL_PTR_MASK 0x3f00
#define MV88E6390_G1_MONITOR_MGMT_CTL_PTR_0180C280000000XLO 0x0000
#define MV88E6390_G1_MONITOR_MGMT_CTL_PTR_0180C280000000XHI 0x0100
#define MV88E6390_G1_MONITOR_MGMT_CTL_PTR_0180C280000002XLO 0x0200
#define MV88E6390_G1_MONITOR_MGMT_CTL_PTR_0180C280000002XHI 0x0300
#define MV88E6390_G1_MONITOR_MGMT_CTL_PTR_INGRESS_DEST 0x2000
#define MV88E6390_G1_MONITOR_MGMT_CTL_PTR_EGRESS_DEST 0x2100
#define MV88E6390_G1_MONITOR_MGMT_CTL_PTR_CPU_DEST 0x3000
#define MV88E6390_G1_MONITOR_MGMT_CTL_DATA_MASK 0x00ff
/* Offset 0x1C: Global Control 2 */
#define MV88E6XXX_G1_CTL2 0x1c
#define MV88E6XXX_G1_CTL2_NO_CASCADE 0xe000
#define MV88E6XXX_G1_CTL2_MULTIPLE_CASCADE 0xf000
#define MV88E6XXX_G1_CTL2_HIST_RX 0x0040
#define MV88E6XXX_G1_CTL2_HIST_TX 0x0080
#define MV88E6XXX_G1_CTL2_HIST_RX_TX 0x00c0
/* Offset 0x1D: Stats Operation Register */
#define MV88E6XXX_G1_STATS_OP 0x1d
#define MV88E6XXX_G1_STATS_OP_BUSY 0x8000
#define MV88E6XXX_G1_STATS_OP_NOP 0x0000
#define MV88E6XXX_G1_STATS_OP_FLUSH_ALL 0x1000
#define MV88E6XXX_G1_STATS_OP_FLUSH_PORT 0x2000
#define MV88E6XXX_G1_STATS_OP_READ_CAPTURED 0x4000
#define MV88E6XXX_G1_STATS_OP_CAPTURE_PORT 0x5000
#define MV88E6XXX_G1_STATS_OP_HIST_RX 0x0400
#define MV88E6XXX_G1_STATS_OP_HIST_TX 0x0800
#define MV88E6XXX_G1_STATS_OP_HIST_RX_TX 0x0c00
#define MV88E6XXX_G1_STATS_OP_BANK_1_BIT_9 0x0200
#define MV88E6XXX_G1_STATS_OP_BANK_1_BIT_10 0x0400
/* Offset 0x1E: Stats Counter Register Bytes 3 & 2
* Offset 0x1F: Stats Counter Register Bytes 1 & 0
*/
#define MV88E6XXX_G1_STATS_COUNTER_32 0x1e
#define MV88E6XXX_G1_STATS_COUNTER_01 0x1f
int mv88e6xxx_g1_read(struct mv88e6xxx_chip *chip, int reg, u16 *val); int mv88e6xxx_g1_read(struct mv88e6xxx_chip *chip, int reg, u16 *val);
int mv88e6xxx_g1_write(struct mv88e6xxx_chip *chip, int reg, u16 val); int mv88e6xxx_g1_write(struct mv88e6xxx_chip *chip, int reg, u16 val);
int mv88e6xxx_g1_wait(struct mv88e6xxx_chip *chip, int reg, u16 mask); int mv88e6xxx_g1_wait(struct mv88e6xxx_chip *chip, int reg, u16 mask);
int mv88e6xxx_g1_set_switch_mac(struct mv88e6xxx_chip *chip, u8 *addr);
int mv88e6185_g1_reset(struct mv88e6xxx_chip *chip); int mv88e6185_g1_reset(struct mv88e6xxx_chip *chip);
int mv88e6352_g1_reset(struct mv88e6xxx_chip *chip); int mv88e6352_g1_reset(struct mv88e6xxx_chip *chip);
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
static int mv88e6xxx_g1_atu_fid_write(struct mv88e6xxx_chip *chip, u16 fid) static int mv88e6xxx_g1_atu_fid_write(struct mv88e6xxx_chip *chip, u16 fid)
{ {
return mv88e6xxx_g1_write(chip, GLOBAL_ATU_FID, fid & 0xfff); return mv88e6xxx_g1_write(chip, MV88E6352_G1_ATU_FID, fid & 0xfff);
} }
/* Offset 0x0A: ATU Control Register */ /* Offset 0x0A: ATU Control Register */
...@@ -27,16 +27,16 @@ int mv88e6xxx_g1_atu_set_learn2all(struct mv88e6xxx_chip *chip, bool learn2all) ...@@ -27,16 +27,16 @@ int mv88e6xxx_g1_atu_set_learn2all(struct mv88e6xxx_chip *chip, bool learn2all)
u16 val; u16 val;
int err; int err;
err = mv88e6xxx_g1_read(chip, GLOBAL_ATU_CONTROL, &val); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_ATU_CTL, &val);
if (err) if (err)
return err; return err;
if (learn2all) if (learn2all)
val |= GLOBAL_ATU_CONTROL_LEARN2ALL; val |= MV88E6XXX_G1_ATU_CTL_LEARN2ALL;
else else
val &= ~GLOBAL_ATU_CONTROL_LEARN2ALL; val &= ~MV88E6XXX_G1_ATU_CTL_LEARN2ALL;
return mv88e6xxx_g1_write(chip, GLOBAL_ATU_CONTROL, val); return mv88e6xxx_g1_write(chip, MV88E6XXX_G1_ATU_CTL, val);
} }
int mv88e6xxx_g1_atu_set_age_time(struct mv88e6xxx_chip *chip, int mv88e6xxx_g1_atu_set_age_time(struct mv88e6xxx_chip *chip,
...@@ -55,7 +55,7 @@ int mv88e6xxx_g1_atu_set_age_time(struct mv88e6xxx_chip *chip, ...@@ -55,7 +55,7 @@ int mv88e6xxx_g1_atu_set_age_time(struct mv88e6xxx_chip *chip,
/* Round to nearest multiple of coeff */ /* Round to nearest multiple of coeff */
age_time = (msecs + coeff / 2) / coeff; age_time = (msecs + coeff / 2) / coeff;
err = mv88e6xxx_g1_read(chip, GLOBAL_ATU_CONTROL, &val); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_ATU_CTL, &val);
if (err) if (err)
return err; return err;
...@@ -63,7 +63,7 @@ int mv88e6xxx_g1_atu_set_age_time(struct mv88e6xxx_chip *chip, ...@@ -63,7 +63,7 @@ int mv88e6xxx_g1_atu_set_age_time(struct mv88e6xxx_chip *chip,
val &= ~0xff0; val &= ~0xff0;
val |= age_time << 4; val |= age_time << 4;
err = mv88e6xxx_g1_write(chip, GLOBAL_ATU_CONTROL, val); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_ATU_CTL, val);
if (err) if (err)
return err; return err;
...@@ -77,7 +77,8 @@ int mv88e6xxx_g1_atu_set_age_time(struct mv88e6xxx_chip *chip, ...@@ -77,7 +77,8 @@ int mv88e6xxx_g1_atu_set_age_time(struct mv88e6xxx_chip *chip,
static int mv88e6xxx_g1_atu_op_wait(struct mv88e6xxx_chip *chip) static int mv88e6xxx_g1_atu_op_wait(struct mv88e6xxx_chip *chip)
{ {
return mv88e6xxx_g1_wait(chip, GLOBAL_ATU_OP, GLOBAL_ATU_OP_BUSY); return mv88e6xxx_g1_wait(chip, MV88E6XXX_G1_ATU_OP,
MV88E6XXX_G1_ATU_OP_BUSY);
} }
static int mv88e6xxx_g1_atu_op(struct mv88e6xxx_chip *chip, u16 fid, u16 op) static int mv88e6xxx_g1_atu_op(struct mv88e6xxx_chip *chip, u16 fid, u16 op)
...@@ -93,12 +94,14 @@ static int mv88e6xxx_g1_atu_op(struct mv88e6xxx_chip *chip, u16 fid, u16 op) ...@@ -93,12 +94,14 @@ static int mv88e6xxx_g1_atu_op(struct mv88e6xxx_chip *chip, u16 fid, u16 op)
} else { } else {
if (mv88e6xxx_num_databases(chip) > 16) { if (mv88e6xxx_num_databases(chip) > 16) {
/* ATU DBNum[7:4] are located in ATU Control 15:12 */ /* ATU DBNum[7:4] are located in ATU Control 15:12 */
err = mv88e6xxx_g1_read(chip, GLOBAL_ATU_CONTROL, &val); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_ATU_CTL,
&val);
if (err) if (err)
return err; return err;
val = (val & 0x0fff) | ((fid << 8) & 0xf000); val = (val & 0x0fff) | ((fid << 8) & 0xf000);
err = mv88e6xxx_g1_write(chip, GLOBAL_ATU_CONTROL, val); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_ATU_CTL,
val);
if (err) if (err)
return err; return err;
} }
...@@ -107,7 +110,8 @@ static int mv88e6xxx_g1_atu_op(struct mv88e6xxx_chip *chip, u16 fid, u16 op) ...@@ -107,7 +110,8 @@ static int mv88e6xxx_g1_atu_op(struct mv88e6xxx_chip *chip, u16 fid, u16 op)
op |= fid & 0xf; op |= fid & 0xf;
} }
err = mv88e6xxx_g1_write(chip, GLOBAL_ATU_OP, op); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_ATU_OP,
MV88E6XXX_G1_ATU_OP_BUSY | op);
if (err) if (err)
return err; return err;
...@@ -122,13 +126,13 @@ static int mv88e6xxx_g1_atu_data_read(struct mv88e6xxx_chip *chip, ...@@ -122,13 +126,13 @@ static int mv88e6xxx_g1_atu_data_read(struct mv88e6xxx_chip *chip,
u16 val; u16 val;
int err; int err;
err = mv88e6xxx_g1_read(chip, GLOBAL_ATU_DATA, &val); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_ATU_DATA, &val);
if (err) if (err)
return err; return err;
entry->state = val & 0xf; entry->state = val & 0xf;
if (entry->state != GLOBAL_ATU_DATA_STATE_UNUSED) { if (entry->state != MV88E6XXX_G1_ATU_DATA_STATE_UNUSED) {
entry->trunk = !!(val & GLOBAL_ATU_DATA_TRUNK); entry->trunk = !!(val & MV88E6XXX_G1_ATU_DATA_TRUNK);
entry->portvec = (val >> 4) & mv88e6xxx_port_mask(chip); entry->portvec = (val >> 4) & mv88e6xxx_port_mask(chip);
} }
...@@ -140,14 +144,14 @@ static int mv88e6xxx_g1_atu_data_write(struct mv88e6xxx_chip *chip, ...@@ -140,14 +144,14 @@ static int mv88e6xxx_g1_atu_data_write(struct mv88e6xxx_chip *chip,
{ {
u16 data = entry->state & 0xf; u16 data = entry->state & 0xf;
if (entry->state != GLOBAL_ATU_DATA_STATE_UNUSED) { if (entry->state != MV88E6XXX_G1_ATU_DATA_STATE_UNUSED) {
if (entry->trunk) if (entry->trunk)
data |= GLOBAL_ATU_DATA_TRUNK; data |= MV88E6XXX_G1_ATU_DATA_TRUNK;
data |= (entry->portvec & mv88e6xxx_port_mask(chip)) << 4; data |= (entry->portvec & mv88e6xxx_port_mask(chip)) << 4;
} }
return mv88e6xxx_g1_write(chip, GLOBAL_ATU_DATA, data); return mv88e6xxx_g1_write(chip, MV88E6XXX_G1_ATU_DATA, data);
} }
/* Offset 0x0D: ATU MAC Address Register Bytes 0 & 1 /* Offset 0x0D: ATU MAC Address Register Bytes 0 & 1
...@@ -162,7 +166,7 @@ static int mv88e6xxx_g1_atu_mac_read(struct mv88e6xxx_chip *chip, ...@@ -162,7 +166,7 @@ static int mv88e6xxx_g1_atu_mac_read(struct mv88e6xxx_chip *chip,
int i, err; int i, err;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
err = mv88e6xxx_g1_read(chip, GLOBAL_ATU_MAC_01 + i, &val); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_ATU_MAC01 + i, &val);
if (err) if (err)
return err; return err;
...@@ -181,7 +185,7 @@ static int mv88e6xxx_g1_atu_mac_write(struct mv88e6xxx_chip *chip, ...@@ -181,7 +185,7 @@ static int mv88e6xxx_g1_atu_mac_write(struct mv88e6xxx_chip *chip,
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
val = (entry->mac[i * 2] << 8) | entry->mac[i * 2 + 1]; val = (entry->mac[i * 2] << 8) | entry->mac[i * 2 + 1];
err = mv88e6xxx_g1_write(chip, GLOBAL_ATU_MAC_01 + i, val); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_ATU_MAC01 + i, val);
if (err) if (err)
return err; return err;
} }
...@@ -201,13 +205,13 @@ int mv88e6xxx_g1_atu_getnext(struct mv88e6xxx_chip *chip, u16 fid, ...@@ -201,13 +205,13 @@ int mv88e6xxx_g1_atu_getnext(struct mv88e6xxx_chip *chip, u16 fid,
return err; return err;
/* Write the MAC address to iterate from only once */ /* Write the MAC address to iterate from only once */
if (entry->state == GLOBAL_ATU_DATA_STATE_UNUSED) { if (entry->state == MV88E6XXX_G1_ATU_DATA_STATE_UNUSED) {
err = mv88e6xxx_g1_atu_mac_write(chip, entry); err = mv88e6xxx_g1_atu_mac_write(chip, entry);
if (err) if (err)
return err; return err;
} }
err = mv88e6xxx_g1_atu_op(chip, fid, GLOBAL_ATU_OP_GET_NEXT_DB); err = mv88e6xxx_g1_atu_op(chip, fid, MV88E6XXX_G1_ATU_OP_GET_NEXT_DB);
if (err) if (err)
return err; return err;
...@@ -235,7 +239,7 @@ int mv88e6xxx_g1_atu_loadpurge(struct mv88e6xxx_chip *chip, u16 fid, ...@@ -235,7 +239,7 @@ int mv88e6xxx_g1_atu_loadpurge(struct mv88e6xxx_chip *chip, u16 fid,
if (err) if (err)
return err; return err;
return mv88e6xxx_g1_atu_op(chip, fid, GLOBAL_ATU_OP_LOAD_DB); return mv88e6xxx_g1_atu_op(chip, fid, MV88E6XXX_G1_ATU_OP_LOAD_DB);
} }
static int mv88e6xxx_g1_atu_flushmove(struct mv88e6xxx_chip *chip, u16 fid, static int mv88e6xxx_g1_atu_flushmove(struct mv88e6xxx_chip *chip, u16 fid,
...@@ -255,13 +259,13 @@ static int mv88e6xxx_g1_atu_flushmove(struct mv88e6xxx_chip *chip, u16 fid, ...@@ -255,13 +259,13 @@ static int mv88e6xxx_g1_atu_flushmove(struct mv88e6xxx_chip *chip, u16 fid,
/* Flush/Move all or non-static entries from all or a given database */ /* Flush/Move all or non-static entries from all or a given database */
if (all && fid) if (all && fid)
op = GLOBAL_ATU_OP_FLUSH_MOVE_ALL_DB; op = MV88E6XXX_G1_ATU_OP_FLUSH_MOVE_ALL_DB;
else if (fid) else if (fid)
op = GLOBAL_ATU_OP_FLUSH_MOVE_NON_STATIC_DB; op = MV88E6XXX_G1_ATU_OP_FLUSH_MOVE_NON_STATIC_DB;
else if (all) else if (all)
op = GLOBAL_ATU_OP_FLUSH_MOVE_ALL; op = MV88E6XXX_G1_ATU_OP_FLUSH_MOVE_ALL;
else else
op = GLOBAL_ATU_OP_FLUSH_MOVE_NON_STATIC; op = MV88E6XXX_G1_ATU_OP_FLUSH_MOVE_NON_STATIC;
return mv88e6xxx_g1_atu_op(chip, fid, op); return mv88e6xxx_g1_atu_op(chip, fid, op);
} }
......
...@@ -22,11 +22,11 @@ static int mv88e6xxx_g1_vtu_fid_read(struct mv88e6xxx_chip *chip, ...@@ -22,11 +22,11 @@ static int mv88e6xxx_g1_vtu_fid_read(struct mv88e6xxx_chip *chip,
u16 val; u16 val;
int err; int err;
err = mv88e6xxx_g1_read(chip, GLOBAL_VTU_FID, &val); err = mv88e6xxx_g1_read(chip, MV88E6352_G1_VTU_FID, &val);
if (err) if (err)
return err; return err;
entry->fid = val & GLOBAL_VTU_FID_MASK; entry->fid = val & MV88E6352_G1_VTU_FID_MASK;
return 0; return 0;
} }
...@@ -34,9 +34,9 @@ static int mv88e6xxx_g1_vtu_fid_read(struct mv88e6xxx_chip *chip, ...@@ -34,9 +34,9 @@ static int mv88e6xxx_g1_vtu_fid_read(struct mv88e6xxx_chip *chip,
static int mv88e6xxx_g1_vtu_fid_write(struct mv88e6xxx_chip *chip, static int mv88e6xxx_g1_vtu_fid_write(struct mv88e6xxx_chip *chip,
struct mv88e6xxx_vtu_entry *entry) struct mv88e6xxx_vtu_entry *entry)
{ {
u16 val = entry->fid & GLOBAL_VTU_FID_MASK; u16 val = entry->fid & MV88E6352_G1_VTU_FID_MASK;
return mv88e6xxx_g1_write(chip, GLOBAL_VTU_FID, val); return mv88e6xxx_g1_write(chip, MV88E6352_G1_VTU_FID, val);
} }
/* Offset 0x03: VTU SID Register */ /* Offset 0x03: VTU SID Register */
...@@ -47,11 +47,11 @@ static int mv88e6xxx_g1_vtu_sid_read(struct mv88e6xxx_chip *chip, ...@@ -47,11 +47,11 @@ static int mv88e6xxx_g1_vtu_sid_read(struct mv88e6xxx_chip *chip,
u16 val; u16 val;
int err; int err;
err = mv88e6xxx_g1_read(chip, GLOBAL_VTU_SID, &val); err = mv88e6xxx_g1_read(chip, MV88E6352_G1_VTU_SID, &val);
if (err) if (err)
return err; return err;
entry->sid = val & GLOBAL_VTU_SID_MASK; entry->sid = val & MV88E6352_G1_VTU_SID_MASK;
return 0; return 0;
} }
...@@ -59,23 +59,25 @@ static int mv88e6xxx_g1_vtu_sid_read(struct mv88e6xxx_chip *chip, ...@@ -59,23 +59,25 @@ static int mv88e6xxx_g1_vtu_sid_read(struct mv88e6xxx_chip *chip,
static int mv88e6xxx_g1_vtu_sid_write(struct mv88e6xxx_chip *chip, static int mv88e6xxx_g1_vtu_sid_write(struct mv88e6xxx_chip *chip,
struct mv88e6xxx_vtu_entry *entry) struct mv88e6xxx_vtu_entry *entry)
{ {
u16 val = entry->sid & GLOBAL_VTU_SID_MASK; u16 val = entry->sid & MV88E6352_G1_VTU_SID_MASK;
return mv88e6xxx_g1_write(chip, GLOBAL_VTU_SID, val); return mv88e6xxx_g1_write(chip, MV88E6352_G1_VTU_SID, val);
} }
/* Offset 0x05: VTU Operation Register */ /* Offset 0x05: VTU Operation Register */
static int mv88e6xxx_g1_vtu_op_wait(struct mv88e6xxx_chip *chip) static int mv88e6xxx_g1_vtu_op_wait(struct mv88e6xxx_chip *chip)
{ {
return mv88e6xxx_g1_wait(chip, GLOBAL_VTU_OP, GLOBAL_VTU_OP_BUSY); return mv88e6xxx_g1_wait(chip, MV88E6XXX_G1_VTU_OP,
MV88E6XXX_G1_VTU_OP_BUSY);
} }
static int mv88e6xxx_g1_vtu_op(struct mv88e6xxx_chip *chip, u16 op) static int mv88e6xxx_g1_vtu_op(struct mv88e6xxx_chip *chip, u16 op)
{ {
int err; int err;
err = mv88e6xxx_g1_write(chip, GLOBAL_VTU_OP, op); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_VTU_OP,
MV88E6XXX_G1_VTU_OP_BUSY | op);
if (err) if (err)
return err; return err;
...@@ -90,16 +92,16 @@ static int mv88e6xxx_g1_vtu_vid_read(struct mv88e6xxx_chip *chip, ...@@ -90,16 +92,16 @@ static int mv88e6xxx_g1_vtu_vid_read(struct mv88e6xxx_chip *chip,
u16 val; u16 val;
int err; int err;
err = mv88e6xxx_g1_read(chip, GLOBAL_VTU_VID, &val); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_VTU_VID, &val);
if (err) if (err)
return err; return err;
entry->vid = val & 0xfff; entry->vid = val & 0xfff;
if (val & GLOBAL_VTU_VID_PAGE) if (val & MV88E6390_G1_VTU_VID_PAGE)
entry->vid |= 0x1000; entry->vid |= 0x1000;
entry->valid = !!(val & GLOBAL_VTU_VID_VALID); entry->valid = !!(val & MV88E6XXX_G1_VTU_VID_VALID);
return 0; return 0;
} }
...@@ -110,12 +112,12 @@ static int mv88e6xxx_g1_vtu_vid_write(struct mv88e6xxx_chip *chip, ...@@ -110,12 +112,12 @@ static int mv88e6xxx_g1_vtu_vid_write(struct mv88e6xxx_chip *chip,
u16 val = entry->vid & 0xfff; u16 val = entry->vid & 0xfff;
if (entry->vid & 0x1000) if (entry->vid & 0x1000)
val |= GLOBAL_VTU_VID_PAGE; val |= MV88E6390_G1_VTU_VID_PAGE;
if (entry->valid) if (entry->valid)
val |= GLOBAL_VTU_VID_VALID; val |= MV88E6XXX_G1_VTU_VID_VALID;
return mv88e6xxx_g1_write(chip, GLOBAL_VTU_VID, val); return mv88e6xxx_g1_write(chip, MV88E6XXX_G1_VTU_VID, val);
} }
/* Offset 0x07: VTU/STU Data Register 1 /* Offset 0x07: VTU/STU Data Register 1
...@@ -134,7 +136,7 @@ static int mv88e6185_g1_vtu_data_read(struct mv88e6xxx_chip *chip, ...@@ -134,7 +136,7 @@ static int mv88e6185_g1_vtu_data_read(struct mv88e6xxx_chip *chip,
u16 *reg = &regs[i]; u16 *reg = &regs[i];
int err; int err;
err = mv88e6xxx_g1_read(chip, GLOBAL_VTU_DATA_0_3 + i, reg); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_VTU_DATA1 + i, reg);
if (err) if (err)
return err; return err;
} }
...@@ -171,7 +173,7 @@ static int mv88e6185_g1_vtu_data_write(struct mv88e6xxx_chip *chip, ...@@ -171,7 +173,7 @@ static int mv88e6185_g1_vtu_data_write(struct mv88e6xxx_chip *chip,
u16 reg = regs[i]; u16 reg = regs[i];
int err; int err;
err = mv88e6xxx_g1_write(chip, GLOBAL_VTU_DATA_0_3 + i, reg); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_VTU_DATA1 + i, reg);
if (err) if (err)
return err; return err;
} }
...@@ -189,7 +191,7 @@ static int mv88e6390_g1_vtu_data_read(struct mv88e6xxx_chip *chip, u8 *data) ...@@ -189,7 +191,7 @@ static int mv88e6390_g1_vtu_data_read(struct mv88e6xxx_chip *chip, u8 *data)
u16 *reg = &regs[i]; u16 *reg = &regs[i];
int err; int err;
err = mv88e6xxx_g1_read(chip, GLOBAL_VTU_DATA_0_3 + i, reg); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_VTU_DATA1 + i, reg);
if (err) if (err)
return err; return err;
} }
...@@ -221,7 +223,7 @@ static int mv88e6390_g1_vtu_data_write(struct mv88e6xxx_chip *chip, u8 *data) ...@@ -221,7 +223,7 @@ static int mv88e6390_g1_vtu_data_write(struct mv88e6xxx_chip *chip, u8 *data)
u16 reg = regs[i]; u16 reg = regs[i];
int err; int err;
err = mv88e6xxx_g1_write(chip, GLOBAL_VTU_DATA_0_3 + i, reg); err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_VTU_DATA1 + i, reg);
if (err) if (err)
return err; return err;
} }
...@@ -240,7 +242,7 @@ static int mv88e6xxx_g1_vtu_stu_getnext(struct mv88e6xxx_chip *chip, ...@@ -240,7 +242,7 @@ static int mv88e6xxx_g1_vtu_stu_getnext(struct mv88e6xxx_chip *chip,
if (err) if (err)
return err; return err;
err = mv88e6xxx_g1_vtu_op(chip, GLOBAL_VTU_OP_STU_GET_NEXT); err = mv88e6xxx_g1_vtu_op(chip, MV88E6XXX_G1_VTU_OP_STU_GET_NEXT);
if (err) if (err)
return err; return err;
...@@ -295,7 +297,7 @@ static int mv88e6xxx_g1_vtu_getnext(struct mv88e6xxx_chip *chip, ...@@ -295,7 +297,7 @@ static int mv88e6xxx_g1_vtu_getnext(struct mv88e6xxx_chip *chip,
return err; return err;
} }
err = mv88e6xxx_g1_vtu_op(chip, GLOBAL_VTU_OP_VTU_GET_NEXT); err = mv88e6xxx_g1_vtu_op(chip, MV88E6XXX_G1_VTU_OP_VTU_GET_NEXT);
if (err) if (err)
return err; return err;
...@@ -320,7 +322,7 @@ int mv88e6185_g1_vtu_getnext(struct mv88e6xxx_chip *chip, ...@@ -320,7 +322,7 @@ int mv88e6185_g1_vtu_getnext(struct mv88e6xxx_chip *chip,
/* VTU DBNum[3:0] are located in VTU Operation 3:0 /* VTU DBNum[3:0] are located in VTU Operation 3:0
* VTU DBNum[7:4] are located in VTU Operation 11:8 * VTU DBNum[7:4] are located in VTU Operation 11:8
*/ */
err = mv88e6xxx_g1_read(chip, GLOBAL_VTU_OP, &val); err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_VTU_OP, &val);
if (err) if (err)
return err; return err;
...@@ -394,7 +396,7 @@ int mv88e6390_g1_vtu_getnext(struct mv88e6xxx_chip *chip, ...@@ -394,7 +396,7 @@ int mv88e6390_g1_vtu_getnext(struct mv88e6xxx_chip *chip,
int mv88e6185_g1_vtu_loadpurge(struct mv88e6xxx_chip *chip, int mv88e6185_g1_vtu_loadpurge(struct mv88e6xxx_chip *chip,
struct mv88e6xxx_vtu_entry *entry) struct mv88e6xxx_vtu_entry *entry)
{ {
u16 op = GLOBAL_VTU_OP_VTU_LOAD_PURGE; u16 op = MV88E6XXX_G1_VTU_OP_VTU_LOAD_PURGE;
int err; int err;
err = mv88e6xxx_g1_vtu_op_wait(chip); err = mv88e6xxx_g1_vtu_op_wait(chip);
...@@ -444,7 +446,8 @@ int mv88e6352_g1_vtu_loadpurge(struct mv88e6xxx_chip *chip, ...@@ -444,7 +446,8 @@ int mv88e6352_g1_vtu_loadpurge(struct mv88e6xxx_chip *chip,
return err; return err;
/* Load STU entry */ /* Load STU entry */
err = mv88e6xxx_g1_vtu_op(chip, GLOBAL_VTU_OP_STU_LOAD_PURGE); err = mv88e6xxx_g1_vtu_op(chip,
MV88E6XXX_G1_VTU_OP_STU_LOAD_PURGE);
if (err) if (err)
return err; return err;
...@@ -454,7 +457,7 @@ int mv88e6352_g1_vtu_loadpurge(struct mv88e6xxx_chip *chip, ...@@ -454,7 +457,7 @@ int mv88e6352_g1_vtu_loadpurge(struct mv88e6xxx_chip *chip,
} }
/* Load/Purge VTU entry */ /* Load/Purge VTU entry */
return mv88e6xxx_g1_vtu_op(chip, GLOBAL_VTU_OP_VTU_LOAD_PURGE); return mv88e6xxx_g1_vtu_op(chip, MV88E6XXX_G1_VTU_OP_VTU_LOAD_PURGE);
} }
int mv88e6390_g1_vtu_loadpurge(struct mv88e6xxx_chip *chip, int mv88e6390_g1_vtu_loadpurge(struct mv88e6xxx_chip *chip,
...@@ -481,7 +484,8 @@ int mv88e6390_g1_vtu_loadpurge(struct mv88e6xxx_chip *chip, ...@@ -481,7 +484,8 @@ int mv88e6390_g1_vtu_loadpurge(struct mv88e6xxx_chip *chip,
return err; return err;
/* Load STU entry */ /* Load STU entry */
err = mv88e6xxx_g1_vtu_op(chip, GLOBAL_VTU_OP_STU_LOAD_PURGE); err = mv88e6xxx_g1_vtu_op(chip,
MV88E6XXX_G1_VTU_OP_STU_LOAD_PURGE);
if (err) if (err)
return err; return err;
...@@ -496,7 +500,7 @@ int mv88e6390_g1_vtu_loadpurge(struct mv88e6xxx_chip *chip, ...@@ -496,7 +500,7 @@ int mv88e6390_g1_vtu_loadpurge(struct mv88e6xxx_chip *chip,
} }
/* Load/Purge VTU entry */ /* Load/Purge VTU entry */
return mv88e6xxx_g1_vtu_op(chip, GLOBAL_VTU_OP_VTU_LOAD_PURGE); return mv88e6xxx_g1_vtu_op(chip, MV88E6XXX_G1_VTU_OP_VTU_LOAD_PURGE);
} }
int mv88e6xxx_g1_vtu_flush(struct mv88e6xxx_chip *chip) int mv88e6xxx_g1_vtu_flush(struct mv88e6xxx_chip *chip)
...@@ -507,5 +511,5 @@ int mv88e6xxx_g1_vtu_flush(struct mv88e6xxx_chip *chip) ...@@ -507,5 +511,5 @@ int mv88e6xxx_g1_vtu_flush(struct mv88e6xxx_chip *chip)
if (err) if (err)
return err; return err;
return mv88e6xxx_g1_vtu_op(chip, GLOBAL_VTU_OP_FLUSH_ALL); return mv88e6xxx_g1_vtu_op(chip, MV88E6XXX_G1_VTU_OP_FLUSH_ALL);
} }
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <linux/irqdomain.h> #include <linux/irqdomain.h>
#include "chip.h" #include "chip.h"
#include "global1.h" /* for GLOBAL_STATUS_IRQ_DEVICE */ #include "global1.h" /* for MV88E6XXX_G1_STS_IRQ_DEVICE */
#include "global2.h" #include "global2.h"
static int mv88e6xxx_g2_read(struct mv88e6xxx_chip *chip, int reg, u16 *val) static int mv88e6xxx_g2_read(struct mv88e6xxx_chip *chip, int reg, u16 *val)
...@@ -977,7 +977,7 @@ int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip) ...@@ -977,7 +977,7 @@ int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip)
chip->g2_irq.masked = ~0; chip->g2_irq.masked = ~0;
chip->device_irq = irq_find_mapping(chip->g1_irq.domain, chip->device_irq = irq_find_mapping(chip->g1_irq.domain,
GLOBAL_STATUS_IRQ_DEVICE); MV88E6XXX_G1_STS_IRQ_DEVICE);
if (chip->device_irq < 0) { if (chip->device_irq < 0) {
err = chip->device_irq; err = chip->device_irq;
goto out; goto out;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册