Re: Linux 3.4-rc2 register mapping and paging on I2C device.

dd diasemi
2012-05-04T11:40:21Z

On Fri, May 4, 2012 at 12:33 PM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
>
>> Below you can find my proposition of API for regmap paging support. It
>> is sufficient for my driver needs.
>> If you are OK with this proposition or you find any issues with it, let me know.
>
> Please submit an actual patch, this needs to be supported by things like
> the cache infrastructure as well.  One thing that's not obvious with
> just this is how things like register defaults and iterating all the
> known registers will work.
>
>> +config REGMAP_PAGING
>> +       bool
>
> No, this needs to work with both paged and non-paged devices.

Proposed implementation will extend virtually register range by number
of bits defined in .page_bits.
For example, for SPI register range 0 - 0x7F and 4 pages, we have
.page_bits = 2 and we define register mapping for range 0 - 0x1FF.
If .page_bits is not set and equal to 0, register range is going to be
defined as 0 - 0x7F and register mapping will work standard
(unchanged) way.

I plan to manage paging after caching and before actual address
formatting and bus write. The intention is to make register paging
transparent to regmap user and therefore it should cover situation,
when page boundaries are crossed by bulk read / write.
Proposed config flag - REGMAP_PAGING is here only to optimize kernel
compilation in case, when no drivers actually uses paging feature.

If you are asking about the details, I guess, comments may need to
improvement anyway to give a clearer view, how the API could be used,
right?

Kind Regards,
Krystian