net: dsa: mv88e6xxx: add number of db to info
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>
Sun, 17 Apr 2016 17:24:02 +0000 (13:24 -0400)
committerDavid S. Miller <davem@davemloft.net>
Sun, 17 Apr 2016 22:54:15 +0000 (18:54 -0400)
Add the number of databases to the info structure.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/mv88e6123.c
drivers/net/dsa/mv88e6131.c
drivers/net/dsa/mv88e6171.c
drivers/net/dsa/mv88e6352.c
drivers/net/dsa/mv88e6xxx.c
drivers/net/dsa/mv88e6xxx.h

index 0bf43bb179930bf40498c10c87ec5a2d9899e990..534ebc84de84078c7e3c33ad56edb0260d6f39fe 100644 (file)
@@ -22,16 +22,19 @@ static const struct mv88e6xxx_info mv88e6123_table[] = {
                .prod_num = PORT_SWITCH_ID_PROD_NUM_6123,
                .family = MV88E6XXX_FAMILY_6165,
                .name = "Marvell 88E6123",
+               .num_databases = 4096,
                .num_ports = 3,
        }, {
                .prod_num = PORT_SWITCH_ID_PROD_NUM_6161,
                .family = MV88E6XXX_FAMILY_6165,
                .name = "Marvell 88E6161",
+               .num_databases = 4096,
                .num_ports = 6,
        }, {
                .prod_num = PORT_SWITCH_ID_PROD_NUM_6165,
                .family = MV88E6XXX_FAMILY_6165,
                .name = "Marvell 88E6165",
+               .num_databases = 4096,
                .num_ports = 6,
        }
 };
index c01bbb1e857e3c3c0059fb07b4b051727e393924..c3eb9a884cfda7cc03a68d45b888d394ed1b4705 100644 (file)
@@ -22,21 +22,25 @@ static const struct mv88e6xxx_info mv88e6131_table[] = {
                .prod_num = PORT_SWITCH_ID_PROD_NUM_6095,
                .family = MV88E6XXX_FAMILY_6095,
                .name = "Marvell 88E6095/88E6095F",
+               .num_databases = 256,
                .num_ports = 11,
        }, {
                .prod_num = PORT_SWITCH_ID_PROD_NUM_6085,
                .family = MV88E6XXX_FAMILY_6097,
                .name = "Marvell 88E6085",
+               .num_databases = 4096,
                .num_ports = 10,
        }, {
                .prod_num = PORT_SWITCH_ID_PROD_NUM_6131,
                .family = MV88E6XXX_FAMILY_6185,
                .name = "Marvell 88E6131",
+               .num_databases = 256,
                .num_ports = 8,
        }, {
                .prod_num = PORT_SWITCH_ID_PROD_NUM_6185,
                .family = MV88E6XXX_FAMILY_6185,
                .name = "Marvell 88E6185",
+               .num_databases = 256,
                .num_ports = 10,
        }
 };
index 172824fe1dc04da301c4b6a1927ef818600150ba..841ffe14ef7567b76df3403e5989276ff6b68c7b 100644 (file)
@@ -22,21 +22,25 @@ static const struct mv88e6xxx_info mv88e6171_table[] = {
                .prod_num = PORT_SWITCH_ID_PROD_NUM_6171,
                .family = MV88E6XXX_FAMILY_6351,
                .name = "Marvell 88E6171",
+               .num_databases = 4096,
                .num_ports = 7,
        }, {
                .prod_num = PORT_SWITCH_ID_PROD_NUM_6175,
                .family = MV88E6XXX_FAMILY_6351,
                .name = "Marvell 88E6175",
+               .num_databases = 4096,
                .num_ports = 7,
        }, {
                .prod_num = PORT_SWITCH_ID_PROD_NUM_6350,
                .family = MV88E6XXX_FAMILY_6351,
                .name = "Marvell 88E6350",
+               .num_databases = 4096,
                .num_ports = 7,
        }, {
                .prod_num = PORT_SWITCH_ID_PROD_NUM_6351,
                .family = MV88E6XXX_FAMILY_6351,
                .name = "Marvell 88E6351",
+               .num_databases = 4096,
                .num_ports = 7,
        }
 };
index 12b9a7b5cb31b471b22ea7b71a3f1c56a79b1ef1..4afc24df56b85ced1dde5cf31998089b3f471e38 100644 (file)
@@ -27,31 +27,37 @@ static const struct mv88e6xxx_info mv88e6352_table[] = {
                .prod_num = PORT_SWITCH_ID_PROD_NUM_6320,
                .family = MV88E6XXX_FAMILY_6320,
                .name = "Marvell 88E6320",
+               .num_databases = 4096,
                .num_ports = 7,
        }, {
                .prod_num = PORT_SWITCH_ID_PROD_NUM_6321,
                .family = MV88E6XXX_FAMILY_6320,
                .name = "Marvell 88E6321",
+               .num_databases = 4096,
                .num_ports = 7,
        }, {
                .prod_num = PORT_SWITCH_ID_PROD_NUM_6172,
                .family = MV88E6XXX_FAMILY_6352,
                .name = "Marvell 88E6172",
+               .num_databases = 4096,
                .num_ports = 7,
        }, {
                .prod_num = PORT_SWITCH_ID_PROD_NUM_6176,
                .family = MV88E6XXX_FAMILY_6352,
                .name = "Marvell 88E6176",
+               .num_databases = 4096,
                .num_ports = 7,
        }, {
                .prod_num = PORT_SWITCH_ID_PROD_NUM_6240,
                .family = MV88E6XXX_FAMILY_6352,
                .name = "Marvell 88E6240",
+               .num_databases = 4096,
                .num_ports = 7,
        }, {
                .prod_num = PORT_SWITCH_ID_PROD_NUM_6352,
                .family = MV88E6XXX_FAMILY_6352,
                .name = "Marvell 88E6352",
+               .num_databases = 4096,
                .num_ports = 7,
        }
 };
index c952d91a5b887763d116086596a3397b6e4fc3ea..67b1dd1c22f7d89615ac4bee26ca5536d8f9619b 100644 (file)
@@ -458,24 +458,7 @@ static unsigned int mv88e6xxx_num_databases(struct dsa_switch *ds)
 {
        struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
 
-       /* The following devices have 4-bit identifiers for 16 databases */
-       if (ps->id == PORT_SWITCH_ID_6061)
-               return 16;
-
-       /* The following devices have 6-bit identifiers for 64 databases */
-       if (ps->id == PORT_SWITCH_ID_6065)
-               return 64;
-
-       /* The following devices have 8-bit identifiers for 256 databases */
-       if (mv88e6xxx_6095_family(ds) || mv88e6xxx_6185_family(ds))
-               return 256;
-
-       /* The following devices have 12-bit identifiers for 4096 databases */
-       if (mv88e6xxx_6097_family(ds) || mv88e6xxx_6165_family(ds) ||
-           mv88e6xxx_6351_family(ds) || mv88e6xxx_6352_family(ds))
-               return 4096;
-
-       return 0;
+       return ps->info->num_databases;
 }
 
 static bool mv88e6xxx_has_fid_reg(struct dsa_switch *ds)
index 801486aefe781374569f4f4bf690d04c86bfdc10..8eeafff27a82c45bb7f23ad23c888cd6ded97ea5 100644 (file)
@@ -385,6 +385,7 @@ struct mv88e6xxx_info {
        enum mv88e6xxx_family family;
        u16 prod_num;
        const char *name;
+       unsigned int num_databases;
        unsigned int num_ports;
 };