Commit 2bbb33be authored by Andrew Lunn's avatar Andrew Lunn Committed by David S. Miller

net: dsa: mv88e6xxx: Fix support for DSA tagging for older switches.

Older chips only support DSA tagging on the CPU port. New devices
support both DSA and EDSA. The driver needs to tell the core the tag
protocol to use, and configure the switch for what is available.
Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7b314362
...@@ -2,6 +2,7 @@ config NET_DSA_MV88E6XXX ...@@ -2,6 +2,7 @@ config NET_DSA_MV88E6XXX
tristate "Marvell 88E6xxx Ethernet switch fabric support" tristate "Marvell 88E6xxx Ethernet switch fabric support"
depends on NET_DSA depends on NET_DSA
select NET_DSA_TAG_EDSA select NET_DSA_TAG_EDSA
select NET_DSA_TAG_DSA
help help
This driver adds support for most of the Marvell 88E6xxx models of This driver adds support for most of the Marvell 88E6xxx models of
Ethernet switch chips, except 88E6060. Ethernet switch chips, except 88E6060.
...@@ -2483,29 +2483,14 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port) ...@@ -2483,29 +2483,14 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)
PORT_CONTROL_USE_TAG | PORT_CONTROL_USE_IP | PORT_CONTROL_USE_TAG | PORT_CONTROL_USE_IP |
PORT_CONTROL_STATE_FORWARDING; PORT_CONTROL_STATE_FORWARDING;
if (dsa_is_cpu_port(ds, port)) { if (dsa_is_cpu_port(ds, port)) {
if (mv88e6xxx_6095_family(chip) || mv88e6xxx_6185_family(chip)) if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_EDSA))
reg |= PORT_CONTROL_DSA_TAG;
if (mv88e6xxx_6352_family(chip) ||
mv88e6xxx_6351_family(chip) ||
mv88e6xxx_6165_family(chip) ||
mv88e6xxx_6097_family(chip) ||
mv88e6xxx_6320_family(chip)) {
reg |= PORT_CONTROL_FRAME_ETHER_TYPE_DSA | reg |= PORT_CONTROL_FRAME_ETHER_TYPE_DSA |
PORT_CONTROL_FORWARD_UNKNOWN | PORT_CONTROL_FORWARD_UNKNOWN |
PORT_CONTROL_FORWARD_UNKNOWN_MC; PORT_CONTROL_FORWARD_UNKNOWN_MC;
} else
reg |= PORT_CONTROL_DSA_TAG;
if (mv88e6xxx_6352_family(chip) ||
mv88e6xxx_6351_family(chip) ||
mv88e6xxx_6165_family(chip) ||
mv88e6xxx_6097_family(chip) ||
mv88e6xxx_6095_family(chip) ||
mv88e6xxx_6065_family(chip) ||
mv88e6xxx_6185_family(chip) ||
mv88e6xxx_6320_family(chip)) {
reg |= PORT_CONTROL_EGRESS_ADD_TAG; reg |= PORT_CONTROL_EGRESS_ADD_TAG;
} }
}
if (dsa_is_dsa_port(ds, port)) { if (dsa_is_dsa_port(ds, port)) {
if (mv88e6xxx_6095_family(chip) || if (mv88e6xxx_6095_family(chip) ||
mv88e6xxx_6185_family(chip)) mv88e6xxx_6185_family(chip))
...@@ -2632,10 +2617,13 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port) ...@@ -2632,10 +2617,13 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)
/* Port Ethertype: use the Ethertype DSA Ethertype /* Port Ethertype: use the Ethertype DSA Ethertype
* value. * value.
*/ */
if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_EDSA)) {
ret = _mv88e6xxx_reg_write(chip, REG_PORT(port), ret = _mv88e6xxx_reg_write(chip, REG_PORT(port),
PORT_ETH_TYPE, ETH_P_EDSA); PORT_ETH_TYPE, ETH_P_EDSA);
if (ret) if (ret)
return ret; return ret;
}
/* Tag Remap: use an identity 802.1p prio -> switch /* Tag Remap: use an identity 802.1p prio -> switch
* prio mapping. * prio mapping.
*/ */
...@@ -3926,7 +3914,12 @@ static int mv88e6xxx_smi_init(struct mv88e6xxx_chip *chip, ...@@ -3926,7 +3914,12 @@ static int mv88e6xxx_smi_init(struct mv88e6xxx_chip *chip,
static enum dsa_tag_protocol mv88e6xxx_get_tag_protocol(struct dsa_switch *ds) static enum dsa_tag_protocol mv88e6xxx_get_tag_protocol(struct dsa_switch *ds)
{ {
struct mv88e6xxx_chip *chip = ds_to_priv(ds);
if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_EDSA))
return DSA_TAG_PROTO_EDSA; return DSA_TAG_PROTO_EDSA;
return DSA_TAG_PROTO_DSA;
} }
static const char *mv88e6xxx_drv_probe(struct device *dsa_dev, static const char *mv88e6xxx_drv_probe(struct device *dsa_dev,
......
...@@ -386,6 +386,12 @@ enum mv88e6xxx_family { ...@@ -386,6 +386,12 @@ enum mv88e6xxx_family {
}; };
enum mv88e6xxx_cap { enum mv88e6xxx_cap {
/* Two different tag protocols can be used by the driver. All
* switches support DSA, but only later generations support
* EDSA.
*/
MV88E6XXX_CAP_EDSA,
/* Energy Efficient Ethernet. /* Energy Efficient Ethernet.
*/ */
MV88E6XXX_CAP_EEE, MV88E6XXX_CAP_EEE,
...@@ -447,6 +453,7 @@ enum mv88e6xxx_cap { ...@@ -447,6 +453,7 @@ enum mv88e6xxx_cap {
}; };
/* Bitmask of capabilities */ /* Bitmask of capabilities */
#define MV88E6XXX_FLAG_EDSA BIT(MV88E6XXX_CAP_EDSA)
#define MV88E6XXX_FLAG_EEE BIT(MV88E6XXX_CAP_EEE) #define MV88E6XXX_FLAG_EEE BIT(MV88E6XXX_CAP_EEE)
#define MV88E6XXX_FLAG_SMI_CMD BIT(MV88E6XXX_CAP_SMI_CMD) #define MV88E6XXX_FLAG_SMI_CMD BIT(MV88E6XXX_CAP_SMI_CMD)
...@@ -547,7 +554,8 @@ enum mv88e6xxx_cap { ...@@ -547,7 +554,8 @@ enum mv88e6xxx_cap {
MV88E6XXX_FLAG_VTU) MV88E6XXX_FLAG_VTU)
#define MV88E6XXX_FLAGS_FAMILY_6320 \ #define MV88E6XXX_FLAGS_FAMILY_6320 \
(MV88E6XXX_FLAG_EEE | \ (MV88E6XXX_FLAG_EDSA | \
MV88E6XXX_FLAG_EEE | \
MV88E6XXX_FLAG_GLOBAL2 | \ MV88E6XXX_FLAG_GLOBAL2 | \
MV88E6XXX_FLAG_G2_MGMT_EN_2X | \ MV88E6XXX_FLAG_G2_MGMT_EN_2X | \
MV88E6XXX_FLAG_G2_MGMT_EN_0X | \ MV88E6XXX_FLAG_G2_MGMT_EN_0X | \
...@@ -564,7 +572,8 @@ enum mv88e6xxx_cap { ...@@ -564,7 +572,8 @@ enum mv88e6xxx_cap {
MV88E6XXX_FLAGS_SMI_PHY) MV88E6XXX_FLAGS_SMI_PHY)
#define MV88E6XXX_FLAGS_FAMILY_6351 \ #define MV88E6XXX_FLAGS_FAMILY_6351 \
(MV88E6XXX_FLAG_GLOBAL2 | \ (MV88E6XXX_FLAG_EDSA | \
MV88E6XXX_FLAG_GLOBAL2 | \
MV88E6XXX_FLAG_G2_MGMT_EN_2X | \ MV88E6XXX_FLAG_G2_MGMT_EN_2X | \
MV88E6XXX_FLAG_G2_MGMT_EN_0X | \ MV88E6XXX_FLAG_G2_MGMT_EN_0X | \
MV88E6XXX_FLAG_G2_SWITCH_MAC | \ MV88E6XXX_FLAG_G2_SWITCH_MAC | \
...@@ -579,7 +588,8 @@ enum mv88e6xxx_cap { ...@@ -579,7 +588,8 @@ enum mv88e6xxx_cap {
MV88E6XXX_FLAGS_SMI_PHY) MV88E6XXX_FLAGS_SMI_PHY)
#define MV88E6XXX_FLAGS_FAMILY_6352 \ #define MV88E6XXX_FLAGS_FAMILY_6352 \
(MV88E6XXX_FLAG_EEE | \ (MV88E6XXX_FLAG_EDSA | \
MV88E6XXX_FLAG_EEE | \
MV88E6XXX_FLAG_GLOBAL2 | \ MV88E6XXX_FLAG_GLOBAL2 | \
MV88E6XXX_FLAG_G2_MGMT_EN_2X | \ MV88E6XXX_FLAG_G2_MGMT_EN_2X | \
MV88E6XXX_FLAG_G2_MGMT_EN_0X | \ MV88E6XXX_FLAG_G2_MGMT_EN_0X | \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment