|
@@ -995,14 +995,6 @@ static void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds, int port,
|
|
|
|
|
|
}
|
|
|
|
|
|
-static int mv88e6xxx_stats_set_histogram(struct mv88e6xxx_chip *chip)
|
|
|
-{
|
|
|
- if (chip->info->ops->stats_set_histogram)
|
|
|
- return chip->info->ops->stats_set_histogram(chip);
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
static int mv88e6xxx_get_regs_len(struct dsa_switch *ds, int port)
|
|
|
{
|
|
|
return 32 * sizeof(u16);
|
|
@@ -1104,6 +1096,25 @@ static void mv88e6xxx_port_stp_state_set(struct dsa_switch *ds, int port,
|
|
|
dev_err(ds->dev, "p%d: failed to update state\n", port);
|
|
|
}
|
|
|
|
|
|
+static int mv88e6xxx_pri_setup(struct mv88e6xxx_chip *chip)
|
|
|
+{
|
|
|
+ int err;
|
|
|
+
|
|
|
+ if (chip->info->ops->ieee_pri_map) {
|
|
|
+ err = chip->info->ops->ieee_pri_map(chip);
|
|
|
+ if (err)
|
|
|
+ return err;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (chip->info->ops->ip_pri_map) {
|
|
|
+ err = chip->info->ops->ip_pri_map(chip);
|
|
|
+ if (err)
|
|
|
+ return err;
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
static int mv88e6xxx_devmap_setup(struct mv88e6xxx_chip *chip)
|
|
|
{
|
|
|
int target, port;
|
|
@@ -2248,45 +2259,16 @@ static int mv88e6xxx_set_ageing_time(struct dsa_switch *ds,
|
|
|
return err;
|
|
|
}
|
|
|
|
|
|
-static int mv88e6xxx_g1_setup(struct mv88e6xxx_chip *chip)
|
|
|
+static int mv88e6xxx_stats_setup(struct mv88e6xxx_chip *chip)
|
|
|
{
|
|
|
int err;
|
|
|
|
|
|
- /* Configure the IP ToS mapping registers. */
|
|
|
- err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_0, 0x0000);
|
|
|
- if (err)
|
|
|
- return err;
|
|
|
- err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_1, 0x0000);
|
|
|
- if (err)
|
|
|
- return err;
|
|
|
- err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_2, 0x5555);
|
|
|
- if (err)
|
|
|
- return err;
|
|
|
- err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_3, 0x5555);
|
|
|
- if (err)
|
|
|
- return err;
|
|
|
- err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_4, 0xaaaa);
|
|
|
- if (err)
|
|
|
- return err;
|
|
|
- err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_5, 0xaaaa);
|
|
|
- if (err)
|
|
|
- return err;
|
|
|
- err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_6, 0xffff);
|
|
|
- if (err)
|
|
|
- return err;
|
|
|
- err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_7, 0xffff);
|
|
|
- if (err)
|
|
|
- return err;
|
|
|
-
|
|
|
- /* Configure the IEEE 802.1p priority mapping register. */
|
|
|
- err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IEEE_PRI, 0xfa41);
|
|
|
- if (err)
|
|
|
- return err;
|
|
|
-
|
|
|
/* Initialize the statistics unit */
|
|
|
- err = mv88e6xxx_stats_set_histogram(chip);
|
|
|
- if (err)
|
|
|
- return err;
|
|
|
+ if (chip->info->ops->stats_set_histogram) {
|
|
|
+ err = chip->info->ops->stats_set_histogram(chip);
|
|
|
+ if (err)
|
|
|
+ return err;
|
|
|
+ }
|
|
|
|
|
|
return mv88e6xxx_g1_stats_clear(chip);
|
|
|
}
|
|
@@ -2312,11 +2294,6 @@ static int mv88e6xxx_setup(struct dsa_switch *ds)
|
|
|
goto unlock;
|
|
|
}
|
|
|
|
|
|
- /* Setup Switch Global 1 Registers */
|
|
|
- err = mv88e6xxx_g1_setup(chip);
|
|
|
- if (err)
|
|
|
- goto unlock;
|
|
|
-
|
|
|
err = mv88e6xxx_irl_setup(chip);
|
|
|
if (err)
|
|
|
goto unlock;
|
|
@@ -2365,6 +2342,10 @@ static int mv88e6xxx_setup(struct dsa_switch *ds)
|
|
|
if (err)
|
|
|
goto unlock;
|
|
|
|
|
|
+ err = mv88e6xxx_pri_setup(chip);
|
|
|
+ if (err)
|
|
|
+ goto unlock;
|
|
|
+
|
|
|
/* Setup PTP Hardware Clock and timestamping */
|
|
|
if (chip->info->ptp_support) {
|
|
|
err = mv88e6xxx_ptp_setup(chip);
|
|
@@ -2376,6 +2357,10 @@ static int mv88e6xxx_setup(struct dsa_switch *ds)
|
|
|
goto unlock;
|
|
|
}
|
|
|
|
|
|
+ err = mv88e6xxx_stats_setup(chip);
|
|
|
+ if (err)
|
|
|
+ goto unlock;
|
|
|
+
|
|
|
unlock:
|
|
|
mutex_unlock(&chip->reg_lock);
|
|
|
|
|
@@ -2592,6 +2577,8 @@ static int mv88e6xxx_set_eeprom(struct dsa_switch *ds,
|
|
|
|
|
|
static const struct mv88e6xxx_ops mv88e6085_ops = {
|
|
|
/* MV88E6XXX_FAMILY_6097 */
|
|
|
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
|
|
|
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
|
|
|
.irl_init_all = mv88e6352_g2_irl_init_all,
|
|
|
.set_switch_mac = mv88e6xxx_g1_set_switch_mac,
|
|
|
.phy_read = mv88e6185_phy_ppu_read,
|
|
@@ -2628,6 +2615,8 @@ static const struct mv88e6xxx_ops mv88e6085_ops = {
|
|
|
|
|
|
static const struct mv88e6xxx_ops mv88e6095_ops = {
|
|
|
/* MV88E6XXX_FAMILY_6095 */
|
|
|
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
|
|
|
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
|
|
|
.set_switch_mac = mv88e6xxx_g1_set_switch_mac,
|
|
|
.phy_read = mv88e6185_phy_ppu_read,
|
|
|
.phy_write = mv88e6185_phy_ppu_write,
|
|
@@ -2652,6 +2641,8 @@ static const struct mv88e6xxx_ops mv88e6095_ops = {
|
|
|
|
|
|
static const struct mv88e6xxx_ops mv88e6097_ops = {
|
|
|
/* MV88E6XXX_FAMILY_6097 */
|
|
|
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
|
|
|
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
|
|
|
.irl_init_all = mv88e6352_g2_irl_init_all,
|
|
|
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
|
|
|
.phy_read = mv88e6xxx_g2_smi_phy_read,
|
|
@@ -2686,6 +2677,8 @@ static const struct mv88e6xxx_ops mv88e6097_ops = {
|
|
|
|
|
|
static const struct mv88e6xxx_ops mv88e6123_ops = {
|
|
|
/* MV88E6XXX_FAMILY_6165 */
|
|
|
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
|
|
|
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
|
|
|
.irl_init_all = mv88e6352_g2_irl_init_all,
|
|
|
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
|
|
|
.phy_read = mv88e6xxx_g2_smi_phy_read,
|
|
@@ -2714,6 +2707,8 @@ static const struct mv88e6xxx_ops mv88e6123_ops = {
|
|
|
|
|
|
static const struct mv88e6xxx_ops mv88e6131_ops = {
|
|
|
/* MV88E6XXX_FAMILY_6185 */
|
|
|
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
|
|
|
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
|
|
|
.set_switch_mac = mv88e6xxx_g1_set_switch_mac,
|
|
|
.phy_read = mv88e6185_phy_ppu_read,
|
|
|
.phy_write = mv88e6185_phy_ppu_write,
|
|
@@ -2747,6 +2742,8 @@ static const struct mv88e6xxx_ops mv88e6131_ops = {
|
|
|
|
|
|
static const struct mv88e6xxx_ops mv88e6141_ops = {
|
|
|
/* MV88E6XXX_FAMILY_6341 */
|
|
|
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
|
|
|
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
|
|
|
.irl_init_all = mv88e6352_g2_irl_init_all,
|
|
|
.get_eeprom = mv88e6xxx_g2_get_eeprom8,
|
|
|
.set_eeprom = mv88e6xxx_g2_set_eeprom8,
|
|
@@ -2784,6 +2781,8 @@ static const struct mv88e6xxx_ops mv88e6141_ops = {
|
|
|
|
|
|
static const struct mv88e6xxx_ops mv88e6161_ops = {
|
|
|
/* MV88E6XXX_FAMILY_6165 */
|
|
|
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
|
|
|
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
|
|
|
.irl_init_all = mv88e6352_g2_irl_init_all,
|
|
|
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
|
|
|
.phy_read = mv88e6xxx_g2_smi_phy_read,
|
|
@@ -2817,6 +2816,8 @@ static const struct mv88e6xxx_ops mv88e6161_ops = {
|
|
|
|
|
|
static const struct mv88e6xxx_ops mv88e6165_ops = {
|
|
|
/* MV88E6XXX_FAMILY_6165 */
|
|
|
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
|
|
|
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
|
|
|
.irl_init_all = mv88e6352_g2_irl_init_all,
|
|
|
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
|
|
|
.phy_read = mv88e6165_phy_read,
|
|
@@ -2843,6 +2844,8 @@ static const struct mv88e6xxx_ops mv88e6165_ops = {
|
|
|
|
|
|
static const struct mv88e6xxx_ops mv88e6171_ops = {
|
|
|
/* MV88E6XXX_FAMILY_6351 */
|
|
|
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
|
|
|
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
|
|
|
.irl_init_all = mv88e6352_g2_irl_init_all,
|
|
|
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
|
|
|
.phy_read = mv88e6xxx_g2_smi_phy_read,
|
|
@@ -2877,6 +2880,8 @@ static const struct mv88e6xxx_ops mv88e6171_ops = {
|
|
|
|
|
|
static const struct mv88e6xxx_ops mv88e6172_ops = {
|
|
|
/* MV88E6XXX_FAMILY_6352 */
|
|
|
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
|
|
|
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
|
|
|
.irl_init_all = mv88e6352_g2_irl_init_all,
|
|
|
.get_eeprom = mv88e6xxx_g2_get_eeprom16,
|
|
|
.set_eeprom = mv88e6xxx_g2_set_eeprom16,
|
|
@@ -2916,6 +2921,8 @@ static const struct mv88e6xxx_ops mv88e6172_ops = {
|
|
|
|
|
|
static const struct mv88e6xxx_ops mv88e6175_ops = {
|
|
|
/* MV88E6XXX_FAMILY_6351 */
|
|
|
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
|
|
|
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
|
|
|
.irl_init_all = mv88e6352_g2_irl_init_all,
|
|
|
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
|
|
|
.phy_read = mv88e6xxx_g2_smi_phy_read,
|
|
@@ -2951,6 +2958,8 @@ static const struct mv88e6xxx_ops mv88e6175_ops = {
|
|
|
|
|
|
static const struct mv88e6xxx_ops mv88e6176_ops = {
|
|
|
/* MV88E6XXX_FAMILY_6352 */
|
|
|
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
|
|
|
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
|
|
|
.irl_init_all = mv88e6352_g2_irl_init_all,
|
|
|
.get_eeprom = mv88e6xxx_g2_get_eeprom16,
|
|
|
.set_eeprom = mv88e6xxx_g2_set_eeprom16,
|
|
@@ -2990,6 +2999,8 @@ static const struct mv88e6xxx_ops mv88e6176_ops = {
|
|
|
|
|
|
static const struct mv88e6xxx_ops mv88e6185_ops = {
|
|
|
/* MV88E6XXX_FAMILY_6185 */
|
|
|
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
|
|
|
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
|
|
|
.set_switch_mac = mv88e6xxx_g1_set_switch_mac,
|
|
|
.phy_read = mv88e6185_phy_ppu_read,
|
|
|
.phy_write = mv88e6185_phy_ppu_write,
|
|
@@ -3129,6 +3140,8 @@ static const struct mv88e6xxx_ops mv88e6191_ops = {
|
|
|
|
|
|
static const struct mv88e6xxx_ops mv88e6240_ops = {
|
|
|
/* MV88E6XXX_FAMILY_6352 */
|
|
|
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
|
|
|
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
|
|
|
.irl_init_all = mv88e6352_g2_irl_init_all,
|
|
|
.get_eeprom = mv88e6xxx_g2_get_eeprom16,
|
|
|
.set_eeprom = mv88e6xxx_g2_set_eeprom16,
|
|
@@ -3208,6 +3221,8 @@ static const struct mv88e6xxx_ops mv88e6290_ops = {
|
|
|
|
|
|
static const struct mv88e6xxx_ops mv88e6320_ops = {
|
|
|
/* MV88E6XXX_FAMILY_6320 */
|
|
|
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
|
|
|
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
|
|
|
.irl_init_all = mv88e6352_g2_irl_init_all,
|
|
|
.get_eeprom = mv88e6xxx_g2_get_eeprom16,
|
|
|
.set_eeprom = mv88e6xxx_g2_set_eeprom16,
|
|
@@ -3244,6 +3259,8 @@ static const struct mv88e6xxx_ops mv88e6320_ops = {
|
|
|
|
|
|
static const struct mv88e6xxx_ops mv88e6321_ops = {
|
|
|
/* MV88E6XXX_FAMILY_6320 */
|
|
|
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
|
|
|
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
|
|
|
.irl_init_all = mv88e6352_g2_irl_init_all,
|
|
|
.get_eeprom = mv88e6xxx_g2_get_eeprom16,
|
|
|
.set_eeprom = mv88e6xxx_g2_set_eeprom16,
|
|
@@ -3278,6 +3295,8 @@ static const struct mv88e6xxx_ops mv88e6321_ops = {
|
|
|
|
|
|
static const struct mv88e6xxx_ops mv88e6341_ops = {
|
|
|
/* MV88E6XXX_FAMILY_6341 */
|
|
|
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
|
|
|
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
|
|
|
.irl_init_all = mv88e6352_g2_irl_init_all,
|
|
|
.get_eeprom = mv88e6xxx_g2_get_eeprom8,
|
|
|
.set_eeprom = mv88e6xxx_g2_set_eeprom8,
|
|
@@ -3316,6 +3335,8 @@ static const struct mv88e6xxx_ops mv88e6341_ops = {
|
|
|
|
|
|
static const struct mv88e6xxx_ops mv88e6350_ops = {
|
|
|
/* MV88E6XXX_FAMILY_6351 */
|
|
|
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
|
|
|
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
|
|
|
.irl_init_all = mv88e6352_g2_irl_init_all,
|
|
|
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
|
|
|
.phy_read = mv88e6xxx_g2_smi_phy_read,
|
|
@@ -3350,6 +3371,8 @@ static const struct mv88e6xxx_ops mv88e6350_ops = {
|
|
|
|
|
|
static const struct mv88e6xxx_ops mv88e6351_ops = {
|
|
|
/* MV88E6XXX_FAMILY_6351 */
|
|
|
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
|
|
|
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
|
|
|
.irl_init_all = mv88e6352_g2_irl_init_all,
|
|
|
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
|
|
|
.phy_read = mv88e6xxx_g2_smi_phy_read,
|
|
@@ -3385,6 +3408,8 @@ static const struct mv88e6xxx_ops mv88e6351_ops = {
|
|
|
|
|
|
static const struct mv88e6xxx_ops mv88e6352_ops = {
|
|
|
/* MV88E6XXX_FAMILY_6352 */
|
|
|
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
|
|
|
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
|
|
|
.irl_init_all = mv88e6352_g2_irl_init_all,
|
|
|
.get_eeprom = mv88e6xxx_g2_get_eeprom16,
|
|
|
.set_eeprom = mv88e6xxx_g2_set_eeprom16,
|