From: vtpieter@gmail.com
To: devicetree@vger.kernel.org, woojung.huh@microchip.com,
UNGLinuxDriver@microchip.com, netdev@vger.kernel.org
Cc: o.rempel@pengutronix.de, Pieter Van Trappen <pieter.van.trappen@cern.ch>
Subject: [PATCH 3/4] net: dsa: microchip: check erratum workaround through indirect register read
Date: Wed, 17 Jul 2024 21:37:24 +0200 [thread overview]
Message-ID: <20240717193725.469192-4-vtpieter@gmail.com> (raw)
In-Reply-To: <20240717193725.469192-3-vtpieter@gmail.com>
From: Pieter Van Trappen <pieter.van.trappen@cern.ch>
Check the erratum workaround application which ensures in addition
that indirect register write and read work as expected.
Commit b7fb7729c94f ("net: dsa: microchip: fix register write order in
ksz8_ind_write8()") would have been found faster like this.
Also fix the register naming as in the datasheet.
Signed-off-by: Pieter Van Trappen <pieter.van.trappen@cern.ch>
---
drivers/net/dsa/microchip/ksz8795.c | 10 ++++++++--
drivers/net/dsa/microchip/ksz8795_reg.h | 4 ++--
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
index 49081e9a8cb0..40851174f448 100644
--- a/drivers/net/dsa/microchip/ksz8795.c
+++ b/drivers/net/dsa/microchip/ksz8795.c
@@ -1974,6 +1974,7 @@ static int ksz8_handle_global_errata(struct dsa_switch *ds)
{
struct ksz_device *dev = ds->priv;
int ret = 0;
+ u8 data = 0xff;
/* KSZ87xx Errata DS80000687C.
* Module 2: Link drops with some EEE link partners.
@@ -1981,8 +1982,13 @@ static int ksz8_handle_global_errata(struct dsa_switch *ds)
* KSZ879x/KSZ877x/KSZ876x and some EEE link partners may result in
* the link dropping.
*/
- if (dev->info->ksz87xx_eee_link_erratum)
- ret = ksz8_ind_write8(dev, TABLE_EEE, REG_IND_EEE_GLOB2_HI, 0);
+ if (dev->info->ksz87xx_eee_link_erratum) {
+ ret = ksz8_ind_write8(dev, TABLE_EEE, REG_IND_EEE_GLOB2_LO, 0);
+ if (!ret)
+ ret = ksz8_ind_read8(dev, TABLE_EEE, REG_IND_EEE_GLOB2_LO, &data);
+ if (!ret && data)
+ dev_err(dev->dev, "failed to disable EEE next page exchange (erratum)\n");
+ }
return ret;
}
diff --git a/drivers/net/dsa/microchip/ksz8795_reg.h b/drivers/net/dsa/microchip/ksz8795_reg.h
index 884e899145dd..8d18507c92bf 100644
--- a/drivers/net/dsa/microchip/ksz8795_reg.h
+++ b/drivers/net/dsa/microchip/ksz8795_reg.h
@@ -767,8 +767,8 @@
#define IND_ACC_TABLE(table) ((table) << 8)
/* */
-#define REG_IND_EEE_GLOB2_LO 0x34
-#define REG_IND_EEE_GLOB2_HI 0x35
+#define REG_IND_EEE_GLOB2_HI 0x34
+#define REG_IND_EEE_GLOB2_LO 0x35
/**
* MIB_COUNTER_VALUE 00-00000000-3FFFFFFF
--
2.43.0
next prev parent reply other threads:[~2024-07-17 19:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-17 19:37 [PATCH 0/4] net: dsa: microchip: ksz8795: add Wake on LAN support vtpieter
2024-07-17 19:37 ` [PATCH 1/4] dt-bindings: net: dsa: microchip: add microchip,pme-active-high flag vtpieter
2024-07-17 19:37 ` [PATCH 2/4] net: dsa: microchip: ksz8795: add Wake on LAN support vtpieter
2024-07-17 19:37 ` vtpieter [this message]
2024-07-17 19:37 ` [PATCH 4/4] net: dsa: microchip: ksz9477: correct description of WoL functions vtpieter
2024-07-19 13:52 ` Oleksij Rempel
2024-07-18 2:24 ` [PATCH 3/4] net: dsa: microchip: check erratum workaround through indirect register read Andrew Lunn
2024-07-18 13:45 ` Pieter
2024-07-19 13:46 ` [PATCH 2/4] net: dsa: microchip: ksz8795: add Wake on LAN support Oleksij Rempel
2024-07-20 12:44 ` Pieter
2024-07-19 12:36 ` [PATCH 1/4] dt-bindings: net: dsa: microchip: add microchip,pme-active-high flag Oleksij Rempel
2024-07-23 2:42 ` Rob Herring (Arm)
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=20240717193725.469192-4-vtpieter@gmail.com \
--to=vtpieter@gmail.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=devicetree@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=pieter.van.trappen@cern.ch \
--cc=woojung.huh@microchip.com \
/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).