From b5058d7a308035233db18032edc17135cb17ae27 Mon Sep 17 00:00:00 2001 From: Vivien Didelot Date: Mon, 9 May 2016 13:22:38 -0400 Subject: [PATCH] net: dsa: mv88e6xxx: add flags to info Add a flags bitmap to the info structure in order to identify features supported or not by the different switch models. Signed-off-by: Vivien Didelot Signed-off-by: David S. Miller --- drivers/net/dsa/mv88e6123.c | 3 +++ drivers/net/dsa/mv88e6131.c | 4 ++++ drivers/net/dsa/mv88e6171.c | 4 ++++ drivers/net/dsa/mv88e6352.c | 6 ++++++ drivers/net/dsa/mv88e6xxx.h | 21 +++++++++++++++++++++ 5 files changed, 38 insertions(+) diff --git a/drivers/net/dsa/mv88e6123.c b/drivers/net/dsa/mv88e6123.c index 5535a42a6113..ab5885b68a07 100644 --- a/drivers/net/dsa/mv88e6123.c +++ b/drivers/net/dsa/mv88e6123.c @@ -24,18 +24,21 @@ static const struct mv88e6xxx_info mv88e6123_table[] = { .name = "Marvell 88E6123", .num_databases = 4096, .num_ports = 3, + .flags = MV88E6XXX_FLAGS_FAMILY_6165, }, { .prod_num = PORT_SWITCH_ID_PROD_NUM_6161, .family = MV88E6XXX_FAMILY_6165, .name = "Marvell 88E6161", .num_databases = 4096, .num_ports = 6, + .flags = MV88E6XXX_FLAGS_FAMILY_6165, }, { .prod_num = PORT_SWITCH_ID_PROD_NUM_6165, .family = MV88E6XXX_FAMILY_6165, .name = "Marvell 88E6165", .num_databases = 4096, .num_ports = 6, + .flags = MV88E6XXX_FLAGS_FAMILY_6165, } }; diff --git a/drivers/net/dsa/mv88e6131.c b/drivers/net/dsa/mv88e6131.c index 357ab794d720..d4773204935b 100644 --- a/drivers/net/dsa/mv88e6131.c +++ b/drivers/net/dsa/mv88e6131.c @@ -24,24 +24,28 @@ static const struct mv88e6xxx_info mv88e6131_table[] = { .name = "Marvell 88E6095/88E6095F", .num_databases = 256, .num_ports = 11, + .flags = MV88E6XXX_FLAGS_FAMILY_6095, }, { .prod_num = PORT_SWITCH_ID_PROD_NUM_6085, .family = MV88E6XXX_FAMILY_6097, .name = "Marvell 88E6085", .num_databases = 4096, .num_ports = 10, + .flags = MV88E6XXX_FLAGS_FAMILY_6097, }, { .prod_num = PORT_SWITCH_ID_PROD_NUM_6131, .family = MV88E6XXX_FAMILY_6185, .name = "Marvell 88E6131", .num_databases = 256, .num_ports = 8, + .flags = MV88E6XXX_FLAGS_FAMILY_6185, }, { .prod_num = PORT_SWITCH_ID_PROD_NUM_6185, .family = MV88E6XXX_FAMILY_6185, .name = "Marvell 88E6185", .num_databases = 256, .num_ports = 10, + .flags = MV88E6XXX_FLAGS_FAMILY_6185, } }; diff --git a/drivers/net/dsa/mv88e6171.c b/drivers/net/dsa/mv88e6171.c index f75164dc3bd6..e64cbeed2cdf 100644 --- a/drivers/net/dsa/mv88e6171.c +++ b/drivers/net/dsa/mv88e6171.c @@ -24,24 +24,28 @@ static const struct mv88e6xxx_info mv88e6171_table[] = { .name = "Marvell 88E6171", .num_databases = 4096, .num_ports = 7, + .flags = MV88E6XXX_FLAGS_FAMILY_6351, }, { .prod_num = PORT_SWITCH_ID_PROD_NUM_6175, .family = MV88E6XXX_FAMILY_6351, .name = "Marvell 88E6175", .num_databases = 4096, .num_ports = 7, + .flags = MV88E6XXX_FLAGS_FAMILY_6351, }, { .prod_num = PORT_SWITCH_ID_PROD_NUM_6350, .family = MV88E6XXX_FAMILY_6351, .name = "Marvell 88E6350", .num_databases = 4096, .num_ports = 7, + .flags = MV88E6XXX_FLAGS_FAMILY_6351, }, { .prod_num = PORT_SWITCH_ID_PROD_NUM_6351, .family = MV88E6XXX_FAMILY_6351, .name = "Marvell 88E6351", .num_databases = 4096, .num_ports = 7, + .flags = MV88E6XXX_FLAGS_FAMILY_6351, } }; diff --git a/drivers/net/dsa/mv88e6352.c b/drivers/net/dsa/mv88e6352.c index c622a1d58480..c61f0f4da6f4 100644 --- a/drivers/net/dsa/mv88e6352.c +++ b/drivers/net/dsa/mv88e6352.c @@ -29,36 +29,42 @@ static const struct mv88e6xxx_info mv88e6352_table[] = { .name = "Marvell 88E6320", .num_databases = 4096, .num_ports = 7, + .flags = MV88E6XXX_FLAGS_FAMILY_6320, }, { .prod_num = PORT_SWITCH_ID_PROD_NUM_6321, .family = MV88E6XXX_FAMILY_6320, .name = "Marvell 88E6321", .num_databases = 4096, .num_ports = 7, + .flags = MV88E6XXX_FLAGS_FAMILY_6320, }, { .prod_num = PORT_SWITCH_ID_PROD_NUM_6172, .family = MV88E6XXX_FAMILY_6352, .name = "Marvell 88E6172", .num_databases = 4096, .num_ports = 7, + .flags = MV88E6XXX_FLAGS_FAMILY_6352, }, { .prod_num = PORT_SWITCH_ID_PROD_NUM_6176, .family = MV88E6XXX_FAMILY_6352, .name = "Marvell 88E6176", .num_databases = 4096, .num_ports = 7, + .flags = MV88E6XXX_FLAGS_FAMILY_6352, }, { .prod_num = PORT_SWITCH_ID_PROD_NUM_6240, .family = MV88E6XXX_FAMILY_6352, .name = "Marvell 88E6240", .num_databases = 4096, .num_ports = 7, + .flags = MV88E6XXX_FLAGS_FAMILY_6352, }, { .prod_num = PORT_SWITCH_ID_PROD_NUM_6352, .family = MV88E6XXX_FAMILY_6352, .name = "Marvell 88E6352", .num_databases = 4096, .num_ports = 7, + .flags = MV88E6XXX_FLAGS_FAMILY_6352, } }; diff --git a/drivers/net/dsa/mv88e6xxx.h b/drivers/net/dsa/mv88e6xxx.h index 4f455d219859..c67b72af9af1 100644 --- a/drivers/net/dsa/mv88e6xxx.h +++ b/drivers/net/dsa/mv88e6xxx.h @@ -350,12 +350,27 @@ enum mv88e6xxx_family { MV88E6XXX_FAMILY_6352, /* 6172 6176 6240 6352 */ }; +#define MV88E6XXX_FLAGS_FAMILY_6095 0 + +#define MV88E6XXX_FLAGS_FAMILY_6097 0 + +#define MV88E6XXX_FLAGS_FAMILY_6165 0 + +#define MV88E6XXX_FLAGS_FAMILY_6185 0 + +#define MV88E6XXX_FLAGS_FAMILY_6320 0 + +#define MV88E6XXX_FLAGS_FAMILY_6351 0 + +#define MV88E6XXX_FLAGS_FAMILY_6352 0 + struct mv88e6xxx_info { enum mv88e6xxx_family family; u16 prod_num; const char *name; unsigned int num_databases; unsigned int num_ports; + unsigned long flags; }; struct mv88e6xxx_atu_entry { @@ -449,6 +464,12 @@ struct mv88e6xxx_hw_stat { enum stat_type type; }; +static inline bool mv88e6xxx_has(struct mv88e6xxx_priv_state *ps, + unsigned long flags) +{ + return (ps->info->flags & flags) == flags; +} + int mv88e6xxx_switch_reset(struct mv88e6xxx_priv_state *ps, bool ppu_active); const char *mv88e6xxx_drv_probe(struct device *dsa_dev, struct device *host_dev, int sw_addr, void **priv, -- 2.11.0