From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Ahmad Fatoum <ahmad@a3f.at>, barebox@lists.infradead.org
Subject: Re: [PATCH 2/2] fixup! regmap-mmio: Add big endian support
Date: Tue, 31 Mar 2020 09:24:41 +0200 [thread overview]
Message-ID: <d8859ddc-dc49-32f0-f145-fa5abdde66d3@pengutronix.de> (raw)
In-Reply-To: <20200330184641.881248-2-ahmad@a3f.at>
On 3/30/20 8:46 PM, Ahmad Fatoum wrote:
> of_regmap_init_mmio_clk was introduced as to avoid allocating new
> devices for syscon nodes, a device tree node sufficed.
>
> We already have an existing device node though, so let's use that.
s/device node/device object/
> Through this device node, we can access the big-endian and friends
s/device node/device object/
> properties.
(I assume this will be squashed anyway, but to make it a bit clearer)
>
> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> ---
> Hello Sascha,
>
> this is untested on the Layerscape. I just verified it now works on the
> stm32mp and that adding a big-endian there breaks it again.
>
> Feel free to adjust.
> ---
> drivers/base/regmap/regmap-mmio.c | 22 ----------------------
> drivers/mfd/syscon.c | 21 +++++++++++++++++----
> include/regmap.h | 15 ---------------
> 3 files changed, 17 insertions(+), 41 deletions(-)
>
> diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c
> index 9c5a2822a4fe..7ca95d6bea79 100644
> --- a/drivers/base/regmap/regmap-mmio.c
> +++ b/drivers/base/regmap/regmap-mmio.c
> @@ -299,28 +299,6 @@ struct regmap *regmap_init_mmio_clk(struct device_d *dev,
> return regmap_init(dev, ®map_mmio, ctx, config);
> }
>
> -struct regmap *of_regmap_init_mmio_clk(struct device_node *np,
> - const char *clk_id,
> - void __iomem *regs,
> - const struct regmap_config *config)
> -{
> - struct regmap_mmio_context *ctx;
> -
> - ctx = regmap_mmio_gen_context(NULL, regs, config);
> - if (IS_ERR(ctx))
> - return ERR_CAST(ctx);
> -
> - if (clk_id) {
> - ctx->clk = of_clk_get_by_name(np, clk_id);
> - if (IS_ERR(ctx->clk)) {
> - kfree(ctx);
> - return ERR_CAST(ctx->clk);
> - }
> - }
> -
> - return regmap_init(NULL, ®map_mmio, ctx, config);
> -}
> -
> int regmap_mmio_attach_clk(struct regmap *map, struct clk *clk)
> {
> struct regmap_mmio_context *ctx = map->bus_context;
> diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
> index f1e6559d71fa..c9dfb151ee0a 100644
> --- a/drivers/mfd/syscon.c
> +++ b/drivers/mfd/syscon.c
> @@ -27,6 +27,7 @@ static LIST_HEAD(syscon_list);
>
> struct syscon {
> struct device_node *np;
> + struct device_d *dev;
> void __iomem *base;
> struct list_head list;
> struct regmap *regmap;
> @@ -42,6 +43,7 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_clk)
> {
> int ret;
> struct syscon *syscon;
> + struct device_d *dev;
> struct resource res;
>
> if (!of_device_is_compatible(np, "syscon"))
> @@ -55,12 +57,23 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_clk)
> }
>
> syscon->base = IOMEM(res.start);
> - syscon->np = np;
> +
> + for_each_device(dev) {
> + if (np == dev->device_node) {
> + syscon->dev = dev;
> + break;
> + }
> + }
> +
> + if (!syscon->dev) {
> + ret = -ENODEV;
> + goto err_map;
> + }
>
> list_add_tail(&syscon->list, &syscon_list);
>
> - syscon->regmap = of_regmap_init_mmio_clk(np, NULL, syscon->base,
> - &syscon_regmap_config);
> + syscon->regmap = regmap_init_mmio_clk(syscon->dev, NULL, syscon->base,
> + &syscon_regmap_config);
>
> if (check_clk) {
> struct clk *clk = of_clk_get(np, 0);
> @@ -88,7 +101,7 @@ static struct syscon *node_to_syscon(struct device_node *np)
> struct syscon *entry, *syscon = NULL;
>
> list_for_each_entry(entry, &syscon_list, list)
> - if (entry->np == np) {
> + if (entry->dev->device_node == np) {
> syscon = entry;
> break;
> }
> diff --git a/include/regmap.h b/include/regmap.h
> index 139ac33ec3e8..4172c00bd2da 100644
> --- a/include/regmap.h
> +++ b/include/regmap.h
> @@ -61,21 +61,6 @@ struct regmap *regmap_init(struct device_d *dev,
>
> struct clk;
>
> -/**
> - * of_regmap_init_mmio_clk() - Initialise register map with register clock
> - *
> - * @np: Device node that will be interacted with
> - * @clk_id: register clock consumer ID
> - * @regs: Pointer to memory-mapped IO region
> - * @config: Configuration for register map
> - *
> - * The return value will be an ERR_PTR() on error or a valid pointer to
> - * a struct regmap.
> - */
> -struct regmap *of_regmap_init_mmio_clk(struct device_node *np, const char *clk_id,
> - void __iomem *regs,
> - const struct regmap_config *config);
> -
> /**
> * regmap_init_mmio_clk() - Initialise register map with register clock
> *
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2020-03-31 7:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-30 18:46 [PATCH 1/2] " Ahmad Fatoum
2020-03-30 18:46 ` [PATCH 2/2] " Ahmad Fatoum
2020-03-31 7:24 ` Ahmad Fatoum [this message]
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=d8859ddc-dc49-32f0-f145-fa5abdde66d3@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=ahmad@a3f.at \
--cc=barebox@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox