===================================================================
@@ -21,6 +21,8 @@
ret = __mv88e6xxx_reg_read(bus, sw_addr, REG_PORT(0), 0x03);
if (ret >= 0) {
ret &= 0xfff0;
+ if (ret == 0x0950)
+ return "Marvell 88E6095/88E6095F";
if (ret == 0x1060)
return "Marvell 88E6131";
}
@@ -28,6 +30,49 @@
return NULL;
}
+static void mv88e6131_show_all(struct dsa_switch *ds)
+{
+ int p, r;
+
+ printk("=== Global regs:\n");
+ for (r = 0; r < 27; r++) {
+ printk(" REG[0x%02x] = 0x%04X\n", r, REG_READ(REG_GLOBAL, r));
+ }
+ printk("=== Port regs:\n");
+ for (p = 0x0; p < 0xB; p++) {
+ for (r = 0; r < 26; r++) {
+ if ((r == 2) || (r == 5) || ((r >= 12) && (r <= 15)))
+ continue;
+ printk(" REG[0x%02x.%02x] = 0x%04x\n", p, r, REG_READ(REG_PORT(p), r));
+ }
+ }
+ printk("=== VTU table:\n");
+ REG_WRITE(REG_GLOBAL, 0x06, 0x0FFF);
+ while (true) {
+ // Issue VTU 'get next' command
+ REG_WRITE(REG_GLOBAL, 0x05, 0xC000);
+ while ((REG_READ(REG_GLOBAL, 0x05) & 0x8000) != 0) msleep(1);
+ p = REG_READ(REG_GLOBAL, 0x06) & 0x1FFF;
+ if ((p & 0x1000) == 0) {
+ break;
+ }
+ printk(" VTU[0x%03x] = 0x%04x/0x%04x/0x%04x\n", p & 0x0FFF,
+ REG_READ(REG_GLOBAL, 0x07),
+ REG_READ(REG_GLOBAL, 0x08),
+ REG_READ(REG_GLOBAL, 0x09));
+ }
+ printk("=== Trunk mask table\n");
+ for (r = 0; r < 8; r++) {
+ REG_WRITE(REG_GLOBAL2, 0x07, (r << 12));
+ printk(" MASK[0x%1x] = 0x%04x\n", r, REG_READ(REG_GLOBAL2, 0x07));
+ }
+ printk("=== Trunk mapping table\n");
+ for (r = 0; r < 16; r++) {
+ REG_WRITE(REG_GLOBAL2, 0x08, (r << 11));
+ printk(" MAP[0x%1x] = 0x%04x\n", r, REG_READ(REG_GLOBAL2, 0x08));
+ }
+}
+
static int mv88e6131_switch_reset(struct dsa_switch *ds)
{
int i;
@@ -36,7 +81,7 @@
/*
* Set all ports to the disabled state.
*/
- for (i = 0; i < 8; i++) {
+ for (i = 0; i < 11; i++) {
ret = REG_READ(REG_PORT(i), 0x04);
REG_WRITE(REG_PORT(i), 0x04, ret & 0xfffc);
}
@@ -91,7 +136,7 @@
* Configure the priority mapping registers.
*/
ret = mv88e6xxx_config_prio(ds);
- if (ret < 0)
+ if (ret < 0)
return ret;
/*
@@ -136,7 +181,7 @@
* Clear all trunk masks.
*/
for (i = 0; i < 8; i++)
- REG_WRITE(REG_GLOBAL2, 0x07, 0x8000 | (i << 12) | 0xff);
+ REG_WRITE(REG_GLOBAL2, 0x07, 0x8000 | (i << 12) | 0x7ff);
/*
* Clear all trunk mappings.
@@ -159,9 +204,10 @@
/*
* MAC Forcing register: don't force link, speed, duplex
- * or flow control state to any particular values.
+ * or flow control state to any particular values for normal ports.
+ * CPU port is forced link+full+1000Mb
*/
- REG_WRITE(addr, 0x01, 0x0003);
+ REG_WRITE(addr, 0x01, (p == ds->cpu_port) ? 0x003E : 0x0003);
/*
* Port Control: disable Core Tag, disable Drop-on-Lock,
@@ -212,7 +258,7 @@
* addresses.
*/
REG_WRITE(addr, 0x08,
- ((p == ds->cpu_port) ? 0x00c0 : 0x0080) |
+ ((p == ds->cpu_port) ? 0x00c0 : 0x0080) |
ds->cpu_port);
/*
@@ -268,7 +314,7 @@
if (ret < 0)
return ret;
- for (i = 0; i < 6; i++) {
+ for (i = 0; i < 11; i++) {
ret = mv88e6131_setup_port(ds, i);
if (ret < 0)
return ret;
@@ -279,7 +325,7 @@
static int mv88e6131_port_to_phy_addr(int port)
{
- if (port >= 0 && port != 3 && port <= 7)
+ if (port >= 0 && port <= 11)
return port;
return -1;
}