From: Lee Jones <lee.jones@linaro.org>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Arnd Bergmann <arnd@arndb.de>,
linux-kernel@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH] mfd: syscon: set regmap max_register in of_syscon_register
Date: Fri, 29 Jan 2016 11:15:14 +0000 [thread overview]
Message-ID: <20160129111514.GT3368@x1> (raw)
In-Reply-To: <1454060151-15611-1-git-send-email-p.zabel@pengutronix.de>
On Fri, 29 Jan 2016, Philipp Zabel wrote:
> Determine the regmap max_register configuration from the io resource size
> and the reg-io-width device tree property.
>
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> ---
> drivers/mfd/syscon.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
Applied, thanks.
> diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
> index b730071..2f2225e 100644
> --- a/drivers/mfd/syscon.c
> +++ b/drivers/mfd/syscon.c
> @@ -50,6 +50,7 @@ static struct syscon *of_syscon_register(struct device_node *np)
> u32 reg_io_width;
> int ret;
> struct regmap_config syscon_config = syscon_regmap_config;
> + struct resource res;
>
> if (!of_device_is_compatible(np, "syscon"))
> return ERR_PTR(-EINVAL);
> @@ -58,7 +59,12 @@ static struct syscon *of_syscon_register(struct device_node *np)
> if (!syscon)
> return ERR_PTR(-ENOMEM);
>
> - base = of_iomap(np, 0);
> + if (of_address_to_resource(np, 0, &res)) {
> + ret = -ENOMEM;
> + goto err_map;
> + }
> +
> + base = ioremap(res.start, resource_size(&res));
> if (!base) {
> ret = -ENOMEM;
> goto err_map;
> @@ -81,6 +87,7 @@ static struct syscon *of_syscon_register(struct device_node *np)
>
> syscon_config.reg_stride = reg_io_width;
> syscon_config.val_bits = reg_io_width * 8;
> + syscon_config.max_register = resource_size(&res) - reg_io_width;
>
> regmap = regmap_init_mmio(NULL, base, &syscon_config);
> if (IS_ERR(regmap)) {
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
next prev parent reply other threads:[~2016-01-29 11:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-29 9:35 [PATCH] mfd: syscon: set regmap max_register in of_syscon_register Philipp Zabel
2016-01-29 10:08 ` Arnd Bergmann
2016-01-29 11:15 ` Lee Jones [this message]
2016-01-29 16:14 ` kbuild test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160129111514.GT3368@x1 \
--to=lee.jones@linaro.org \
--cc=arnd@arndb.de \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.