@@ -136,6 +136,24 @@ void mdio_device_reset(struct mdio_device *mdiodev, int value)
}
EXPORT_SYMBOL(mdio_device_reset);
+/**
+ * mdio_device_reset_status - returns the reset status of an MDIO device
+ *
+ * Returns >0 if the reset line is asserted, 0 if it is not asserted
+ and <0 on error.
+ */
+int mdio_device_reset_status(struct mdio_device *mdiodev)
+{
+ if (mdiodev->reset_gpio)
+ return gpiod_get_value_cansleep(mdiodev->reset_gpio);
+
+ if (mdiodev->reset_ctrl)
+ return reset_control_status(mdiodev->reset_ctrl);
+
+ return -EOPNOTSUPP;
+}
+EXPORT_SYMBOL(mdio_device_reset_status);
+
/**
* mdio_probe - probe an MDIO device
* @dev: device to probe
@@ -92,6 +92,7 @@ struct mdio_device *mdio_device_create(struct mii_bus *bus, int addr);
int mdio_device_register(struct mdio_device *mdiodev);
void mdio_device_remove(struct mdio_device *mdiodev);
void mdio_device_reset(struct mdio_device *mdiodev, int value);
+int mdio_device_reset_status(struct mdio_device *mdiodev);
int mdio_driver_register(struct mdio_driver *drv);
void mdio_driver_unregister(struct mdio_driver *drv);
int mdio_device_bus_match(struct device *dev, struct device_driver *drv);
@@ -1461,6 +1461,11 @@ static inline void phy_device_reset(struct phy_device *phydev, int value)
mdio_device_reset(&phydev->mdio, value);
}
+static inline int phy_device_reset_status(struct phy_device *phydev)
+{
+ return mdio_device_reset_status(&phydev->mdio);
+}
+
#define phydev_err(_phydev, format, args...) \
dev_err(&_phydev->mdio.dev, format, ##args)
Subject: [PATCH net 3/4] net:phy: add phy_device_reset_status() support Description: add support to query the status of the reset line of an MDIO device. Signed-off-by: Laurent Badel <laurentbadel@eaton.com> --- drivers/net/phy/mdio_device.c | 18 ++++++++++++++++++ include/linux/mdio.h | 1 + include/linux/phy.h | 5 +++++ 3 files changed, 24 insertions(+)