|
@@ -22,12 +22,30 @@
|
|
MODULE_AUTHOR("Grant Likely <grant.likely@secretlab.ca>");
|
|
MODULE_AUTHOR("Grant Likely <grant.likely@secretlab.ca>");
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_LICENSE("GPL");
|
|
|
|
|
|
|
|
+static void of_set_phy_supported(struct phy_device *phydev, u32 max_speed)
|
|
|
|
+{
|
|
|
|
+ phydev->supported |= PHY_DEFAULT_FEATURES;
|
|
|
|
+
|
|
|
|
+ switch (max_speed) {
|
|
|
|
+ default:
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ case SPEED_1000:
|
|
|
|
+ phydev->supported |= PHY_1000BT_FEATURES;
|
|
|
|
+ case SPEED_100:
|
|
|
|
+ phydev->supported |= PHY_100BT_FEATURES;
|
|
|
|
+ case SPEED_10:
|
|
|
|
+ phydev->supported |= PHY_10BT_FEATURES;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
static int of_mdiobus_register_phy(struct mii_bus *mdio, struct device_node *child,
|
|
static int of_mdiobus_register_phy(struct mii_bus *mdio, struct device_node *child,
|
|
u32 addr)
|
|
u32 addr)
|
|
{
|
|
{
|
|
struct phy_device *phy;
|
|
struct phy_device *phy;
|
|
bool is_c45;
|
|
bool is_c45;
|
|
int rc, prev_irq;
|
|
int rc, prev_irq;
|
|
|
|
+ u32 max_speed = 0;
|
|
|
|
|
|
is_c45 = of_device_is_compatible(child,
|
|
is_c45 = of_device_is_compatible(child,
|
|
"ethernet-phy-ieee802.3-c45");
|
|
"ethernet-phy-ieee802.3-c45");
|
|
@@ -58,8 +76,13 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio, struct device_node *chi
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /* Set phydev->supported based on the "max-speed" property
|
|
|
|
+ * if present */
|
|
|
|
+ if (!of_property_read_u32(child, "max-speed", &max_speed))
|
|
|
|
+ of_set_phy_supported(phy, max_speed);
|
|
|
|
+
|
|
dev_dbg(&mdio->dev, "registered phy %s at address %i\n",
|
|
dev_dbg(&mdio->dev, "registered phy %s at address %i\n",
|
|
- child->name, addr);
|
|
|
|
|
|
+ child->name, addr);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|