Subject: Re: [PATCH v15 mfd 9/9] mfd: ocelot: add support for the vsc7512 chip via spi

From: Colin Foster <[email-masked]>
Date: Wed, 3 Aug 2022 10:31:19 -0700

On Wed, Aug 03, 2022 at 07:10:38PM +0200, Andy Shevchenko wrote:
> On Wed, Aug 3, 2022 at 5:56 PM Colin Foster
> <[email-masked]> wrote:
> > On Wed, Aug 03, 2022 at 01:45:04PM +0200, Andy Shevchenko wrote:
> > > On Wed, Aug 3, 2022 at 7:48 AM Colin Foster
> > > <[email-masked]> wrote:
> 
> ...
> 
> > > > +       regmap_config.max_register = res->end - res->start;
> > >
> > > Hmm... First of all, resource_size() is for that (with - 1 to the
> > > result). But don't you need to use stride in the calculations?
> >
> > DEFINE_RES_NAMED populates the resource .end with (_start) + (_size) - 1
> > so I don't think resource_size is correct to use here.
> 
> Have you read what I put in parentheses? Basically it becomes very
> well the same as a result, but in a cleaner manner (you calculate
> resource size - 1 which will be exactly the last byte offset of the
> register file), no?

Ahh... I see your point. I agree with your suggestion and will clean it
up.

> 
> > reg_stride gets handled at the top of regmap_read(), so I don't think
> > that's really needed either.
> 
> Okay.
> 
> > For reference:
> >
> > #define VSC7512_DEVCPU_ORG_RES_START    0x71000000
> > #define VSC7512_DEVCPU_ORG_RES_SIZE     0x38
> 
> Right, for 0x38 you supply 0x37, which is exactly resource_size() - 1.
> 
> > # cat range
> > 0-34
> 
> -- 
> With Best Regards,
> Andy Shevchenko