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 net-next v2 5/5] net: dsa: microchip: check erratum workaround through indirect register read
Date: Wed, 31 Jul 2024 12:34:03 +0200 [thread overview]
Message-ID: <20240731103403.407818-6-vtpieter@gmail.com> (raw)
In-Reply-To: <20240731103403.407818-1-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 | 13 +++++++++++--
drivers/net/dsa/microchip/ksz8795_reg.h | 4 ++--
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
index 8fe423044109..187301fe94c9 100644
--- a/drivers/net/dsa/microchip/ksz8795.c
+++ b/drivers/net/dsa/microchip/ksz8795.c
@@ -1834,6 +1834,7 @@ void ksz8_phylink_mac_link_up(struct phylink_config *config,
static int ksz8_handle_global_errata(struct dsa_switch *ds)
{
struct ksz_device *dev = ds->priv;
+ u8 data = 0xff;
int ret = 0;
/* KSZ87xx Errata DS80000687C.
@@ -1842,8 +1843,16 @@ 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 -EIO;
+ }
return ret;
}
diff --git a/drivers/net/dsa/microchip/ksz8795_reg.h b/drivers/net/dsa/microchip/ksz8795_reg.h
index 69566a5d9cda..cc6cac97c369 100644
--- a/drivers/net/dsa/microchip/ksz8795_reg.h
+++ b/drivers/net/dsa/microchip/ksz8795_reg.h
@@ -764,8 +764,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-31 10:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-31 10:33 [PATCH net-next v2 0/5] net: dsa: microchip: ksz8795: add Wake on LAN support vtpieter
2024-07-31 10:33 ` [PATCH net-next v2 1/5] dt-bindings: net: dsa: microchip: add microchip,pme-active-high flag vtpieter
2024-07-31 10:34 ` [PATCH net-next v2 2/5] net: dsa: microchip: move KSZ9477 WoL functions to ksz_common vtpieter
2024-07-31 20:10 ` Simon Horman
2024-08-01 6:45 ` Pieter
2024-08-02 4:56 ` Oleksij Rempel
2024-07-31 10:34 ` [PATCH net-next v2 3/5] net: dsa: microchip: generalize KSZ9477 WoL functions at ksz_common vtpieter
2024-08-01 15:22 ` Arun.Ramadoss
2024-08-01 15:48 ` Pieter
2024-07-31 10:34 ` [PATCH net-next v2 4/5] net: dsa: microchip: add WoL support for KSZ87xx family vtpieter
2024-08-01 15:16 ` Arun.Ramadoss
2024-07-31 10:34 ` vtpieter [this message]
2024-08-02 7:48 ` [PATCH net-next v2 5/5] net: dsa: microchip: check erratum workaround through indirect register read Oleksij Rempel
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=20240731103403.407818-6-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.