summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/dsa/mv88e6xxx/chip.c57
-rw-r--r--drivers/net/dsa/mv88e6xxx/chip.h2
2 files changed, 59 insertions, 0 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index eca285aaf72f..ea2cf23107f1 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -683,6 +683,50 @@ static void mv88e6xxx_validate(struct dsa_switch *ds, int port,
phylink_helper_basex_speed(state);
}
+static void mv88e6352_phylink_get_interfaces(struct mv88e6xxx_chip *chip,
+ int port,
+ unsigned long *supported)
+{
+ if (mv88e6xxx_serdes_get_lane(chip, port)) {
+ /* FIXME: does code for 6352 family support changing between
+ * SGMII and 1000base-x?
+ */
+ __set_bit(PHY_INTERFACE_MODE_SGMII, supported);
+ __set_bit(PHY_INTERFACE_MODE_1000BASEX, supported);
+ }
+}
+
+static void mv88e6341_phylink_get_interfaces(struct mv88e6xxx_chip *chip,
+ int port,
+ unsigned long *supported)
+{
+ if (port == 5) {
+ __set_bit(PHY_INTERFACE_MODE_SGMII, supported);
+ __set_bit(PHY_INTERFACE_MODE_1000BASEX, supported);
+ __set_bit(PHY_INTERFACE_MODE_2500BASEX, supported);
+ }
+}
+
+static void mv88e6390_phylink_get_interfaces(struct mv88e6xxx_chip *chip,
+ int port,
+ unsigned long *supported)
+{
+ if (port == 9 || port == 10) {
+ __set_bit(PHY_INTERFACE_MODE_SGMII, supported);
+ __set_bit(PHY_INTERFACE_MODE_1000BASEX, supported);
+ __set_bit(PHY_INTERFACE_MODE_2500BASEX, supported);
+ }
+}
+
+static void mv88e6xxx_get_interfaces(struct dsa_switch *ds, int port,
+ unsigned long *supported)
+{
+ struct mv88e6xxx_chip *chip = ds->priv;
+
+ if (chip->info->ops->phylink_get_interfaces)
+ chip->info->ops->phylink_get_interfaces(chip, port, supported);
+}
+
static void mv88e6xxx_mac_config(struct dsa_switch *ds, int port,
unsigned int mode,
const struct phylink_link_state *state)
@@ -3619,6 +3663,7 @@ static const struct mv88e6xxx_ops mv88e6141_ops = {
.serdes_irq_enable = mv88e6390_serdes_irq_enable,
.serdes_irq_status = mv88e6390_serdes_irq_status,
.gpio_ops = &mv88e6352_gpio_ops,
+ .phylink_get_interfaces = mv88e6341_phylink_get_interfaces,
.phylink_validate = mv88e6341_phylink_validate,
};
@@ -3794,6 +3839,7 @@ static const struct mv88e6xxx_ops mv88e6172_ops = {
.serdes_get_regs_len = mv88e6352_serdes_get_regs_len,
.serdes_get_regs = mv88e6352_serdes_get_regs,
.gpio_ops = &mv88e6352_gpio_ops,
+ .phylink_get_interfaces = mv88e6352_phylink_get_interfaces,
.phylink_validate = mv88e6352_phylink_validate,
};
@@ -3894,6 +3940,7 @@ static const struct mv88e6xxx_ops mv88e6176_ops = {
.serdes_get_regs_len = mv88e6352_serdes_get_regs_len,
.serdes_get_regs = mv88e6352_serdes_get_regs,
.gpio_ops = &mv88e6352_gpio_ops,
+ .phylink_get_interfaces = mv88e6352_phylink_get_interfaces,
.phylink_validate = mv88e6352_phylink_validate,
};
@@ -3995,6 +4042,7 @@ static const struct mv88e6xxx_ops mv88e6190_ops = {
.serdes_get_regs_len = mv88e6390_serdes_get_regs_len,
.serdes_get_regs = mv88e6390_serdes_get_regs,
.gpio_ops = &mv88e6352_gpio_ops,
+ .phylink_get_interfaces = mv88e6390_phylink_get_interfaces,
.phylink_validate = mv88e6390_phylink_validate,
};
@@ -4056,6 +4104,7 @@ static const struct mv88e6xxx_ops mv88e6190x_ops = {
.serdes_get_regs_len = mv88e6390_serdes_get_regs_len,
.serdes_get_regs = mv88e6390_serdes_get_regs,
.gpio_ops = &mv88e6352_gpio_ops,
+ .phylink_get_interfaces = mv88e6390_phylink_get_interfaces,
.phylink_validate = mv88e6390x_phylink_validate,
};
@@ -4116,6 +4165,7 @@ static const struct mv88e6xxx_ops mv88e6191_ops = {
.serdes_get_regs = mv88e6390_serdes_get_regs,
.avb_ops = &mv88e6390_avb_ops,
.ptp_ops = &mv88e6352_ptp_ops,
+ .phylink_get_interfaces = mv88e6390_phylink_get_interfaces,
.phylink_validate = mv88e6390_phylink_validate,
};
@@ -4176,6 +4226,7 @@ static const struct mv88e6xxx_ops mv88e6240_ops = {
.gpio_ops = &mv88e6352_gpio_ops,
.avb_ops = &mv88e6352_avb_ops,
.ptp_ops = &mv88e6352_ptp_ops,
+ .phylink_get_interfaces = mv88e6352_phylink_get_interfaces,
.phylink_validate = mv88e6352_phylink_validate,
};
@@ -4278,6 +4329,7 @@ static const struct mv88e6xxx_ops mv88e6290_ops = {
.gpio_ops = &mv88e6352_gpio_ops,
.avb_ops = &mv88e6390_avb_ops,
.ptp_ops = &mv88e6352_ptp_ops,
+ .phylink_get_interfaces = mv88e6390_phylink_get_interfaces,
.phylink_validate = mv88e6390_phylink_validate,
};
@@ -4421,6 +4473,7 @@ static const struct mv88e6xxx_ops mv88e6341_ops = {
.gpio_ops = &mv88e6352_gpio_ops,
.avb_ops = &mv88e6390_avb_ops,
.ptp_ops = &mv88e6352_ptp_ops,
+ .phylink_get_interfaces = mv88e6341_phylink_get_interfaces,
.phylink_validate = mv88e6341_phylink_validate,
};
@@ -4570,6 +4623,7 @@ static const struct mv88e6xxx_ops mv88e6352_ops = {
.serdes_get_stats = mv88e6352_serdes_get_stats,
.serdes_get_regs_len = mv88e6352_serdes_get_regs_len,
.serdes_get_regs = mv88e6352_serdes_get_regs,
+ .phylink_get_interfaces = mv88e6352_phylink_get_interfaces,
.phylink_validate = mv88e6352_phylink_validate,
};
@@ -4635,6 +4689,7 @@ static const struct mv88e6xxx_ops mv88e6390_ops = {
.serdes_get_stats = mv88e6390_serdes_get_stats,
.serdes_get_regs_len = mv88e6390_serdes_get_regs_len,
.serdes_get_regs = mv88e6390_serdes_get_regs,
+ .phylink_get_interfaces = mv88e6390_phylink_get_interfaces,
.phylink_validate = mv88e6390_phylink_validate,
};
@@ -4699,6 +4754,7 @@ static const struct mv88e6xxx_ops mv88e6390x_ops = {
.gpio_ops = &mv88e6352_gpio_ops,
.avb_ops = &mv88e6390_avb_ops,
.ptp_ops = &mv88e6352_ptp_ops,
+ .phylink_get_interfaces = mv88e6390_phylink_get_interfaces,
.phylink_validate = mv88e6390x_phylink_validate,
};
@@ -6054,6 +6110,7 @@ static const struct dsa_switch_ops mv88e6xxx_switch_ops = {
.change_tag_protocol = mv88e6xxx_change_tag_protocol,
.setup = mv88e6xxx_setup,
.teardown = mv88e6xxx_teardown,
+ .phylink_get_interfaces = mv88e6xxx_get_interfaces,
.phylink_validate = mv88e6xxx_validate,
.phylink_mac_link_state = mv88e6xxx_serdes_pcs_get_state,
.phylink_mac_config = mv88e6xxx_mac_config,
diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h
index 675b1f3e43b7..601c995cf4c7 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.h
+++ b/drivers/net/dsa/mv88e6xxx/chip.h
@@ -599,6 +599,8 @@ struct mv88e6xxx_ops {
const struct mv88e6xxx_ptp_ops *ptp_ops;
/* Phylink */
+ void (*phylink_get_interfaces)(struct mv88e6xxx_chip *chip, int port,
+ unsigned long *supported);
void (*phylink_validate)(struct mv88e6xxx_chip *chip, int port,
unsigned long *mask,
struct phylink_link_state *state);