Re: [PATCH 01/28] mfd: Add Microchip ZL3073x support

Andy Shevchenko
2025-04-14T14:16:41Z

On Mon, Apr 14, 2025 at 5:13 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Mon, Apr 14, 2025 at 5:10 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > On Mon, Apr 14, 2025 at 5:07 PM Ivan Vecera <ivecera@redhat.com> wrote:
> > > On 14. 04. 25 1:52 odp., Ivan Vecera wrote:

...

> > > Long story short, I have to move virtual range outside real address
> > > range and apply this offset in the driver code.
> > >
> > > Is this correct?
> >
> > Bingo!
> >
> > And for the offsets, you form them as "page number * page offset +
> > offset inside the page".
>
> Note, for easier reference you may still map page 0 to the virtual
> space, but make sure that page 0 (or main page) is available outside
> of the ranges, or i.o.w. ranges do not overlap the main page, even if
> they include page 0.

So, you will have the following layout

0x00 - 0xnn - real registers of page 0.

0x100 - 0xppp -- pages 0 ... N

Register access either direct for when direct is required, or as
0x100 + PageSize * Index + RegOffset

--
With Best Regards,
Andy Shevchenko