[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <adcd5997-84ee-4c72-aa37-2940afdc83bd@sirena.org.uk>
Date: Mon, 17 Jun 2024 18:22:20 +0100
From: Mark Brown <broonie@...nel.org>
To: Guenter Roeck <linux@...ck-us.net>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org, Armin Wolf <W_Armin@....de>
Subject: Re: Page select register restrictions in regmap core
On Mon, Jun 17, 2024 at 09:59:50AM -0700, Guenter Roeck wrote:
> On Mon, Jun 17, 2024 at 04:08:08PM +0100, Mark Brown wrote:
> > You appear to be trying to define ranges that overlap with the windows
> > that you're trying to expose. I can't understand what that's trying to
> > represent or how that would work. The window is the physical registers
> > that the host can actually see, the range is the virtual addresses which
> > users of the region should use to access registers behind the window.
> > This should be a range of register values which don't physically exist
> > on the device. I really can't understand what a sensible handling of an
> Can you point me to an example ? All examples I can find have overlapping
> values for .range_min/.range_max and .window_start/.window_len, and pretty
> much all of them start range_min with 0.
sound/soc/codecs/wm2200.c. I do see a bunch of bad examples now I grep,
bluntly I'm astonished any of them do anything useful and wonder if
anyone has even run the code.
> > overlap would be, any attempt to access the window should recursively
> > trigger selection of the range so no actual register should work. I
> > can't tell what it's trying to model.
> page 0: 0x00-0x7f Volatile registers, page selector at 0x0b
> 0x80-0xff page 0 of non-volatile memory
> page 1: 0x0b page selector register <-- this is what trips the check
> 0x80-0xff page 1 of non-volatile memory
> ...
> page 7: 0x0b page selector register
> 0x80-0xff page 7 of non-volatile memory
So you've got two windows from 0-0x7f and 0x80-0xff which share a
selector register because of course that makes sense, the selector is
placed inside one of the ranges. That's all perfectly fine, modulo the
multi-use selector register the hardware seems fine. What I don't
understand is what the attempt to put the window on top of this is
supposed to mean.
> > This configuration would also be rejected by the next test which
> > verifies that the window does not overlap with the range.
> No, it isn't. The windows in the two ranges don't overlap, and neither
> do the ranges. The only overlap is the selector register. The check you
> refer to explicitly does not apply to a single range.
Ugh, it should - like I say these configurations are just incoherent
nonsense.
> Pretty much all drivers I looked at start the range with 0, having
> the selector register within the range is explicitly accepted by the
> regmap code, and pretty much all drivers using regmap for page
> selection do that. The difference here is that the page selector
> register is in the first range and visible from all pages, but the
> other volatile registers are only visible in page 0.
Having the page selector register be inside the page is pretty common.
> Yes, I would agree that this doesn't make much sense, but it is what
> the spd5118 standard calls for, and at least the Renesas/IDT spd5188
> chip implements it that way.
The range is *entirely* defined within the driver, it is 100% a software
construct, the hardware only influences our choice of range in that we
can't place it on top of hardware registers.
> Anyway, how should I model this ?
To repeat:
> > Like I say I can't tell what this is trying to describe or how it could
> > possibly work. The range should be completely distinct from the window.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists