* [PATCH] net: i825xx: 82596: use MMIO accessors for the MVME16x PORT/CA registers
@ 2026-10-25 2:45 Daniel Palmer
2026-10-25 2:50 ` netdev-bot+sinfo
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Palmer @ 2026-10-25 2:45 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, netdev
Cc: linux-kernel, linux-m68k, Daniel Palmer, Denis Ahrens
On the MVME16x the two port registers need to be written in order to latch
the correct 32bit value.
The way the code is currently written means that modern GCC can decide to
optimize the writes and break that latching.
Convert the MVME16x specific register accesses to use the proper io
accessors to restore the latching and make the driver functional again.
Reported-by: Denis Ahrens <denis@h3q.com>
Signed-off-by: Daniel Palmer <daniel@0x0f.com>
---
Denis emailed me with his fix for this issue which added volatile to
the struct members to stop the compiler getting too clever. This is
my version of the fix. Dennis, please test it actually works :).
Also, this driver is old and does need to be converted over to being
a platform driver etc. I have a set of patches to do this. I'd like
to just fix the driver first so it works again so the conversion to
a platform driver is working against a working driver.
drivers/net/ethernet/i825xx/82596.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/i825xx/82596.c b/drivers/net/ethernet/i825xx/82596.c
index 773d7aa29ef5..bb8798b0d3ae 100644
--- a/drivers/net/ethernet/i825xx/82596.c
+++ b/drivers/net/ethernet/i825xx/82596.c
@@ -196,11 +196,10 @@ enum commands {
#define TX_TIMEOUT (HZ/20)
-struct i596_reg {
- unsigned short porthi;
- unsigned short portlo;
- unsigned long ca;
-};
+/* MVME16x: the 82596 PORT and CA registers */
+#define MVME_I596_PORT_HI 0x00
+#define MVME_I596_PORT_LO 0x02
+#define MVME_I596_CA 0x04
#define EOF 0x8000
#define SIZE_MASK 0x3fff
@@ -375,7 +374,9 @@ static inline void CA(struct net_device *dev)
{
#ifdef ENABLE_MVME16x_NET
if (MACH_IS_MVME16x) {
- ((struct i596_reg *) dev->base_addr)->ca = 1;
+ void __iomem *regs = (void __iomem *)dev->base_addr;
+
+ __raw_writel(1, regs + MVME_I596_CA);
}
#endif
#ifdef ENABLE_BVME6000_NET
@@ -392,9 +393,15 @@ static inline void MPU_PORT(struct net_device *dev, int c, volatile void *x)
{
#ifdef ENABLE_MVME16x_NET
if (MACH_IS_MVME16x) {
- struct i596_reg *p = (struct i596_reg *) (dev->base_addr);
- p->porthi = ((c) | (u32) (x)) & 0xffff;
- p->portlo = ((c) | (u32) (x)) >> 16;
+ void __iomem *regs = (void __iomem *)dev->base_addr;
+ u32 v = (u32)c | (u32)x;
+
+ /*
+ * The 32bit value is latched on the write of the lo register,
+ * so the 16bit writes must happen in this order.
+ */
+ __raw_writew(v & 0xffff, regs + MVME_I596_PORT_HI);
+ __raw_writew(v >> 16, regs + MVME_I596_PORT_LO);
}
#endif
#ifdef ENABLE_BVME6000_NET
--
2.55.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: i825xx: 82596: use MMIO accessors for the MVME16x PORT/CA registers
2026-10-25 2:45 [PATCH] net: i825xx: 82596: use MMIO accessors for the MVME16x PORT/CA registers Daniel Palmer
@ 2026-10-25 2:50 ` netdev-bot+sinfo
2026-10-25 2:52 ` Daniel Palmer
0 siblings, 1 reply; 3+ messages in thread
From: netdev-bot+sinfo @ 2026-10-25 2:50 UTC (permalink / raw)
To: Daniel Palmer
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
linux-kernel, linux-m68k, Denis Ahrens
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- What hardware the change was tested on. For driver fixes please
mention the device (and if relevant firmware version) used for
testing, or say that the change was not tested on real hardware.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account. If the series needs another revision for
other reasons, please include the information in the commit messages
then.
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: i825xx: 82596: use MMIO accessors for the MVME16x PORT/CA registers
2026-10-25 2:50 ` netdev-bot+sinfo
@ 2026-10-25 2:52 ` Daniel Palmer
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Palmer @ 2026-10-25 2:52 UTC (permalink / raw)
To: netdev-bot+sinfo
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
linux-kernel, linux-m68k, Denis Ahrens
Hello bot,
On Sun, 25 Oct 2026 at 11:50, <netdev-bot+sinfo@kernel.org> wrote:
> - What hardware the change was tested on. For driver fixes please
> mention the device (and if relevant firmware version) used for
> testing, or say that the change was not tested on real hardware.
A version of this was tested on MVME177 by Dennis. Dennis will
hopefully test this version on his board and reply with a Tested-by
tag.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-25 2:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-25 2:45 [PATCH] net: i825xx: 82596: use MMIO accessors for the MVME16x PORT/CA registers Daniel Palmer
2026-10-25 2:50 ` netdev-bot+sinfo
2026-10-25 2:52 ` Daniel Palmer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®