[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <857db988-fd4d-4cac-9774-43161f1f592a@lunn.ch>
Date: Wed, 23 Jul 2025 19:16:01 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Tristram.Ha@...rochip.com
Cc: Woojung Huh <woojung.huh@...rochip.com>,
Vladimir Oltean <olteanv@...il.com>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Maxime Chevallier <maxime.chevallier@...tlin.com>,
Simon Horman <horms@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Marek Vasut <marex@...x.de>, UNGLinuxDriver@...rochip.com,
devicetree@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v5 2/6] net: dsa: microchip: Add KSZ8463 switch
support to KSZ DSA driver
> KSZ8463 switch is a 3-port switch based from KSZ8863. Its major
> difference from other KSZ SPI switches is its register access is not a
> simple continual 8-bit transfer with automatic address increase but uses
> a byte-enable mechanism specifying 8-bit, 16-bit, or 32-bit access. Its
> registers are also defined in 16-bit format because it shares a design
> with a MAC controller using 16-bit access. As a result some common
> register accesses need to be re-arranged. The 64-bit access used by
> other switches needs to be broken into 2 32-bit accesses.
> + if (ksz_is_ksz8463(dev)) {
> + int i;
> +
> + for (i = 0; i < 2; i++)
> + ret = regmap_read(ksz_regmap_32(dev), reg + i * 4,
> + &value[i]);
> + *val = (u64)value[0] << 32 | value[1];
> + return ret;
> + }
> ret = regmap_bulk_read(ksz_regmap_32(dev), reg, value, 2);
This needs a bit more explanation. When i look at
https://elixir.bootlin.com/linux/v6.15.7/source/drivers/base/regmap/regmap.c#L3117
It appears to do something similar, looping over count doing
_regmap_read().
There is also:
https://elixir.bootlin.com/linux/v6.15.7/source/include/linux/regmap.h#L370
* @use_single_read: If set, converts the bulk read operation into a series of
* single read operations. This is useful for a device that
* does not support bulk read.
* @use_single_write: If set, converts the bulk write operation into a series of
* single write operations. This is useful for a device that
* does not support bulk write.
It would be better if regmap_bulk_read() could be made to work, and
hide away the differences, which is what regmap is all about.
Andrew
Powered by blists - more mailing lists