From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
To: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Cc: Andrew Lunn <andrew@lunn.ch>,
devicetree@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>,
Rob Herring <robh+dt@kernel.org>
Subject: [PATCH net-next 7/7] net: sfp: get rid of DM7052 hack when enabling high power
Date: Fri, 21 Oct 2022 16:10:09 +0100 [thread overview]
Message-ID: <E1oltez-00FwxN-Nn@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <Y1K17UtfFopACIi2@shell.armlinux.org.uk>
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>
---
drivers/net/phy/sfp.c | 29 ++++++-----------------------
1 file 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;
}
--
2.30.2
next prev parent reply other threads:[~2022-10-21 15:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-21 15:08 [PATCH net-next v2 0/7] net: sfp: improve high power module implementation Russell King (Oracle)
2022-10-21 15:09 ` [PATCH net-next 1/7] dt-bindings: net: sff,sfp: update binding Russell King (Oracle)
2022-10-21 22:11 ` Rob Herring
2022-10-21 15:09 ` [PATCH net-next 2/7] net: sfp: check firmware provided max power Russell King (Oracle)
2022-10-21 15:09 ` [PATCH net-next 3/7] net: sfp: ignore power level 2 prior to SFF-8472 Rev 10.2 Russell King (Oracle)
2022-10-21 15:09 ` [PATCH net-next 4/7] net: sfp: ignore power level 3 prior to SFF-8472 Rev 11.4 Russell King (Oracle)
2022-10-21 15:09 ` [PATCH net-next 5/7] net: sfp: provide a definition for the power level select bit Russell King (Oracle)
2022-10-21 15:10 ` [PATCH net-next 6/7] net: sfp: add sfp_modify_u8() helper Russell King (Oracle)
2022-10-21 15:10 ` Russell King (Oracle) [this message]
2022-10-25 4:20 ` [PATCH net-next v2 0/7] net: sfp: improve high power module implementation patchwork-bot+netdevbpf
-- strict thread matches above, loose matches on Subject: below --
2022-10-19 13:28 [PATCH net-next " Russell King (Oracle)
2022-10-19 13:29 ` [PATCH net-next 7/7] net: sfp: get rid of DM7052 hack when enabling high power Russell King (Oracle)
2022-10-21 15:52 ` Andrew Lunn
2022-10-21 16:16 ` Jakub Kicinski
2022-10-21 19:14 ` Russell King (Oracle)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1oltez-00FwxN-Nn@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux.org.uk \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).