(addr[4] << 8) | addr[5]);
}
+static int mv88e6xxx_g1_set_age_time(struct mv88e6xxx_chip *chip,
+ unsigned int msecs)
+{
+ const unsigned int coeff = chip->info->age_time_coeff;
+ const unsigned int min = 0x01 * coeff;
+ const unsigned int max = 0xff * coeff;
+ u8 age_time;
+ u16 val;
+ int err;
+
+ if (msecs < min || msecs > max)
+ return -ERANGE;
+
+ /* Round to nearest multiple of coeff */
+ age_time = (msecs + coeff / 2) / coeff;
+
+ err = mv88e6xxx_read(chip, REG_GLOBAL, GLOBAL_ATU_CONTROL, &val);
+ if (err)
+ return err;
+
+ /* AgeTime is 11:4 bits */
+ val &= ~0xff0;
+ val |= age_time << 4;
+
+ return mv88e6xxx_write(chip, REG_GLOBAL, GLOBAL_ATU_CONTROL, val);
+}
+
static int mv88e6xxx_g1_setup(struct mv88e6xxx_chip *chip)
{
struct dsa_switch *ds = chip->ds;
if (err)
return err;
+ /* Clear all the VTU and STU entries */
+ err = _mv88e6xxx_vtu_stu_flush(chip);
+ if (err < 0)
+ return err;
+
/* Set the default address aging time to 5 minutes, and
* enable address learn messages to be sent to all message
* ports.
*/
- err = _mv88e6xxx_reg_write(chip, REG_GLOBAL, GLOBAL_ATU_CONTROL,
- 0x0140 | GLOBAL_ATU_CONTROL_LEARN2ALL);
+ err = mv88e6xxx_write(chip, REG_GLOBAL, GLOBAL_ATU_CONTROL,
+ GLOBAL_ATU_CONTROL_LEARN2ALL);
if (err)
return err;
- /* Clear all the VTU and STU entries */
- err = _mv88e6xxx_vtu_stu_flush(chip);
- if (err < 0)
+ err = mv88e6xxx_g1_set_age_time(chip, 300000);
+ if (err)
return err;
/* Clear all ATU entries */
.num_databases = 4096,
.num_ports = 10,
.port_base_addr = 0x10,
+ .age_time_coeff = 15000,
.flags = MV88E6XXX_FLAGS_FAMILY_6097,
},
.num_databases = 256,
.num_ports = 11,
.port_base_addr = 0x10,
+ .age_time_coeff = 15000,
.flags = MV88E6XXX_FLAGS_FAMILY_6095,
},
.num_databases = 4096,
.num_ports = 3,
.port_base_addr = 0x10,
+ .age_time_coeff = 15000,
.flags = MV88E6XXX_FLAGS_FAMILY_6165,
},
.num_databases = 256,
.num_ports = 8,
.port_base_addr = 0x10,
+ .age_time_coeff = 15000,
.flags = MV88E6XXX_FLAGS_FAMILY_6185,
},
.num_databases = 4096,
.num_ports = 6,
.port_base_addr = 0x10,
+ .age_time_coeff = 15000,
.flags = MV88E6XXX_FLAGS_FAMILY_6165,
},
.num_databases = 4096,
.num_ports = 6,
.port_base_addr = 0x10,
+ .age_time_coeff = 15000,
.flags = MV88E6XXX_FLAGS_FAMILY_6165,
},
.num_databases = 4096,
.num_ports = 7,
.port_base_addr = 0x10,
+ .age_time_coeff = 15000,
.flags = MV88E6XXX_FLAGS_FAMILY_6351,
},
.num_databases = 4096,
.num_ports = 7,
.port_base_addr = 0x10,
+ .age_time_coeff = 15000,
.flags = MV88E6XXX_FLAGS_FAMILY_6352,
},
.num_databases = 4096,
.num_ports = 7,
.port_base_addr = 0x10,
+ .age_time_coeff = 15000,
.flags = MV88E6XXX_FLAGS_FAMILY_6351,
},
.num_databases = 4096,
.num_ports = 7,
.port_base_addr = 0x10,
+ .age_time_coeff = 15000,
.flags = MV88E6XXX_FLAGS_FAMILY_6352,
},
.num_databases = 256,
.num_ports = 10,
.port_base_addr = 0x10,
+ .age_time_coeff = 15000,
.flags = MV88E6XXX_FLAGS_FAMILY_6185,
},
.num_databases = 4096,
.num_ports = 7,
.port_base_addr = 0x10,
+ .age_time_coeff = 15000,
.flags = MV88E6XXX_FLAGS_FAMILY_6352,
},
.num_databases = 4096,
.num_ports = 7,
.port_base_addr = 0x10,
+ .age_time_coeff = 15000,
.flags = MV88E6XXX_FLAGS_FAMILY_6320,
},
.num_databases = 4096,
.num_ports = 7,
.port_base_addr = 0x10,
+ .age_time_coeff = 15000,
.flags = MV88E6XXX_FLAGS_FAMILY_6320,
},
.num_databases = 4096,
.num_ports = 7,
.port_base_addr = 0x10,
+ .age_time_coeff = 15000,
.flags = MV88E6XXX_FLAGS_FAMILY_6351,
},
.num_databases = 4096,
.num_ports = 7,
.port_base_addr = 0x10,
+ .age_time_coeff = 15000,
.flags = MV88E6XXX_FLAGS_FAMILY_6351,
},
.num_databases = 4096,
.num_ports = 7,
.port_base_addr = 0x10,
+ .age_time_coeff = 15000,
.flags = MV88E6XXX_FLAGS_FAMILY_6352,
},
};