mutex_unlock(&chip->reg_lock);
}
-static int mv88e6xxx_energy_detect_read(struct mv88e6xxx_chip *chip, int port,
- struct ethtool_eee *eee)
-{
- int err;
-
- if (!chip->info->ops->phy_energy_detect_read)
- return -EOPNOTSUPP;
-
- /* assign eee->eee_enabled and eee->tx_lpi_enabled */
- err = chip->info->ops->phy_energy_detect_read(chip, port, eee);
- if (err)
- return err;
-
- /* assign eee->eee_active */
- return mv88e6xxx_port_status_eee(chip, port, eee);
-}
-
-static int mv88e6xxx_energy_detect_write(struct mv88e6xxx_chip *chip, int port,
- struct ethtool_eee *eee)
-{
- if (!chip->info->ops->phy_energy_detect_write)
- return -EOPNOTSUPP;
-
- return chip->info->ops->phy_energy_detect_write(chip, port, eee);
-}
-
static int mv88e6xxx_get_eee(struct dsa_switch *ds, int port,
struct ethtool_eee *e)
{
- struct mv88e6xxx_chip *chip = ds->priv;
- int err;
-
- mutex_lock(&chip->reg_lock);
- err = mv88e6xxx_energy_detect_read(chip, port, e);
- mutex_unlock(&chip->reg_lock);
-
- return err;
+ /* Nothing to do on the port's MAC */
+ return 0;
}
static int mv88e6xxx_set_eee(struct dsa_switch *ds, int port,
struct ethtool_eee *e)
{
- struct mv88e6xxx_chip *chip = ds->priv;
- int err;
-
- mutex_lock(&chip->reg_lock);
- err = mv88e6xxx_energy_detect_write(chip, port, e);
- mutex_unlock(&chip->reg_lock);
-
- return err;
+ /* Nothing to do on the port's MAC */
+ return 0;
}
static u16 mv88e6xxx_port_vlan(struct mv88e6xxx_chip *chip, int dev, int port)
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
- .phy_energy_detect_read = mv88e6352_phy_energy_detect_read,
- .phy_energy_detect_write = mv88e6352_phy_energy_detect_write,
.port_set_link = mv88e6xxx_port_set_link,
.port_set_duplex = mv88e6xxx_port_set_duplex,
.port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay,
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
- .phy_energy_detect_read = mv88e6352_phy_energy_detect_read,
- .phy_energy_detect_write = mv88e6352_phy_energy_detect_write,
.port_set_link = mv88e6xxx_port_set_link,
.port_set_duplex = mv88e6xxx_port_set_duplex,
.port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay,
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
- .phy_energy_detect_read = mv88e6352_phy_energy_detect_read,
- .phy_energy_detect_write = mv88e6352_phy_energy_detect_write,
.port_set_link = mv88e6xxx_port_set_link,
.port_set_duplex = mv88e6xxx_port_set_duplex,
.port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay,
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
- .phy_energy_detect_read = mv88e6390_phy_energy_detect_read,
- .phy_energy_detect_write = mv88e6390_phy_energy_detect_write,
.port_set_link = mv88e6xxx_port_set_link,
.port_set_duplex = mv88e6xxx_port_set_duplex,
.port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay,
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
- .phy_energy_detect_read = mv88e6390_phy_energy_detect_read,
- .phy_energy_detect_write = mv88e6390_phy_energy_detect_write,
.port_set_link = mv88e6xxx_port_set_link,
.port_set_duplex = mv88e6xxx_port_set_duplex,
.port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay,
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
- .phy_energy_detect_read = mv88e6390_phy_energy_detect_read,
- .phy_energy_detect_write = mv88e6390_phy_energy_detect_write,
.port_set_link = mv88e6xxx_port_set_link,
.port_set_duplex = mv88e6xxx_port_set_duplex,
.port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay,
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
- .phy_energy_detect_read = mv88e6352_phy_energy_detect_read,
- .phy_energy_detect_write = mv88e6352_phy_energy_detect_write,
.port_set_link = mv88e6xxx_port_set_link,
.port_set_duplex = mv88e6xxx_port_set_duplex,
.port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay,
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
- .phy_energy_detect_read = mv88e6390_phy_energy_detect_read,
- .phy_energy_detect_write = mv88e6390_phy_energy_detect_write,
.port_set_link = mv88e6xxx_port_set_link,
.port_set_duplex = mv88e6xxx_port_set_duplex,
.port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay,
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
- .phy_energy_detect_read = mv88e6352_phy_energy_detect_read,
- .phy_energy_detect_write = mv88e6352_phy_energy_detect_write,
.port_set_link = mv88e6xxx_port_set_link,
.port_set_duplex = mv88e6xxx_port_set_duplex,
.port_set_speed = mv88e6185_port_set_speed,
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
- .phy_energy_detect_read = mv88e6352_phy_energy_detect_read,
- .phy_energy_detect_write = mv88e6352_phy_energy_detect_write,
.port_set_link = mv88e6xxx_port_set_link,
.port_set_duplex = mv88e6xxx_port_set_duplex,
.port_set_speed = mv88e6185_port_set_speed,
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
- .phy_energy_detect_read = mv88e6352_phy_energy_detect_read,
- .phy_energy_detect_write = mv88e6352_phy_energy_detect_write,
.port_set_link = mv88e6xxx_port_set_link,
.port_set_duplex = mv88e6xxx_port_set_duplex,
.port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay,
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
- .phy_energy_detect_read = mv88e6352_phy_energy_detect_read,
- .phy_energy_detect_write = mv88e6352_phy_energy_detect_write,
.port_set_link = mv88e6xxx_port_set_link,
.port_set_duplex = mv88e6xxx_port_set_duplex,
.port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay,
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
- .phy_energy_detect_read = mv88e6390_phy_energy_detect_read,
- .phy_energy_detect_write = mv88e6390_phy_energy_detect_write,
.port_set_link = mv88e6xxx_port_set_link,
.port_set_duplex = mv88e6xxx_port_set_duplex,
.port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay,
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
.phy_read = mv88e6xxx_g2_smi_phy_read,
.phy_write = mv88e6xxx_g2_smi_phy_write,
- .phy_energy_detect_read = mv88e6390_phy_energy_detect_read,
- .phy_energy_detect_write = mv88e6390_phy_energy_detect_write,
.port_set_link = mv88e6xxx_port_set_link,
.port_set_duplex = mv88e6xxx_port_set_duplex,
.port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay,
{
return mv88e6xxx_phy_ppu_enable(chip);
}
-
-/* Page 0, Register 16: Copper Specific Control Register 1 */
-
-int mv88e6352_phy_energy_detect_read(struct mv88e6xxx_chip *chip, int phy,
- struct ethtool_eee *eee)
-{
- u16 val;
- int err;
-
- err = mv88e6xxx_phy_read(chip, phy, MV88E6XXX_PHY_CSCTL1, &val);
- if (err)
- return err;
-
- val &= MV88E6352_PHY_CSCTL1_ENERGY_DETECT_MASK;
-
- eee->eee_enabled = false;
- eee->tx_lpi_enabled = false;
-
- switch (val) {
- case MV88E6352_PHY_CSCTL1_ENERGY_DETECT_SENSE_NLP:
- eee->tx_lpi_enabled = true;
- /* fall through... */
- case MV88E6352_PHY_CSCTL1_ENERGY_DETECT_SENSE_RCV:
- eee->eee_enabled = true;
- }
-
- return 0;
-}
-
-int mv88e6352_phy_energy_detect_write(struct mv88e6xxx_chip *chip, int phy,
- struct ethtool_eee *eee)
-{
- u16 val;
- int err;
-
- err = mv88e6xxx_phy_read(chip, phy, MV88E6XXX_PHY_CSCTL1, &val);
- if (err)
- return err;
-
- val &= ~MV88E6352_PHY_CSCTL1_ENERGY_DETECT_MASK;
-
- if (eee->eee_enabled)
- val |= MV88E6352_PHY_CSCTL1_ENERGY_DETECT_SENSE_RCV;
- if (eee->tx_lpi_enabled)
- val |= MV88E6352_PHY_CSCTL1_ENERGY_DETECT_SENSE_NLP;
-
- return mv88e6xxx_phy_write(chip, phy, MV88E6XXX_PHY_CSCTL1, val);
-}
-
-int mv88e6390_phy_energy_detect_read(struct mv88e6xxx_chip *chip, int phy,
- struct ethtool_eee *eee)
-{
- u16 val;
- int err;
-
- err = mv88e6xxx_phy_read(chip, phy, MV88E6XXX_PHY_CSCTL1, &val);
- if (err)
- return err;
-
- val &= MV88E6390_PHY_CSCTL1_ENERGY_DETECT_MASK;
-
- eee->eee_enabled = false;
- eee->tx_lpi_enabled = false;
-
- switch (val) {
- case MV88E6390_PHY_CSCTL1_ENERGY_DETECT_SENSE_NLP_AUTO:
- case MV88E6390_PHY_CSCTL1_ENERGY_DETECT_SENSE_NLP_SW:
- eee->tx_lpi_enabled = true;
- /* fall through... */
- case MV88E6390_PHY_CSCTL1_ENERGY_DETECT_SENSE_RCV_AUTO:
- case MV88E6390_PHY_CSCTL1_ENERGY_DETECT_SENSE_RCV_SW:
- eee->eee_enabled = true;
- }
-
- return 0;
-}
-
-int mv88e6390_phy_energy_detect_write(struct mv88e6xxx_chip *chip, int phy,
- struct ethtool_eee *eee)
-{
- u16 val;
- int err;
-
- err = mv88e6xxx_phy_read(chip, phy, MV88E6XXX_PHY_CSCTL1, &val);
- if (err)
- return err;
-
- val &= ~MV88E6390_PHY_CSCTL1_ENERGY_DETECT_MASK;
-
- if (eee->eee_enabled)
- val |= MV88E6390_PHY_CSCTL1_ENERGY_DETECT_SENSE_RCV_AUTO;
- if (eee->tx_lpi_enabled)
- val |= MV88E6390_PHY_CSCTL1_ENERGY_DETECT_SENSE_NLP_AUTO;
-
- return mv88e6xxx_phy_write(chip, phy, MV88E6XXX_PHY_CSCTL1, val);
-}