lkml.org 
[lkml]   [2022]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH net-next 1/6] net: dsa: microchip: lan937x: add regmap range validation
Date
On Wed, 2022-11-02 at 10:15 -0700, Florian Fainelli wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
>
> 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@microchip.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
>

Thanks for the comment, Florian.

Changes added to have register range validation for lan937x series, I
tried adding common MACRO's instead of individual tables. It will
reduce lines of code and make it easier for any future modifications.
But anyway, finally it is going to expand as individual tables.
Considering this, I will remove this patch from series from next
revision.

But out of curiosity, I have seen usage of regmap_range tables in
kernel for the register range validation. Do you think that, is it
really required to have this check? or any other better approach?

Thanks,
Rakesh S

\
 
 \ /
  Last update: 2022-11-03 09:46    [W:0.059 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site