net: phy: expose PHY device interface mode
authorFlorian Fainelli <f.fainelli@gmail.com>
Wed, 12 Feb 2014 01:27:40 +0000 (17:27 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 13 Feb 2014 00:08:20 +0000 (19:08 -0500)
Expose the PHY device interface mode through sysfs since this is an
useful piece of information for knowing how the attached networking
device will have configured its transmit/receive path.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Documentation/ABI/testing/sysfs-bus-mdio
drivers/net/phy/mdio_bus.c

index 6349749ebc2986ef0433263ee87487479f173549..2133afd0b067ca346eab433c29cd7124310881ce 100644 (file)
@@ -7,3 +7,13 @@ Description:
                by the device during bus enumeration, encoded in hexadecimal.
                This ID is used to match the device with the appropriate
                driver.
+
+What:          /sys/bus/mdio_bus/devices/.../phy_interface
+Date:          February 2014
+KernelVersion: 3.15
+Contact:       netdev@vger.kernel.org
+Description:
+               This attribute contains the PHY interface as configured by the
+               Ethernet driver during bus enumeration, encoded in string.
+               This interface mode is used to configure the Ethernet MAC with the
+               appropriate mode for its data lines to the PHY hardware.
index 71e49000fbf33fc50d08e3c6979014c89fdb4478..7c66ea095a4625735c97874c68f170f34230ffcc 100644 (file)
@@ -432,8 +432,18 @@ phy_id_show(struct device *dev, struct device_attribute *attr, char *buf)
 }
 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);
+
+       return sprintf(buf, "%s\n", phy_modes(phydev->interface));
+}
+static DEVICE_ATTR_RO(phy_interface);
+
 static struct attribute *mdio_dev_attrs[] = {
        &dev_attr_phy_id.attr,
+       &dev_attr_phy_interface.attr,
        NULL,
 };
 ATTRIBUTE_GROUPS(mdio_dev);
This page took 0.025144 seconds and 5 git commands to generate.