|
@@ -376,6 +376,48 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45)
|
|
|
}
|
|
|
EXPORT_SYMBOL(get_phy_device);
|
|
|
|
|
|
+static ssize_t
|
|
|
+phy_id_show(struct device *dev, struct device_attribute *attr, char *buf)
|
|
|
+{
|
|
|
+ struct phy_device *phydev = to_phy_device(dev);
|
|
|
+
|
|
|
+ return sprintf(buf, "0x%.8lx\n", (unsigned long)phydev->phy_id);
|
|
|
+}
|
|
|
+static DEVICE_ATTR_RO(phy_id);
|
|
|
+
|
|
|
+static ssize_t
|
|
|
+phy_interface_show(struct device *dev, struct device_attribute *attr, char *buf)
|
|
|
+{
|
|
|
+ struct phy_device *phydev = to_phy_device(dev);
|
|
|
+ const char *mode = NULL;
|
|
|
+
|
|
|
+ if (phy_is_internal(phydev))
|
|
|
+ mode = "internal";
|
|
|
+ else
|
|
|
+ mode = phy_modes(phydev->interface);
|
|
|
+
|
|
|
+ return sprintf(buf, "%s\n", mode);
|
|
|
+}
|
|
|
+static DEVICE_ATTR_RO(phy_interface);
|
|
|
+
|
|
|
+static ssize_t
|
|
|
+phy_has_fixups_show(struct device *dev, struct device_attribute *attr,
|
|
|
+ char *buf)
|
|
|
+{
|
|
|
+ struct phy_device *phydev = to_phy_device(dev);
|
|
|
+
|
|
|
+ return sprintf(buf, "%d\n", phydev->has_fixups);
|
|
|
+}
|
|
|
+static DEVICE_ATTR_RO(phy_has_fixups);
|
|
|
+
|
|
|
+static struct attribute *phy_dev_attrs[] = {
|
|
|
+ &dev_attr_phy_id.attr,
|
|
|
+ &dev_attr_phy_interface.attr,
|
|
|
+ &dev_attr_phy_has_fixups.attr,
|
|
|
+ NULL,
|
|
|
+};
|
|
|
+ATTRIBUTE_GROUPS(phy_dev);
|
|
|
+
|
|
|
/**
|
|
|
* phy_device_register - Register the phy device on the MDIO bus
|
|
|
* @phydev: phy_device structure to be added to the MDIO bus
|
|
@@ -395,6 +437,8 @@ int phy_device_register(struct phy_device *phydev)
|
|
|
goto out;
|
|
|
}
|
|
|
|
|
|
+ phydev->mdio.dev.groups = phy_dev_groups;
|
|
|
+
|
|
|
err = device_add(&phydev->mdio.dev);
|
|
|
if (err) {
|
|
|
pr_err("PHY %d failed to add\n", phydev->mdio.addr);
|