Re: [PATCH] tty: max310x: work around regmap->regcache data corruption

From: Hugo Villeneuve
Date: Mon Dec 04 2023 - 15:02:34 EST


On Mon, 4 Dec 2023 19:48:05 +0000
Mark Brown <broonie@xxxxxxxxxx> wrote:

> On Mon, Dec 04, 2023 at 02:41:36PM -0500, Hugo Villeneuve wrote:
>
> > But that is not was my question was about. Here a pseudo code
> > example to select "page" 1:
>
> > 1. save original value of LCR register.
> > 2. write 0xBF to LCR register
> > 3. access desired register in page 1
> > 4. restore original LCR value saved in step 1
>
> > How do you do that with regmap range?
>
> Are you saying that the selector has other, non-selector functions?

Yes! There is no bit or bit range in that register that is used to
select a praticular set of registers or "page". It is only when
writing the special magic value of $BF that the IC switches to "page"
1. And if the value is NOT $BF, then it switches back to "page" 0.

When I told you if you could point to other IC/drivers that had the
same configuration, I tough you were aware of this. That explains some
of the confusion.

> This is truly innovative hardware,...

Well, I would not say innovative, but more "crappy" hardware design :)

> ...generally the selector is just a
> bitfield that you write paging values to.

This is also what I am accustomed to normally.

> You'd need to extend the core
> so that it knows about this quirk, right now that's not possible and
> we'll just leave the window pointing at whatever was last accessed.

Ok. I am not sure that adding support for it would make sense, since I
do not know of other ICs that could reuse this very specific and
particular method for switching "paged" registers.

Thank you,
Hugo Villeneuve