[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <MN2PR11MB3678CF331310105FA5916A56ECA00@MN2PR11MB3678.namprd11.prod.outlook.com>
Date: Tue, 27 Aug 2019 21:03:27 +0000
From: <Tristram.Ha@...rochip.com>
To: <Razvan.Stefanescu@...rochip.com>
CC: <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<Razvan.Stefanescu@...rochip.com>, <Woojung.Huh@...rochip.com>,
<vivien.didelot@...il.com>, <UNGLinuxDriver@...rochip.com>,
<andrew@...n.ch>, <f.fainelli@...il.com>, <davem@...emloft.net>
Subject: RE: [PATCH 4/4] net: dsa: microchip: avoid hard-codded port count
> Subject: [PATCH 4/4] net: dsa: microchip: avoid hard-codded port count
>
> Use port_cnt value to disable interrupts on switch reset.
>
> Signed-off-by: Razvan Stefanescu <razvan.stefanescu@...rochip.com>
> ---
> drivers/net/dsa/microchip/ksz9477.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/dsa/microchip/ksz9477.c
> b/drivers/net/dsa/microchip/ksz9477.c
> index 187be42de5f1..54fc05595d48 100644
> --- a/drivers/net/dsa/microchip/ksz9477.c
> +++ b/drivers/net/dsa/microchip/ksz9477.c
> @@ -213,7 +213,7 @@ static int ksz9477_reset_switch(struct ksz_device
> *dev)
>
> /* disable interrupts */
> ksz_write32(dev, REG_SW_INT_MASK__4, SWITCH_INT_MASK);
> - ksz_write32(dev, REG_SW_PORT_INT_MASK__4, 0x7F);
> + ksz_write32(dev, REG_SW_PORT_INT_MASK__4, dev->port_cnt);
> ksz_read32(dev, REG_SW_PORT_INT_STATUS__4, &data32);
>
> /* set broadcast storm protection 10% rate */
The register value is a portmap, so using port_cnt may be wrong.
The chip is a 7-port switch. There is a 6-port variant, but it is okay to write 0x7F.
There is also a 3-port variant which uses a different design. It is a bit of stretch to use 0x7F on it.
It is more a code readability or correctness than incorrect hardware operation.
Powered by blists - more mailing lists