Re: [PATCH v4 09/16] reset: starfive-jh7100: Add StarFive JH7100 reset driver

Andy Shevchenko
2021-11-16T16:21:58Z

On Tue, Nov 16, 2021 at 6:06 PM Emil Renner Berthing <kernel@esmil.dk> wrote:
> On Tue, 16 Nov 2021 at 17:01, Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> > On Tue, Nov 16, 2021 at 5:06 PM Emil Renner Berthing <kernel@esmil.dk> wrote:

...

> > > +#if BITS_PER_LONG == 64
> > > +#define jh7100_reset_read readq
> > > +#define jh7100_reset_write writeq
> > > +#else
> > > +#define jh7100_reset_read readl
> > > +#define jh7100_reset_write writel
> > > +#endif
> >
> > No need, just use always readq() / writeq() and include io-64-nonatomic-lo-hi
>
> Hmm.. how would that work on a 32bit architecture where sizeof(long)
> == 4? The whole point of this is to read chunks in sizes matching the
> words in the bitmap later on.

Why not? You just put some amendments, see below an example.

...

> > > + void __iomem *reg_assert = data->base + JH7100_RESET_ASSERT0 + offset * sizeof(long);
> > > + void __iomem *reg_status = data->base + JH7100_RESET_STATUS0 + offset * sizeof(long);
> > > + unsigned long value;

void __iomem *reg_assert = data->base + JH7100_RESET_ASSERT0 + off64;
void __iomem *reg_status = data->base + JH7100_RESET_STATUS0 + off64;
u64 value;

> > > + value = jh7100_reset_read(reg_assert);
> > > + if (assert)
> > > + value |= mask;
> > > + else
> > > + value &= ~mask;
> > > + jh7100_reset_write(value, reg_assert);

value = readq(...);
...update...
writeq(value, ...);

> > > + /* if the associated clock is gated, deasserting might otherwise hang forever */
> > > + ret = readx_poll_timeout_atomic(jh7100_reset_read, reg_status, value,
> > > + (value & mask) == done, 0, 1000);

readq_poll_timeout_atomic()

Maybe at the end of the day simple use of u64 will be better than bitmap.
Up to you, you have got the idea. Either way you may put my tag.

--
With Best Regards,
Andy Shevchenko