[U-Boot] [PATCH] regmap: Separate memory-based operations
Simon Glass
sjg at chromium.org
Fri May 25 02:42:28 UTC 2018
Hi Alexey,
On 24 May 2018 at 06:36, Alexey Brodkin <Alexey.Brodkin at synopsys.com> wrote:
> One of important features of regmap [at least in Linux kernel]
> is an ability to seamlessly communicate to devices connected
> via different buses like: MMIO, SPI, I2C and many others.
>
> Current implementation in U-Boot only supports memory-mapped registers
> which is a vere valid case but we'll need more in the future.
>
> This change paves the way for support of other buses. Still all existing
> users of regmap in U-Boot shouldn't be affected because for now we don't
> change API which might be required once we start adding support of more
> complicated cases like 8/16/32/64-bit accessors, big- and little-endian
> flavours etc.
>
> It was inspired by discussion [1] of addition of even more accessors to
> a standard 16550 UART.
>
> [1] https://lists.denx.de/pipermail/u-boot/2018-March/322322.html
>
> Signed-off-by: Alexey Brodkin <abrodkin at synopsys.com>
> Cc: Simon Glass <sjg at chromium.org>
> ---
> drivers/core/Makefile | 2 +-
> drivers/core/{regmap.c => regmap-mem.c} | 79 ++++++-----------------
> drivers/core/regmap.c | 85 +------------------------
> include/regmap.h | 9 +++
> 4 files changed, 31 insertions(+), 144 deletions(-)
> copy drivers/core/{regmap.c => regmap-mem.c} (60%)
>
Are there any changes needed to the regmap test with this?
[..]
> diff --git a/include/regmap.h b/include/regmap.h
> index 493a5d8eff84..f01c5733afac 100644
> --- a/include/regmap.h
> +++ b/include/regmap.h
> @@ -31,6 +31,8 @@ struct regmap {
> phys_addr_t base;
> int range_count;
> struct regmap_range *range, base_range;
> + int (*reg_read)(struct regmap *map, uint reg, uint *val);
> + int (*reg_write)(struct regmap *map, uint reg, uint val);
Can we use driver model for these somehow? E.g. we could create a
UCLASS_SIMPLE_REG driver for each of memory, i2c, SPI, etc.
When we want to use a particular I2C bus via regmap, we could bind the
I2C -> regmap driver as a child of the I2C bus driver.
Regards,
Simon
More information about the U-Boot
mailing list