diff options
author | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2022-10-21 16:10:09 +0100 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-10-24 21:06:24 -0700 |
commit | bd1432f68ddc28bf3ed6e86b16ed29c0b406f91f (patch) | |
tree | 934ec122e4a32140b8a54999c4deb1b609d3dd1e /drivers/net/phy/sfp.c | |
parent | a3c536fc75803b298fd6ba75af33eecf43d31785 (diff) | |
download | linux-stable-bd1432f68ddc28bf3ed6e86b16ed29c0b406f91f.tar.gz linux-stable-bd1432f68ddc28bf3ed6e86b16ed29c0b406f91f.tar.bz2 linux-stable-bd1432f68ddc28bf3ed6e86b16ed29c0b406f91f.zip |
net: sfp: get rid of DM7052 hack when enabling high power
Since we no longer mis-detect high-power mode with the DM7052 module,
we no longer need the hack in sfp_module_enable_high_power(), and can
now switch this to use sfp_modify_u8().
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/phy/sfp.c')
-rw-r--r-- | drivers/net/phy/sfp.c | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c index 921bbedd9b22..39fd1811375c 100644 --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c @@ -1837,31 +1837,14 @@ static int sfp_module_parse_power(struct sfp *sfp) static int sfp_sm_mod_hpower(struct sfp *sfp, bool enable) { - u8 val; int err; - err = sfp_read(sfp, true, SFP_EXT_STATUS, &val, sizeof(val)); - if (err != sizeof(val)) { - dev_err(sfp->dev, "Failed to read EEPROM: %pe\n", ERR_PTR(err)); - return -EAGAIN; - } - - /* DM7052 reports as a high power module, responds to reads (with - * all bytes 0xff) at 0x51 but does not accept writes. In any case, - * if the bit is already set, we're already in high power mode. - */ - if (!!(val & SFP_EXT_STATUS_PWRLVL_SELECT) == enable) - return 0; - - if (enable) - val |= SFP_EXT_STATUS_PWRLVL_SELECT; - else - val &= ~SFP_EXT_STATUS_PWRLVL_SELECT; - - err = sfp_write(sfp, true, SFP_EXT_STATUS, &val, sizeof(val)); - if (err != sizeof(val)) { - dev_err(sfp->dev, "Failed to write EEPROM: %pe\n", - ERR_PTR(err)); + err = sfp_modify_u8(sfp, true, SFP_EXT_STATUS, + SFP_EXT_STATUS_PWRLVL_SELECT, + enable ? SFP_EXT_STATUS_PWRLVL_SELECT : 0); + if (err != sizeof(u8)) { + dev_err(sfp->dev, "failed to %sable high power: %pe\n", + enable ? "en" : "dis", ERR_PTR(err)); return -EAGAIN; } |