diff options
author | Alexey Brodkin <Alexey.Brodkin@synopsys.com> | 2016-01-13 16:59:34 +0300 |
---|---|---|
committer | Joe Hershberger <joe.hershberger@ni.com> | 2016-01-28 12:32:42 -0600 |
commit | b18acb0a115dfbbd31ee53081b514cab6fe2f262 (patch) | |
tree | accb00059debddb9b9b63402808b67e5a57d0581 /drivers/net | |
parent | 4dae610b657fa0c7864cf68d4f44c786ff968c83 (diff) | |
download | u-boot-imx-b18acb0a115dfbbd31ee53081b514cab6fe2f262.zip u-boot-imx-b18acb0a115dfbbd31ee53081b514cab6fe2f262.tar.gz u-boot-imx-b18acb0a115dfbbd31ee53081b514cab6fe2f262.tar.bz2 |
drivers/net/phy: introduce phy_set_supported()
This new function will allow MAC drivers to override supported
capabilities of the phy. It is required when MAC cannot handle all
speeds supported by phy.
For example phy supports up-to 1Gb connections while MAC may only work
in modes up to 100 or even 10 Mbit/sec.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/phy/phy.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index d25bec2..e25d4e3 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -528,6 +528,30 @@ int phy_register(struct phy_driver *drv) return 0; } +int phy_set_supported(struct phy_device *phydev, u32 max_speed) +{ + /* The default values for phydev->supported are provided by the PHY + * driver "features" member, we want to reset to sane defaults first + * before supporting higher speeds. + */ + phydev->supported &= PHY_DEFAULT_FEATURES; + + switch (max_speed) { + default: + return -ENOTSUPP; + case SPEED_1000: + phydev->supported |= PHY_1000BT_FEATURES; + /* fall through */ + case SPEED_100: + phydev->supported |= PHY_100BT_FEATURES; + /* fall through */ + case SPEED_10: + phydev->supported |= PHY_10BT_FEATURES; + } + + return 0; +} + static int phy_probe(struct phy_device *phydev) { int err = 0; |