Re: [PATCH 1/8] regmap: Add generic non-memory mapped register access API

Mark Brown
2011-06-22T19:43:07Z

On Wed, Jun 22, 2011 at 09:20:41PM +0200, Lars-Peter Clausen wrote:

> Well, then the spi regmap driver needs to use read_flag_bit = 7 instead of
> read_flag_bit = 8 and the BUG_ON should also be updated to read_flag_bit >= 8.

Bah, so it should.

> And the current code also disallows to use the first bit as the read_flag. So
> in my opinion using a one-based index here is a good idea.

Disallowing that case was half the intention, the main issue being that
if you're flagging in the bottom bit of the top byte on the bus then
you'll be in the middle of the bitfield used by the register which is
going to confuse things.

If something really needs to use the bottom bit we probably need to add
a second form of mangling which uses the bottom of the register rather
than the top, or allow buses to have bus specific register formatting.

Although come to think of it this doesn't actually help your cases at
all as those are per-device settings and this is a per bus setting so
I'm inclined to just revert back to the original code and say that for a
first pass those devices are being sufficiently odd that we don't
support them, we can add support as an extension later.