linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Michel Pollet <michel.pollet@bp.renesas.com>
Cc: Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	Simon Horman <horms@verge.net.au>,
	Phil Edworthy <phil.edworthy@renesas.com>,
	Magnus Damm <magnus.damm@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Lee Jones <lee.jones@linaro.org>,
	Russell King <linux@armlinux.org.uk>,
	Sebastian Reichel <sre@kernel.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
	<devicetree@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Linux PM list <linux-pm@vger.kernel.org>
Subject: Re: [PATCH v2 4/8] reset: Renesas RZ/N1 reboot driver
Date: Thu, 22 Mar 2018 13:48:14 +0100	[thread overview]
Message-ID: <CAMuHMdUbSfQAf9cRAiLg3ZuVwdSoAGOFwiqyv-28SW5d0fOr3w@mail.gmail.com> (raw)
In-Reply-To: <1521719091-25157-5-git-send-email-michel.pollet@bp.renesas.com>

Hi Michel,

On Thu, Mar 22, 2018 at 12:44 PM, Michel Pollet
<michel.pollet@bp.renesas.com> wrote:
> The Renesas RZ/N1 Family (Part #R9A06G0xx) needs a small driver
> to reboot the Cortex-A7 cores. This driver is a sub driver of
> the sysctrl MFD.
>
> Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>

Thanks for your patch!

> --- /dev/null
> +++ b/drivers/power/reset/rzn1-reboot.c
> @@ -0,0 +1,109 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * RZ/N1 reboot driver
> + *
> + * Copyright (C) 2018 Renesas Electronics Europe Limited
> + *
> + * Michel Pollet <michel.pollet@bp.renesas.com>, <buserror@gmail.com>
> + * Derived from zx-reboot.c
> + */
> +
> +#include <linux/delay.h>
> +#include <linux/io.h>
> +#include <linux/mfd/syscon.h>
> +#include <linux/module.h>
> +#include <linux/notifier.h>
> +#include <linux/of_address.h>

I don't think you need <linux/of_address.h>.

> +#include <linux/platform_device.h>
> +#include <linux/reboot.h>
> +#include <linux/regmap.h>
> +
> +/* Definitions from the SDK rzn1-sysctrl.h autogenerated file */
> +#define RZN1_SYSCTRL_REG_RSTEN                 0x120
> +#define RZN1_SYSCTRL_REG_RSTEN_MRESET_EN               0
> +#define RZN1_SYSCTRL_REG_RSTEN_WDA7RST_EN              1
> +#define RZN1_SYSCTRL_REG_RSTEN_WDA7RST_EN_MASK         0x6
> +#define RZN1_SYSCTRL_REG_RSTEN_WDM3RST_EN              3
> +#define RZN1_SYSCTRL_REG_RSTEN_CM3LOCKUPRST_EN         4
> +#define RZN1_SYSCTRL_REG_RSTEN_CM3SYSRESET_EN          5
> +#define RZN1_SYSCTRL_REG_RSTEN_SWRST_EN                        6
> +#define RZN1_SYSCTRL_REG_RSTCTRL               0x198
> +#define RZN1_SYSCTRL_REG_RSTCTRL_WDA7RST_REQ           1
> +#define RZN1_SYSCTRL_REG_RSTCTRL_WDA7RST_REQ_MASK      0x6
> +#define RZN1_SYSCTRL_REG_RSTCTRL_WDM3RST_REQ           3
> +#define RZN1_SYSCTRL_REG_RSTCTRL_CM3LOCKUPRST_REQ      4
> +#define RZN1_SYSCTRL_REG_RSTCTRL_CM3SYSRESET_REQ       5
> +#define RZN1_SYSCTRL_REG_RSTCTRL_SWRST_REQ             6
> +
> +
> +static struct regmap *_sysctrl;

Variable names starting with an underscore are frowned upon.

> +static int rzn1_reboot_probe(struct platform_device *pdev)
> +{
> +       int err;
> +       struct device *parent;
> +
> +       parent = pdev->dev.parent;
> +       if (parent && parent->of_node) {
> +               _sysctrl = syscon_node_to_regmap(parent->of_node);
> +       } else {
> +               dev_err(&pdev->dev, "couldn't find sysctrl node\n");
> +               return -ENODEV;
> +       }

if (!parent || !parent->of_node) {
        dev_err(&pdev->dev, "couldn't find sysctrl node\n");
        return -ENODEV;
}
_sysctrl = syscon_node_to_regmap(parent->of_node);

> +       if (IS_ERR(_sysctrl)) {
> +               dev_err(&pdev->dev, "couldn't find find regmap\n");
> +               return PTR_ERR(_sysctrl);
> +       }
> +       err = register_restart_handler(&rzn1_reboot_nb);
> +       if (err) {
> +               dev_err(&pdev->dev, "register restart handler failed(err=%d)\n",
> +                       err);
> +       }
> +
> +       return err;
> +}
> +
> +static const struct of_device_id rzn1_reboot_of_match[] = {
> +       { .compatible = "renesas,r9a06g032-reboot" },
> +       { .compatible = "renesas,rzn1-reboot" },

Matching against the second (family-specific) compatible value should
be sufficient.

> +       {}
> +};
> +MODULE_DEVICE_TABLE(of, rzn1_reboot_of_match);

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2018-03-22 12:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-22 11:44 [PATCH v2 0/8] arm: Base support for Renesas RZN1D-DB Board Michel Pollet
2018-03-22 11:44 ` [PATCH v2 1/8] DT: mfd: renesas,rzn1-sysctrl: document RZ/N1 sysctrl node Michel Pollet
2018-03-22 12:29   ` Geert Uytterhoeven
2018-03-22 11:44 ` [PATCH v2 2/8] DT: reset: renesas,rzn1-reboot: document RZ/N1 reboot driver Michel Pollet
2018-03-22 12:30   ` Geert Uytterhoeven
2018-03-22 11:44 ` [PATCH v2 3/8] DT: arm: renesas,r9a06g032: add the RZ/N1 bindings Michel Pollet
2018-03-22 12:37   ` Geert Uytterhoeven
2018-03-28  7:44     ` Michel Pollet
2018-03-22 11:44 ` [PATCH v2 4/8] reset: Renesas RZ/N1 reboot driver Michel Pollet
2018-03-22 12:48   ` Geert Uytterhoeven [this message]
2018-03-22 11:44 ` [PATCH v2 5/8] arm: rzn1: Add the RZ/N1 arch to the shmobile Kconfig Michel Pollet
2018-03-22 12:49   ` Geert Uytterhoeven
2018-03-22 11:44 ` [PATCH v2 6/8] DT: arm: Add Renesas RZ/N1 SoC base device tree file Michel Pollet
2018-03-22 12:49   ` Geert Uytterhoeven
2018-03-22 11:44 ` [PATCH v2 7/8] DT: arm: Add Renesas RZN1D-DB Board base file Michel Pollet
2018-03-22 12:51   ` Geert Uytterhoeven
2018-03-22 11:44 ` [PATCH v2 8/8] DT: arm: Add the RZN1D-DB Board to Renesas Makefile target Michel Pollet
2018-03-22 12:51   ` Geert Uytterhoeven
2018-03-28  8:00 ` [PATCH v2 0/8] arm: Base support for Renesas RZN1D-DB Board Michel Pollet

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=CAMuHMdUbSfQAf9cRAiLg3ZuVwdSoAGOFwiqyv-28SW5d0fOr3w@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=devicetree@vger.kernel.org \
    --cc=horms@verge.net.au \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=magnus.damm@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=michel.pollet@bp.renesas.com \
    --cc=phil.edworthy@renesas.com \
    --cc=robh+dt@kernel.org \
    --cc=sre@kernel.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).