[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cc5dd02f-7285-dfcf-76b1-bb258c8029fb@gmail.com>
Date: Wed, 2 Nov 2022 10:15:54 -0700
From: Florian Fainelli <f.fainelli@...il.com>
To: Rakesh Sankaranarayanan <rakesh.sankaranarayanan@...rochip.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: woojung.huh@...rochip.com, UNGLinuxDriver@...rochip.com,
andrew@...n.ch, vivien.didelot@...il.com, olteanv@...il.com,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com
Subject: Re: [PATCH net-next 1/6] net: dsa: microchip: lan937x: add regmap
range validation
On 11/1/22 21:10, Rakesh Sankaranarayanan wrote:
> Add regmap_range and regmap_access_table to define valid
> register range for LAN937x switch family. LAN937x family
> have sku id's LAN9370, LAN9371, LAN9372, LAN9373 and
> LAN9374. regmap_range structure is arranged as Global
> Registers followed by Port Registers but they are distributed
> as Global Registers, T1 PHY Port Registers, Tx PHY Port Registers,
> RGMII Port Registers, SGMII Port Registers. On 16 bit addressing,
> most significant 4 bits are used for representing port number.
> So valid range of two different T1 PHY ports within a sku
> will differ on upper nibble only.
>
> Signed-off-by: Rakesh Sankaranarayanan <rakesh.sankaranarayanan@...rochip.com>
> ---
> drivers/net/dsa/microchip/ksz_common.c | 1760 ++++++++++++++++++++++++
> 1 file changed, 1760 insertions(+)
>
> diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
> index d612181b3226..b0905c5b701d 100644
> --- a/drivers/net/dsa/microchip/ksz_common.c
> +++ b/drivers/net/dsa/microchip/ksz_common.c
> @@ -1030,6 +1030,1756 @@ static const struct regmap_access_table ksz9896_register_set = {
> .n_yes_ranges = ARRAY_SIZE(ksz9896_valid_regs),
> };
>
> +static const struct regmap_range lan9370_valid_regs[] = {
Suggest you employ some macros for generating the valid register ranges
for ports since there is a lot of repetition, and chances are that new
registers may have to be added in the future, or corrected.
Between the fact that regmap makes you pull an entire subsystem into the
kernel image thus adding to code sections, plus these big tables of
register ranges adding to read-only data sections, this really makes me
wonder what benefit there is just to expose a debugfs interface for
dumping registers... value proposition does not seem so great to me.
--
Florian
Powered by blists - more mailing lists