diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-05-21 09:29:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-22 15:43:02 -0400 |
commit | c242a47238fa2a6a54af8a16e62b54e6e031d4bc (patch) | |
tree | 5ac5dadf274ad245349b5c49b6aa13fbb7a91e7b /drivers/net/phy | |
parent | a6cea535e0cb85ece0673ac10f9d81779225564f (diff) |
net: phy: genphy: Allow overwriting features
of_set_phy_supported allows overwiting hardware capabilities of
a phy with values from the devicetree. This does not work with
the genphy driver though because the genphys config_init function
will overwrite all values adjusted by of_set_phy_supported. Fix
this by initialising the genphy features in the phy_driver struct
and in config_init just limit the features to the ones the hardware
can actually support. The resulting features are a subset of the
devicetree specified features and the hardware features.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r-- | drivers/net/phy/phy_device.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 466ae3e06322..fc569eae7215 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -1072,9 +1072,6 @@ int genphy_config_init(struct phy_device *phydev) | |||
1072 | int val; | 1072 | int val; |
1073 | u32 features; | 1073 | u32 features; |
1074 | 1074 | ||
1075 | /* For now, I'll claim that the generic driver supports | ||
1076 | * all possible port types | ||
1077 | */ | ||
1078 | features = (SUPPORTED_TP | SUPPORTED_MII | 1075 | features = (SUPPORTED_TP | SUPPORTED_MII |
1079 | | SUPPORTED_AUI | SUPPORTED_FIBRE | | 1076 | | SUPPORTED_AUI | SUPPORTED_FIBRE | |
1080 | SUPPORTED_BNC); | 1077 | SUPPORTED_BNC); |
@@ -1107,8 +1104,8 @@ int genphy_config_init(struct phy_device *phydev) | |||
1107 | features |= SUPPORTED_1000baseT_Half; | 1104 | features |= SUPPORTED_1000baseT_Half; |
1108 | } | 1105 | } |
1109 | 1106 | ||
1110 | phydev->supported = features; | 1107 | phydev->supported &= features; |
1111 | phydev->advertising = features; | 1108 | phydev->advertising &= features; |
1112 | 1109 | ||
1113 | return 0; | 1110 | return 0; |
1114 | } | 1111 | } |
@@ -1296,7 +1293,9 @@ static struct phy_driver genphy_driver[] = { | |||
1296 | .name = "Generic PHY", | 1293 | .name = "Generic PHY", |
1297 | .soft_reset = genphy_soft_reset, | 1294 | .soft_reset = genphy_soft_reset, |
1298 | .config_init = genphy_config_init, | 1295 | .config_init = genphy_config_init, |
1299 | .features = 0, | 1296 | .features = PHY_GBIT_FEATURES | SUPPORTED_MII | |
1297 | SUPPORTED_AUI | SUPPORTED_FIBRE | | ||
1298 | SUPPORTED_BNC, | ||
1300 | .config_aneg = genphy_config_aneg, | 1299 | .config_aneg = genphy_config_aneg, |
1301 | .aneg_done = genphy_aneg_done, | 1300 | .aneg_done = genphy_aneg_done, |
1302 | .read_status = genphy_read_status, | 1301 | .read_status = genphy_read_status, |