regmap issue with ranges and noinc read

From: Jean-Baptiste Maneyrol
Date: Fri Apr 03 2020 - 03:46:21 EST


Hello,

I have an issue using regmap noinc read when using ranges.

My device is 8-bits registers and 8-bits values and uses several register banks that you can switch using a bank register available on all banks.
I am configuring regmap with 1 range with window len of 0x100 and using virtual register addresses like 0x0aRR, where a is the bank number and RR register address (0x0032 for register 0x32 in bank 0, and 0x0123 for register 0x23 in bank 1). This is working pretty well so far.

The device has in bank 0 a virtual register for reading a data FIFO, which is larger than a bank (0x800, 2048). When using the regmap_noinc_read API for reading my FIFO, I am limited in size to not overflow the range window len. regmap is checking that and returns EINVAL in this case (check is done inside _regmap_select_page called in _regmap_raw_read). It certainly makes sense when using the standard remap_bulk_read API, but for the noinc_read where we are not reading continuous register this doesn't seem to be relevant. And this prevent the read of the entire FIFO data in this case.

Is there any reason to check the range window len bounds for the noinc_read API or is this a bug?

Thanks for your help.

Best regards,
JB