Lines Matching +full:adp +full:- +full:disable
1 // SPDX-License-Identifier: GPL-2.0+
13 #include "bcm-phy-lib.h"
15 /* RDB per-port registers
25 #define BCM54140_RDB_SPARE2_WS_RTRY_DIS BIT(8) /* wirespeed retry disable */
34 #define BCM54140_RDB_C_APWR_APD_MODE_DIS 0 /* ADP disable */
35 #define BCM54140_RDB_C_APWR_APD_MODE_EN 1 /* ADP enable */
36 #define BCM54140_RDB_C_APWR_APD_MODE_DIS2 2 /* ADP disable */
37 #define BCM54140_RDB_C_APWR_APD_MODE_EN_ANEG 3 /* ADP enable w/ aneg */
60 #define BCM54140_RDB_MON_CTRL_SEL_RR 3 /* meassure all round-robin */
61 #define BCM54140_RDB_MON_CTRL_PWR_DOWN BIT(0) /* power-down monitor */
80 * T = 413.35 - (0.49055 * bits[9:0])
82 #define BCM54140_HWMON_TO_TEMP(v) (413350L - (v) * 491)
83 #define BCM54140_HWMON_FROM_TEMP(v) DIV_ROUND_CLOSEST_ULL(413350L - (v), 491)
183 struct bcm54140_priv *priv = phydev->priv; in bcm54140_hwmon_read_alarm()
186 mutex_lock(&priv->alarm_lock); in bcm54140_hwmon_read_alarm()
194 priv->alarm |= tmp; in bcm54140_hwmon_read_alarm()
196 *val = !!(priv->alarm & bit); in bcm54140_hwmon_read_alarm()
197 priv->alarm &= ~bit; in bcm54140_hwmon_read_alarm()
200 mutex_unlock(&priv->alarm_lock); in bcm54140_hwmon_read_alarm()
225 return -EOPNOTSUPP; in bcm54140_hwmon_read_temp()
258 return -EOPNOTSUPP; in bcm54140_hwmon_read_in()
281 return -EOPNOTSUPP; in bcm54140_hwmon_read()
301 return -EOPNOTSUPP; in bcm54140_hwmon_read_string()
304 return -EOPNOTSUPP; in bcm54140_hwmon_read_string()
326 return -EOPNOTSUPP; in bcm54140_hwmon_write_temp()
350 return -EOPNOTSUPP; in bcm54140_hwmon_write_in()
367 return -EOPNOTSUPP; in bcm54140_hwmon_write()
402 /* select round-robin */ in bcm54140_enable_monitoring()
407 /* remove power-down bit */ in bcm54140_enable_monitoring()
423 hwmon = devm_hwmon_device_register_with_info(&phydev->mdio.dev, in bcm54140_probe_once()
506 struct bcm54140_priv *priv = phydev->priv; in bcm54140_get_base_addr_and_port()
507 struct mii_bus *bus = phydev->mdio.bus; in bcm54140_get_base_addr_and_port()
513 min_addr = phydev->mdio.addr; in bcm54140_get_base_addr_and_port()
514 max_addr = phydev->mdio.addr; in bcm54140_get_base_addr_and_port()
515 addr = phydev->mdio.addr; in bcm54140_get_base_addr_and_port()
535 addr--; in bcm54140_get_base_addr_and_port()
539 addr = phydev->mdio.addr; in bcm54140_get_base_addr_and_port()
555 if ((phy_id & phydev->drv->phy_id_mask) != in bcm54140_get_base_addr_and_port()
556 (phydev->drv->phy_id & phydev->drv->phy_id_mask)) { in bcm54140_get_base_addr_and_port()
557 addr = phydev->mdio.addr; in bcm54140_get_base_addr_and_port()
566 if ((max_addr - min_addr + 1) % 4) { in bcm54140_get_base_addr_and_port()
567 dev_err(&phydev->mdio.dev, in bcm54140_get_base_addr_and_port()
570 return -EINVAL; in bcm54140_get_base_addr_and_port()
573 priv->port = (phydev->mdio.addr - min_addr) % 4; in bcm54140_get_base_addr_and_port()
574 priv->base_addr = phydev->mdio.addr - priv->port; in bcm54140_get_base_addr_and_port()
584 priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); in bcm54140_probe()
586 return -ENOMEM; in bcm54140_probe()
588 phydev->priv = priv; in bcm54140_probe()
594 devm_phy_package_join(&phydev->mdio.dev, phydev, priv->base_addr, 0); in bcm54140_probe()
597 mutex_init(&priv->alarm_lock); in bcm54140_probe()
607 priv->port, priv->base_addr); in bcm54140_probe()
618 if (BCM54140_PHY_ID_REV(phydev->phy_id) == BCM54140_REV_B0) { in bcm54140_config_init()
643 /* disable super isolate mode */ in bcm54140_config_init()
687 struct bcm54140_priv *priv = phydev->priv; in bcm54140_config_intr()
694 if (priv->port >= ARRAY_SIZE(port_to_imr_bit)) in bcm54140_config_intr()
695 return -EINVAL; in bcm54140_config_intr()
701 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { in bcm54140_config_intr()
706 reg &= ~port_to_imr_bit[priv->port]; in bcm54140_config_intr()
709 reg |= port_to_imr_bit[priv->port]; in bcm54140_config_intr()
751 return -EINVAL; in bcm54140_set_downshift()
766 set = FIELD_PREP(BCM54140_RDB_SPARE2_WS_RTRY_LIMIT, cnt - 2); in bcm54140_set_downshift()
832 return -EINVAL; in bcm54140_set_edpd()
841 switch (tuna->id) { in bcm54140_get_tunable()
847 return -EOPNOTSUPP; in bcm54140_get_tunable()
854 switch (tuna->id) { in bcm54140_set_tunable()
860 return -EOPNOTSUPP; in bcm54140_set_tunable()