devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@gmail.com>
To: Qing Zhang <zhangqing@loongson.cn>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Rob Herring <robh+dt@kernel.org>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: devicetree@vger.kernel.org, linux-mips@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 1/3] MIPS: Loongson64: Add Loongson-2K1000 reset platform driver
Date: Thu, 1 Jul 2021 12:04:17 +0300	[thread overview]
Message-ID: <3e48b6b3-62e4-8a15-6c73-e2f35c07b842@gmail.com> (raw)
In-Reply-To: <20210701030137.10566-1-zhangqing@loongson.cn>

Hello!

On 01.07.2021 6:01, Qing Zhang wrote:

> Add power management register operations to support reboot and poweroff.
> 
> Signed-off-by: Qing Zhang <zhangqing@loongson.cn>
[...]
> diff --git a/drivers/platform/mips/ls2k-reset.c b/drivers/platform/mips/ls2k-reset.c
> new file mode 100644
> index 000000000000..286d47bf6964
> --- /dev/null
> +++ b/drivers/platform/mips/ls2k-reset.c
> @@ -0,0 +1,53 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + *  Copyright (C) 2021, Qing Zhang <zhangqing@loongson.cn>
> + *  Loongson-2K1000 reset support
> + */
> +
> +#include <linux/of_address.h>
> +#include <linux/pm.h>
> +#include <asm/reboot.h>
> +
> +#define	PM1_STS		0x0c /* Power Management1 Status Register */
                                                         ^ space missing?

> +#define	PM1_CNT		0x14 /* Power Management 1 Control Register */
> +#define	RST_CNT		0x30 /* Reset Control Register */
> +
> +static void __iomem *base;
> +
> +static void ls2k_restart(char *command)
> +{
> +	writel(0x1, (void *)base + RST_CNT);
> +}
> +
> +static void ls2k_poweroff(void)
> +{
> +	/* Clear */
> +	writel((readl((void *)base + PM1_STS) & 0xffffffff), (void *)base + PM1_STS);

    Are the pointer casts really necessary above?

> +	/* Sleep Enable | Soft Off*/
> +	writel(GENMASK(12, 10)|BIT(13), (void *)base + PM1_CNT);

    Spaces around that | are needed.

[...]

MBR, Sergei

      parent reply	other threads:[~2021-07-01  9:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-01  3:01 [PATCH v7 1/3] MIPS: Loongson64: Add Loongson-2K1000 reset platform driver Qing Zhang
2021-07-01  3:01 ` [PATCH v7 2/3] MIPS: Loongson64: DTS: Add pm block node for Loongson-2K1000 Qing Zhang
2021-07-01  3:01 ` [PATCH v7 3/3] dt-bindings: mips: Add Loongson-2K1000 reset support Qing Zhang
2021-07-01 14:02   ` Rob Herring
2021-07-01  9:04 ` Sergei Shtylyov [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=3e48b6b3-62e4-8a15-6c73-e2f35c07b842@gmail.com \
    --to=sergei.shtylyov@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=tsbogend@alpha.franken.de \
    --cc=zhangqing@loongson.cn \
    /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).