From: Marek Vasut <marex@denx.de>
To: netdev@vger.kernel.org
Cc: Marek Vasut <marex@denx.de>,
"David S. Miller" <davem@davemloft.net>,
Andrew Lunn <andrew@lunn.ch>,
Arun Ramadoss <arun.ramadoss@microchip.com>,
Eric Dumazet <edumazet@google.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Russell King <linux@armlinux.org.uk>,
UNGLinuxDriver@microchip.com, Vladimir Oltean <olteanv@gmail.com>,
Woojung Huh <woojung.huh@microchip.com>,
stable@vger.kernel.org
Subject: [PATCH] net: dsa: microchip: Fix gigabit set and get function for KSZ87xx
Date: Wed, 22 Feb 2023 04:17:38 +0100 [thread overview]
Message-ID: <20230222031738.189025-1-marex@denx.de> (raw)
Per KSZ8794 [1] datasheet DS00002134D page 54 TABLE 4-4: PORT REGISTERS,
it is Register 86 (0x56): Port 4 Interface Control 6 which contains the
Is_1Gbps field.
Currently, the driver uses PORT read function on register P_XMII_CTRL_1
to access the P_GMII_1GBIT_M, i.e. Is_1Gbps, bit. The problem is, the
register P_XMII_CTRL_1 address is already 0x56, which is the converted
PORT register address instead of the offset within PORT register space
that PORT read function expects and converts into the PORT register
address internally. The incorrectly double-converted register address
becomes 0xa6, which is what the PORT read function ultimatelly accesses,
and which is a non-existent register on the KSZ8794/KSZ8795 .
The correct value for P_XMII_CTRL_1 is 0x6, which gets converted into
port address 0x56, which is Register 86 (0x56): Port 4 Interface Control 6
per KSZ8794 datasheet, i.e. the correct register address.
To make this worse, there are multiple other call sites which read and
even write the P_XMII_CTRL_1 register, one of them is ksz_set_xmii(),
which is responsible for configuration of RGMII delays. These delays
are incorrectly configured and a non-existent register is written
without this change.
Fix the P_XMII_CTRL_1 register offset to resolve these problems.
[1] https://ww1.microchip.com/downloads/aemDocuments/documents/UNG/ProductDocuments/DataSheets/KSZ8794CNX-Data-Sheet-DS00002134.pdf
Fixes: 46f80fa8981b ("net: dsa: microchip: add common gigabit set and get function")
Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Arun Ramadoss <arun.ramadoss@microchip.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: UNGLinuxDriver@microchip.com
Cc: Vladimir Oltean <olteanv@gmail.com>
Cc: Woojung Huh <woojung.huh@microchip.com>
Cc: stable@vger.kernel.org
Cc: netdev@vger.kernel.org
---
drivers/net/dsa/microchip/ksz_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 729b36eeb2c46..7fc2155d93d6e 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -319,7 +319,7 @@ static const u16 ksz8795_regs[] = {
[S_BROADCAST_CTRL] = 0x06,
[S_MULTICAST_CTRL] = 0x04,
[P_XMII_CTRL_0] = 0x06,
- [P_XMII_CTRL_1] = 0x56,
+ [P_XMII_CTRL_1] = 0x06,
};
static const u32 ksz8795_masks[] = {
--
2.39.1
next reply other threads:[~2023-02-22 3:18 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-22 3:17 Marek Vasut [this message]
2023-02-22 3:52 ` [PATCH] net: dsa: microchip: Fix gigabit set and get function for KSZ87xx Arun.Ramadoss
2023-02-22 12:50 ` Russell King (Oracle)
2023-02-22 13:03 ` Russell King (Oracle)
2023-02-22 15:10 ` Marek Vasut
2023-02-22 15:56 ` Russell King (Oracle)
2023-02-22 16:30 ` Marek Vasut
2023-02-22 16:39 ` Russell King (Oracle)
2023-02-22 18:43 ` Marek Vasut
2023-02-22 19:12 ` Russell King (Oracle)
2023-02-22 21:25 ` Vladimir Oltean
2023-02-22 21:08 ` Vladimir Oltean
2023-02-22 22:05 ` Marek Vasut
2023-02-22 22:31 ` Vladimir Oltean
2023-02-22 22:58 ` Marek Vasut
2023-02-22 23:05 ` Florian Fainelli
2023-02-22 23:07 ` Russell King (Oracle)
2023-02-22 23:21 ` Vladimir Oltean
2023-02-22 23:55 ` Marek Vasut
2023-02-23 0:22 ` Vladimir Oltean
2023-02-23 5:17 ` Marek Vasut
2023-02-23 14:20 ` Vladimir Oltean
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=20230222031738.189025-1-marex@denx.de \
--to=marex@denx.de \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=arun.ramadoss@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--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).