public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	linux-leds@vger.kernel.org, linux-pm@vger.kernel.org,
	Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Will Deacon <will.deacon@arm.com>, Rob Herring <robh@kernel.org>,
	Sebastian Reichel <sre@kernel.org>,
	Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH 3/8 v2] power: reset: driver for the Versatile syscon reboot
Date: Tue, 02 Sep 2014 14:32:23 +0200	[thread overview]
Message-ID: <3488091.4DXvj6mC51@wuerfel> (raw)
In-Reply-To: <1409659354-23553-4-git-send-email-linus.walleij@linaro.org>

On Tuesday 02 September 2014 14:02:29 Linus Walleij wrote:
> +enum versatile_reboot {
> +       REALVIEW_REBOOT_EB,
> +       REALVIEW_REBOOT_PB1176,
> +       REALVIEW_REBOOT_PB11MP,
> +       REALVIEW_REBOOT_PBA8,
> +       REALVIEW_REBOOT_PBX,
> +};
> +static const struct of_device_id versatile_reboot_of_match[] = {
> +       {
> +               .compatible = "arm,realview-eb-syscon",
> +               .data = (void *)REALVIEW_REBOOT_EB,
> +       },
...
> +};
> +
> +static void versatile_reboot(enum reboot_mode mode, const char *cmd)
> +{
> +       /* Unlock the reset register */
> +       regmap_write(syscon_regmap, REALVIEW_SYS_LOCK_OFFSET,
> +                    REALVIEW_SYS_LOCK_VAL);
> +       /* Then hit reset on the different machines */
> +       switch (versatile_reboot_type) {
> +       case REALVIEW_REBOOT_EB:
> +               regmap_write(syscon_regmap,
> +                            REALVIEW_SYS_RESETCTL_OFFSET, 0x0008);
> +               break;
> ...
> +       }
> +       dsb();

Looks ok to me. Just an idea for further simplification, we could easily encode
the writes into the .data field:

	{
		.compatible = "arm,realview-eb-syscon",
		.data = (void *)0x00080000,
	},
	...
	{
               .compatible = "arm,realview-pbx-syscon",
               .data = (void *)0x00f000f4,
        },


static void versatile_reboot(enum reboot_mode mode, const char *cmd)
{

	/* Unlock the reset register */
	regmap_write(syscon_regmap, REALVIEW_SYS_LOCK_OFFSET,
		     REALVIEW_SYS_LOCK_VAL);

	regmap_write(syscon_regmap, REALVIEW_SYS_RESETCTL_OFFSET,
					versatile_reboot_type >> 16);

	if (versatile_reboot_type & 0xffff)
		regmap_write(syscon_regmap, REALVIEW_SYS_RESETCTL_OFFSET,
			     versatile_reboot_type >> 16);

	dsb();
}

It's definitely shorter, you can decide if you like it better or not,
and add my 'Acked-by: Arnd Bergmann <arnd@arndb.de>' whichever you choose.

	Arnd

  reply	other threads:[~2014-09-02 12:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 12:02 [PATCH 0/8] ARM RealView DeviceTree support v5 Linus Walleij
2014-09-02 12:02 ` [PATCH 1/8 v2] leds: add a driver for syscon-based LEDs Linus Walleij
2014-09-02 12:02 ` [PATCH 2/8 v2] leds: add device tree bindings for register bit LEDs Linus Walleij
2014-09-02 12:24   ` Arnd Bergmann
2014-09-08 11:25     ` Linus Walleij
2014-09-02 14:22   ` Geert Uytterhoeven
2014-09-08 11:14     ` Linus Walleij
2014-09-02 12:02 ` [PATCH 3/8 v2] power: reset: driver for the Versatile syscon reboot Linus Walleij
2014-09-02 12:32   ` Arnd Bergmann [this message]
2014-09-02 12:02 ` [PATCH 4/8] soc: add driver for the ARM RealView Linus Walleij
2014-09-02 12:02 ` [PATCH 5/8] ARM: l2x0: move DT parsing for cache props Linus Walleij
2014-09-02 12:43   ` Russell King - ARM Linux
2014-09-05 11:10     ` Linus Walleij
2014-09-02 12:02 ` [PATCH 6/8] ARM: l2c: parse 'cache-size' and 'cache-sets' properties Linus Walleij
2014-09-02 12:02 ` [PATCH 7/8] ARM: l2x0: support associativity from DT Linus Walleij
2014-09-02 13:17   ` Russell King - ARM Linux
2014-09-02 12:02 ` [PATCH 8/8 v5] ARM: realview: basic device tree implementation Linus Walleij
2014-09-02 12:37   ` Arnd Bergmann

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=3488091.4DXvj6mC51@wuerfel \
    --to=arnd@arndb.de \
    --cc=dbaryshkov@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh@kernel.org \
    --cc=sre@kernel.org \
    --cc=will.deacon@arm.com \
    /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