提交 d8babb95 编写于 作者: P Pratyush Yadav 提交者: Tom Rini

regmap: Allow devices to specify regmap range start and size in config

Some devices need to calculate the regmap base address at runtime. This
makes it impossible to use device tree to get the regmap base. Instead,
allow devices to specify it in the regmap config. This will create a
regmap with a single range that corresponds to the start and size given
by the driver.
Signed-off-by: NPratyush Yadav <p.yadav@ti.com>
Reviewed-by: NSimon Glass <sjg@chromium.org>
上级 0e01a7c3
......@@ -283,7 +283,11 @@ struct regmap *devm_regmap_init(struct udevice *dev,
if (unlikely(!mapp))
return ERR_PTR(-ENOMEM);
rc = regmap_init_mem(dev_ofnode(dev), mapp);
if (config && config->r_size != 0)
rc = regmap_init_mem_range(dev_ofnode(dev), config->r_start,
config->r_size, mapp);
else
rc = regmap_init_mem(dev_ofnode(dev), mapp);
if (rc)
return ERR_PTR(rc);
......
......@@ -84,10 +84,16 @@ struct regmap_bus;
* REGMAP_SIZE_32 if set to 0.
* @reg_offset_shift Left shift the register offset by this value before
* performing read or write.
* @r_start: If specified, the regmap is created with one range
* which starts at this address, instead of finding the
* start from device tree.
* @r_size: Same as above for the range size
*/
struct regmap_config {
enum regmap_size_t width;
u32 reg_offset_shift;
ulong r_start;
ulong r_size;
};
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册