From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Simon Horman <horms@verge.net.au>,
Magnus Damm <magnus.damm@gmail.com>,
Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@codeaurora.org>,
Dirk Behme <dirk.behme@de.bosch.com>,
linux-renesas-soc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org
Subject: Re: [PATCH/RFC v3 02/22] soc: renesas: Add R-Car RST driver
Date: Fri, 03 Jun 2016 00:58:53 +0300 [thread overview]
Message-ID: <6849015.bJCuAeaMgZ@avalon> (raw)
In-Reply-To: <1464808880-343-3-git-send-email-geert+renesas@glider.be>
Hi Geert,
Thank you for the patch.
On Wednesday 01 Jun 2016 21:21:00 Geert Uytterhoeven wrote:
> Add a driver for the Renesas R-Car Gen1 RESET/WDT and R-Car Gen2/Gen3
> RST module.
>
> For now this driver just provides an API to obtain the state of the mode
> pins, as latched at reset time. As this is typically called from the
> probe function of a clock driver, which can run much earlier than any
> initcall, calling rcar_rst_read_mode_pins() may force an early
> initialization of the driver.
>
> Despite the current simple and almost identical handling for all
> supported SoCs, the driver matches against SoC-specific compatible
> values only, as the features provided by the hardware module differ a
> lot across the various SoC families and members.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> v3:
> - New.
> ---
> drivers/soc/renesas/Makefile | 5 ++
> drivers/soc/renesas/rcar-rst.c | 94 +++++++++++++++++++++++++++++++++
> include/linux/soc/renesas/rcar-rst.h | 6 +++
> 3 files changed, 105 insertions(+)
> create mode 100644 drivers/soc/renesas/rcar-rst.c
> create mode 100644 include/linux/soc/renesas/rcar-rst.h
>
> diff --git a/drivers/soc/renesas/Makefile b/drivers/soc/renesas/Makefile
> index f32a001c65c3ab44..0d732ff893dd8fba 100644
> --- a/drivers/soc/renesas/Makefile
> +++ b/drivers/soc/renesas/Makefile
> @@ -1,3 +1,8 @@
> +obj-$(CONFIG_ARCH_RCAR_GEN1) += rcar-rst.o
> +obj-$(CONFIG_ARCH_RCAR_GEN2) += rcar-rst.o
> +obj-$(CONFIG_ARCH_R8A7795) += rcar-rst.o
> +obj-$(CONFIG_ARCH_R8A7796) += rcar-rst.o
> +
> obj-$(CONFIG_ARCH_R8A7779) += rcar-sysc.o r8a7779-sysc.o
> obj-$(CONFIG_ARCH_R8A7790) += rcar-sysc.o r8a7790-sysc.o
> obj-$(CONFIG_ARCH_R8A7791) += rcar-sysc.o r8a7791-sysc.o
> diff --git a/drivers/soc/renesas/rcar-rst.c b/drivers/soc/renesas/rcar-rst.c
> new file mode 100644
> index 0000000000000000..1997c348c0853254
> --- /dev/null
> +++ b/drivers/soc/renesas/rcar-rst.c
> @@ -0,0 +1,94 @@
> +/*
> + * R-Car Gen1 RESET/WDT and R-Car Gen2/Gen3 RST Driver
> + *
> + * Copyright (C) 2016 Glider bvba
> + *
> + * This file is subject to the terms and conditions of the GNU General
> Public
> + * License. See the file "COPYING" in the main directory of this archive
> + * for more details.
> + */
> +
> +#include <linux/err.h>
> +#include <linux/io.h>
> +#include <linux/of_address.h>
> +#include <linux/soc/renesas/rcar-rst.h>
> +
> +struct rst_config {
> + unsigned int modemr; /* Mode Monitoring Register Offset */
> +};
> +
> +static const struct rst_config rcar_rst_gen1 __initconst = {
> + .modemr = 0x20,
> +};
> +
> +static const struct rst_config rcar_rst_gen2 __initconst = {
> + .modemr = 0x60,
> +};
> +
> +static const struct rst_config rcar_rst_gen3 __initconst = {
> + .modemr = 0x60,
> +};
> +
> +static const struct of_device_id rcar_rst_matches[] __initconst = {
> + { .compatible = "renesas,r8a7778-reset-wdt", .data = &rcar_rst_gen1 },
> + { .compatible = "renesas,r8a7779-reset-wdt", .data = &rcar_rst_gen1 },
> + { .compatible = "renesas,r8a7790-rst", .data = &rcar_rst_gen2 },
> + { .compatible = "renesas,r8a7791-rst", .data = &rcar_rst_gen2 },
> + { .compatible = "renesas,r8a7792-rst", .data = &rcar_rst_gen2 },
> + { .compatible = "renesas,r8a7793-rst", .data = &rcar_rst_gen2 },
> + { .compatible = "renesas,r8a7794-rst", .data = &rcar_rst_gen2 },
> + { .compatible = "renesas,r8a7795-rst", .data = &rcar_rst_gen3 },
> + { .compatible = "renesas,r8a7796-rst", .data = &rcar_rst_gen3 },
> + { /* sentinel */ }
> +};
> +
> +static void __iomem *rcar_rst_base __initdata;
> +static u32 saved_mode __initdata;
> +
> +static int __init rcar_rst_init(void)
> +{
> + const struct of_device_id *match;
> + const struct rst_config *cfg;
> + struct device_node *np;
> + void __iomem *base;
> + int error = 0;
> +
> + if (rcar_rst_base)
> + return 0;
> +
> + np = of_find_matching_node_and_match(NULL, rcar_rst_matches, &match);
> + if (!np)
> + return -ENODEV;
> +
> + base = of_iomap(np, 0);
> + if (!base) {
> + pr_warn("%s: Cannot map regs\n", np->full_name);
> + error = -ENOMEM;
> + goto out_put;
> + }
> +
> + rcar_rst_base = base;
> + cfg = match->data;
> + saved_mode = ioread32(base + cfg->modemr);
> +
> + pr_debug("%s: MODE = 0x%08x\n", np->full_name, saved_mode);
> +
> +out_put:
> + of_node_put(np);
> + return error;
> +}
> +arch_initcall(rcar_rst_init);
Given that rcar_rst_init() is only used as a support function for
rcar_rst_read_mode_pins(), how about removing the initcall ?
> +int __init rcar_rst_read_mode_pins(u32 *mode)
> +{
> + int error;
> +
> + if (!rcar_rst_base) {
> + error = rcar_rst_init();
> + if (error)
> + return error;
> + }
> +
> + *mode = saved_mode;
> + return 0;
> +}
> diff --git a/include/linux/soc/renesas/rcar-rst.h
> b/include/linux/soc/renesas/rcar-rst.h new file mode 100644
> index 0000000000000000..a18e0783946b66ec
> --- /dev/null
> +++ b/include/linux/soc/renesas/rcar-rst.h
> @@ -0,0 +1,6 @@
> +#ifndef __LINUX_SOC_RENESAS_RCAR_RST_H__
> +#define __LINUX_SOC_RENESAS_RCAR_RST_H__
> +
> +int rcar_rst_read_mode_pins(u32 *mode);
> +
> +#endif /* __LINUX_SOC_RENESAS_RCAR_RST_H__ */
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2016-06-02 21:58 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-01 19:20 [PATCH/RFC v3 00/22] soc: renesas: Add R-Car RST driver for obtaining mode pin state Geert Uytterhoeven
2016-06-01 19:20 ` [PATCH/RFC v3 01/22] reset: Add renesas,rst DT bindings Geert Uytterhoeven
2016-06-02 5:40 ` Dirk Behme
2016-06-02 21:47 ` Laurent Pinchart
2016-06-10 7:52 ` Geert Uytterhoeven
2016-06-01 19:21 ` [PATCH/RFC v3 02/22] soc: renesas: Add R-Car RST driver Geert Uytterhoeven
2016-06-02 5:42 ` Dirk Behme
2016-06-10 7:58 ` Geert Uytterhoeven
2016-06-10 8:38 ` Dirk Behme
2016-06-10 13:08 ` Laurent Pinchart
2016-06-02 21:58 ` Laurent Pinchart [this message]
2016-06-10 7:54 ` Geert Uytterhoeven
2016-06-01 19:21 ` [PATCH/RFC v3 05/22] ARM: dts: r8a7790: Add device node for RST module Geert Uytterhoeven
2016-06-01 19:21 ` [PATCH/RFC v3 06/22] ARM: dts: r8a7791: " Geert Uytterhoeven
2016-06-01 19:21 ` [PATCH/RFC v3 07/22] ARM: dts: r8a7793: " Geert Uytterhoeven
2016-06-01 19:21 ` [PATCH/RFC v3 08/22] ARM: dts: r8a7794: " Geert Uytterhoeven
2016-06-01 19:21 ` [PATCH/RFC v3 09/22] arm64: renesas: r8a7795 dtsi: " Geert Uytterhoeven
2016-06-01 19:21 ` [PATCH/RFC v3 10/22] arm64: renesas: r8a7796 " Geert Uytterhoeven
2016-06-01 19:21 ` [PATCH/RFC v3 13/22] clk: renesas: rcar-gen2: Obtain mode pin values using RST driver Geert Uytterhoeven
2016-06-01 19:21 ` [PATCH/RFC v3 14/22] clk: renesas: r8a7795: Obtain mode pin values from R-Car " Geert Uytterhoeven
2016-06-02 22:01 ` Laurent Pinchart
2016-06-01 19:21 ` [PATCH/RFC v3 15/22] clk: renesas: r8a7796: " Geert Uytterhoeven
2016-06-02 22:02 ` Laurent Pinchart
2016-06-01 19:21 ` [PATCH/RFC v3 17/22] ARM: shmobile: r8a7778: Stop passing mode pins state to clock driver Geert Uytterhoeven
2016-06-01 19:21 ` [PATCH/RFC v3 18/22] ARM: shmobile: r8a7779: " Geert Uytterhoeven
2016-06-01 19:21 ` [PATCH/RFC v3 19/22] ARM: shmobile: rcar-gen2: " Geert Uytterhoeven
2016-06-01 19:21 ` [PATCH/RFC v3 20/22] clk: renesas: r8a7778: Remove obsolete r8a7778_clocks_init() Geert Uytterhoeven
2016-06-02 5:54 ` Dirk Behme
2016-06-02 7:13 ` Geert Uytterhoeven
[not found] ` <1464808880-343-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
2016-06-01 19:21 ` [PATCH/RFC v3 03/22] ARM: dts: r8a7778: Add device node for RESET/WDT module Geert Uytterhoeven
2016-06-01 19:21 ` [PATCH/RFC v3 04/22] ARM: dts: r8a7779: " Geert Uytterhoeven
2016-06-01 19:21 ` [PATCH/RFC v3 11/22] clk: renesas: r8a7778: Obtain mode pin values using R-Car RST driver Geert Uytterhoeven
2016-06-01 19:21 ` [PATCH/RFC v3 12/22] clk: renesas: r8a7779: Obtain mode pin values from " Geert Uytterhoeven
2016-06-01 19:21 ` [PATCH/RFC v3 16/22] clk: renesas: rcar-gen3-cpg: Remove obsolete rcar_gen3_read_mode_pins() Geert Uytterhoeven
[not found] ` <1464808880-343-17-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
2016-06-02 22:02 ` Laurent Pinchart
2016-06-01 19:21 ` [PATCH/RFC v3 21/22] clk: renesas: r8a7779: Remove obsolete r8a7779_clocks_init() Geert Uytterhoeven
2016-06-01 19:21 ` [PATCH/RFC v3 22/22] clk: renesas: rcar-gen2: Remove obsolete rcar_gen2_clocks_init() Geert Uytterhoeven
2016-06-02 5:57 ` [PATCH/RFC v3 00/22] soc: renesas: Add R-Car RST driver for obtaining mode pin state Dirk Behme
2016-06-30 20:14 ` Stephen Boyd
2016-09-01 11:46 ` Geert Uytterhoeven
2016-09-12 22:16 ` Stephen Boyd
2016-09-13 6:48 ` Geert Uytterhoeven
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=6849015.bJCuAeaMgZ@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=devicetree@vger.kernel.org \
--cc=dirk.behme@de.bosch.com \
--cc=geert+renesas@glider.be \
--cc=horms@verge.net.au \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=mturquette@baylibre.com \
--cc=p.zabel@pengutronix.de \
--cc=sboyd@codeaurora.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;
as well as URLs for NNTP newsgroup(s).