lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240731103403.407818-6-vtpieter@gmail.com>
Date: Wed, 31 Jul 2024 12:34:03 +0200
From: vtpieter@...il.com
To: devicetree@...r.kernel.org,
	woojung.huh@...rochip.com,
	UNGLinuxDriver@...rochip.com,
	netdev@...r.kernel.org
Cc: o.rempel@...gutronix.de,
	Pieter Van Trappen <pieter.van.trappen@...n.ch>
Subject: [PATCH net-next v2 5/5] net: dsa: microchip: check erratum workaround through indirect register read

From: Pieter Van Trappen <pieter.van.trappen@...n.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@...n.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ