mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net] net: dsa: microchip: fix wrong register write when masking interrupt
@ 2024-05-28 21:35 Tristram.Ha
  2024-05-30  8:56 ` Paolo Abeni
  0 siblings, 1 reply; 3+ messages in thread
From: Tristram.Ha @ 2024-05-28 21:35 UTC (permalink / raw)
  To: Arun Ramadoss, Woojung Huh, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, Vladimir Oltean
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	UNGLinuxDriver, netdev, linux-kernel, Tristram Ha

From: Tristram Ha <tristram.ha@microchip.com>

The initial code used 32-bit register.  After that it was changed to 0x1F
so it is no longer appropriate to use 32-bit write.

Fixes: e1add7dd6183 ("net: dsa: microchip: use common irq routines for girq and pirq")
Signed-off-by: Tristram Ha <tristram.ha@microchip.com>
---
 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 1e0085cd9a9a..3ad0879b00cd 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -2185,7 +2185,7 @@ static void ksz_irq_bus_sync_unlock(struct irq_data *d)
 	struct ksz_device *dev = kirq->dev;
 	int ret;
 
-	ret = ksz_write32(dev, kirq->reg_mask, kirq->masked);
+	ret = ksz_write8(dev, kirq->reg_mask, kirq->masked);
 	if (ret)
 		dev_err(dev->dev, "failed to change IRQ mask\n");
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: dsa: microchip: fix wrong register write when masking interrupt
  2024-05-28 21:35 [PATCH net] net: dsa: microchip: fix wrong register write when masking interrupt Tristram.Ha
@ 2024-05-30  8:56 ` Paolo Abeni
  2024-05-30 23:17   ` Tristram.Ha
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Abeni @ 2024-05-30  8:56 UTC (permalink / raw)
  To: Tristram.Ha, Arun Ramadoss, Woojung Huh, Andrew Lunn,
	Vivien Didelot, Florian Fainelli, Vladimir Oltean
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, UNGLinuxDriver,
	netdev, linux-kernel

On Tue, 2024-05-28 at 14:35 -0700, Tristram.Ha@microchip.com wrote:
> From: Tristram Ha <tristram.ha@microchip.com>
> 
> The initial code used 32-bit register.  After that it was changed to 0x1F
> so it is no longer appropriate to use 32-bit write.

IMHO the above sentence is too much unclear. It sort of implies that
the currently used register is 8 bit wide because such register address
can be represented with 8 bit - which in turn sounds weird or
irrelevant.

I guess some documentation describes register 0x1F, please rephrase the
changelog accordingly.

Thanks,

Paolo


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH net] net: dsa: microchip: fix wrong register write when masking interrupt
  2024-05-30  8:56 ` Paolo Abeni
@ 2024-05-30 23:17   ` Tristram.Ha
  0 siblings, 0 replies; 3+ messages in thread
From: Tristram.Ha @ 2024-05-30 23:17 UTC (permalink / raw)
  To: pabeni
  Cc: davem, edumazet, kuba, UNGLinuxDriver, netdev, linux-kernel,
	Arun.Ramadoss, Woojung.Huh, andrew, vivien.didelot, f.fainelli,
	olteanv

> Subject: Re: [PATCH net] net: dsa: microchip: fix wrong register write when masking
> interrupt
> 
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content
> is safe
> 
> On Tue, 2024-05-28 at 14:35 -0700, Tristram.Ha@microchip.com wrote:
> > From: Tristram Ha <tristram.ha@microchip.com>
> >
> > The initial code used 32-bit register.  After that it was changed to 0x1F
> > so it is no longer appropriate to use 32-bit write.
> 
> IMHO the above sentence is too much unclear. It sort of implies that
> the currently used register is 8 bit wide because such register address
> can be represented with 8 bit - which in turn sounds weird or
> irrelevant.
> 
> I guess some documentation describes register 0x1F, please rephrase the
> changelog accordingly.

I will clarify the comment.
Initially the REG_SW_PORT_INT_MASK__4 is defined as 0x001C in
ksz9477_reg.h and REG_PORT_INT_MASK is defined as 0x#01F.  Because the
global and port interrupt handling is about the same new
REG_SW_PORT_INT_MASK__1 is defined as 0x1F in ksz_common.h.  This works
as only the least significant bits have effect.  As a result the 32-bit
write needs to be changed to 8-bit.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-30 23:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-28 21:35 [PATCH net] net: dsa: microchip: fix wrong register write when masking interrupt Tristram.Ha
2024-05-30  8:56 ` Paolo Abeni
2024-05-30 23:17   ` Tristram.Ha

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®