diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-05-21 09:29:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-22 15:43:02 -0400 |
commit | de906af1cf8d5f2e9c461148577ac26dcdaea86e (patch) | |
tree | 4732496e85bf6845316ea9055605abf4b20dbda1 /drivers/of | |
parent | c242a47238fa2a6a54af8a16e62b54e6e031d4bc (diff) |
net: phy: make of_set_phy_supported work with genphy driver
of_set_phy_supported allows overwiting hardware capabilities of
a phy with values from the devicetree. of_set_phy_supported is
called right after phy_device_register in the assumption that
phy_probe is called from phy_device_register and the features
of the phy are already initialized. For the genphy driver this
is not true, here phy_probe is called later during phy_connect
time. phy_probe will then overwrite all settings done from
of_set_phy_supported
Fix this by moving of_set_phy_supported to the core phy code
and calling it from phy_probe.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/of_mdio.c | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index 4c1e01ed16dc..b85709458639 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
@@ -23,27 +23,6 @@ | |||
23 | MODULE_AUTHOR("Grant Likely <grant.likely@secretlab.ca>"); | 23 | MODULE_AUTHOR("Grant Likely <grant.likely@secretlab.ca>"); |
24 | MODULE_LICENSE("GPL"); | 24 | MODULE_LICENSE("GPL"); |
25 | 25 | ||
26 | static void of_set_phy_supported(struct phy_device *phydev, u32 max_speed) | ||
27 | { | ||
28 | /* The default values for phydev->supported are provided by the PHY | ||
29 | * driver "features" member, we want to reset to sane defaults fist | ||
30 | * before supporting higher speeds. | ||
31 | */ | ||
32 | phydev->supported &= PHY_DEFAULT_FEATURES; | ||
33 | |||
34 | switch (max_speed) { | ||
35 | default: | ||
36 | return; | ||
37 | |||
38 | case SPEED_1000: | ||
39 | phydev->supported |= PHY_1000BT_FEATURES; | ||
40 | case SPEED_100: | ||
41 | phydev->supported |= PHY_100BT_FEATURES; | ||
42 | case SPEED_10: | ||
43 | phydev->supported |= PHY_10BT_FEATURES; | ||
44 | } | ||
45 | } | ||
46 | |||
47 | /* Extract the clause 22 phy ID from the compatible string of the form | 26 | /* Extract the clause 22 phy ID from the compatible string of the form |
48 | * ethernet-phy-idAAAA.BBBB */ | 27 | * ethernet-phy-idAAAA.BBBB */ |
49 | static int of_get_phy_id(struct device_node *device, u32 *phy_id) | 28 | static int of_get_phy_id(struct device_node *device, u32 *phy_id) |
@@ -104,11 +83,6 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio, struct device_node *chi | |||
104 | return 1; | 83 | return 1; |
105 | } | 84 | } |
106 | 85 | ||
107 | /* Set phydev->supported based on the "max-speed" property | ||
108 | * if present */ | ||
109 | if (!of_property_read_u32(child, "max-speed", &max_speed)) | ||
110 | of_set_phy_supported(phy, max_speed); | ||
111 | |||
112 | dev_dbg(&mdio->dev, "registered phy %s at address %i\n", | 86 | dev_dbg(&mdio->dev, "registered phy %s at address %i\n", |
113 | child->name, addr); | 87 | child->name, addr); |
114 | 88 | ||