[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdUv41kssEnat9PFTcb11sYCP3_9p=5hQFAVRqRa-G7gSg@mail.gmail.com>
Date: Tue, 3 Jan 2023 09:26:13 +0100
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: fabrizio.castro.jz@...esas.com
Cc: Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Sebastian Reichel <sre@...nel.org>, Lee Jones <lee@...nel.org>,
linux-gpio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
Chris Paterson <Chris.Paterson2@...esas.com>,
Biju Das <biju.das@...renesas.com>,
linux-renesas-soc@...r.kernel.org,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Jacopo Mondi <jacopo@...ndi.org>
Subject: Re: [PATCH v2 4/4] power: reset: Add new driver for RZ/V2M PWC poweroff
Hi Fabrizio,
On Wed, Dec 21, 2022 at 10:09 PM Fabrizio Castro
<fabrizio.castro.jz@...esas.com> wrote:
> The RZ/V2M PWC IP controls external power supplies and therefore
> can turn the power supplies off when powering down the system.
>
> Add driver to poweroff the system.
>
> Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@...esas.com>
> ---
>
> v1->v2: Dropped OF match table and syscon as a result of the change in
> DT model
Thanks for your patch!
> --- /dev/null
> +++ b/drivers/power/reset/rzv2m-pwc-poweroff.c
> @@ -0,0 +1,67 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Copyright (C) 2022 Renesas Electronics Corporation
> + *
> + * Reset driver for Renesas RZ/V2M External Power Sequence Controller (PWC)
> + */
> +
> +#include <linux/delay.h>
> +#include <linux/io.h>
> +#include <linux/platform_device.h>
> +#include <linux/reboot.h>
> +#include "../../mfd/rzv2m-pwc.h"
> +
> +#define PWC_PWCRST_RSTSOFTAX 0x1
> +#define PWC_PWCCKEN_ENGCKMAIN 0x1
> +#define PWC_PWCCTL_PWOFF 0x1
> +
> +struct rzv2m_pwc_poweroff_priv {
> + void __iomem *base;
> + struct device *dev;
> +};
> +
> +static int rzv2m_pwc_poweroff(struct sys_off_data *data)
> +{
> + struct rzv2m_pwc_poweroff_priv *priv =
> + (struct rzv2m_pwc_poweroff_priv *)data->cb_data;
No need for this cast.
> +
> + writel(PWC_PWCRST_RSTSOFTAX, priv->base + PWC_PWCRST);
> + writel(PWC_PWCCKEN_ENGCKMAIN, priv->base + PWC_PWCCKEN);
> + writel(PWC_PWCCTL_PWOFF, priv->base + PWC_PWCCTL);
> +
> + mdelay(150);
> +
> + dev_err(priv->dev, "Failed to power off the system");
> +
> + return NOTIFY_DONE;
> +}
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-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
Powered by blists - more mailing lists