lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230429200659.36utkzfevcj45qce@mercury.elektranox.org>
Date:   Sat, 29 Apr 2023 22:06:59 +0200
From:   Sebastian Reichel <sre@...nel.org>
To:     Nikita Shubin <nikita.shubin@...uefel.me>
Cc:     Arnd Bergmann <arnd@...nel.org>, Linus Walleij <linusw@...nel.org>,
        Alexander Sverdlin <alexander.sverdlin@...il.com>,
        linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org
Subject: Re: [PATCH 13/43] power: reset: Add a driver for the ep93xx reset

Hi,

On Mon, Apr 24, 2023 at 03:34:29PM +0300, Nikita Shubin wrote:
> Implement the reset behaviour of the various EP93xx SoCS in drivers/power/reset.
> 
> It used to be located in arch/arm/mach-ep93xx.
> 
> Signed-off-by: Nikita Shubin <nikita.shubin@...uefel.me>
> ---

Acked-by: Sebastian Reichel <sre@...nel.org>

-- Sebastian

>  drivers/power/reset/Kconfig          | 10 +++++
>  drivers/power/reset/Makefile         |  1 +
>  drivers/power/reset/ep93xx-restart.c | 65 ++++++++++++++++++++++++++++
>  3 files changed, 76 insertions(+)
>  create mode 100644 drivers/power/reset/ep93xx-restart.c
> 
> diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
> index 8c87eeda0fec..2a61afbb047b 100644
> --- a/drivers/power/reset/Kconfig
> +++ b/drivers/power/reset/Kconfig
> @@ -75,6 +75,16 @@ config POWER_RESET_BRCMSTB
>  	  Say Y here if you have a Broadcom STB board and you wish
>  	  to have restart support.
>  
> +config POWER_RESET_EP93XX
> +	bool "Cirrus EP93XX reset driver" if COMPILE_TEST
> +	depends on MFD_SYSCON
> +	default ARCH_EP93XX
> +	help
> +	  This driver provides restart support for Cirrus EP93XX SoC.
> +
> +	  Say Y here if you have a Cirrus EP93XX SoC and you wish
> +	  to have restart support.
> +
>  config POWER_RESET_GEMINI_POWEROFF
>  	bool "Cortina Gemini power-off driver"
>  	depends on ARCH_GEMINI || COMPILE_TEST
> diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
> index d763e6735ee3..61f4e11619b2 100644
> --- a/drivers/power/reset/Makefile
> +++ b/drivers/power/reset/Makefile
> @@ -7,6 +7,7 @@ obj-$(CONFIG_POWER_RESET_ATC260X) += atc260x-poweroff.o
>  obj-$(CONFIG_POWER_RESET_AXXIA) += axxia-reset.o
>  obj-$(CONFIG_POWER_RESET_BRCMKONA) += brcm-kona-reset.o
>  obj-$(CONFIG_POWER_RESET_BRCMSTB) += brcmstb-reboot.o
> +obj-$(CONFIG_POWER_RESET_EP93XX) += ep93xx-restart.o
>  obj-$(CONFIG_POWER_RESET_GEMINI_POWEROFF) += gemini-poweroff.o
>  obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o
>  obj-$(CONFIG_POWER_RESET_GPIO_RESTART) += gpio-restart.o
> diff --git a/drivers/power/reset/ep93xx-restart.c b/drivers/power/reset/ep93xx-restart.c
> new file mode 100644
> index 000000000000..0dab09d4fd3c
> --- /dev/null
> +++ b/drivers/power/reset/ep93xx-restart.c
> @@ -0,0 +1,65 @@
> +// SPDX-License-Identifier: (GPL-2.0)
> +/*
> + * Cirrus EP93xx SoC reset driver
> + *
> + * Copyright (C) 2021 Nikita Shubin <nikita.shubin@...uefel.me>
> + */
> +
> +#include <linux/delay.h>
> +#include <linux/notifier.h>
> +#include <linux/of_device.h>
> +#include <linux/platform_device.h>
> +#include <linux/reboot.h>
> +
> +#include <linux/soc/cirrus/ep93xx.h>
> +
> +#define EP93XX_SYSCON_DEVCFG_SWRST	BIT(31)
> +
> +static int ep93xx_restart_handle(struct notifier_block *this,
> +				 unsigned long mode, void *cmd)
> +{
> +	/* Issue the reboot */
> +	ep93xx_devcfg_set_clear(EP93XX_SYSCON_DEVCFG_SWRST, 0x00);
> +	ep93xx_devcfg_set_clear(0x00, EP93XX_SYSCON_DEVCFG_SWRST);
> +
> +	mdelay(1000);
> +
> +	pr_emerg("Unable to restart system\n");
> +	return NOTIFY_DONE;
> +}
> +
> +static int ep93xx_reboot_probe(struct platform_device *pdev)
> +{
> +	struct notifier_block *res_han;
> +	struct device *dev = &pdev->dev;
> +	int err;
> +
> +	res_han = devm_kzalloc(&pdev->dev, sizeof(*res_han), GFP_KERNEL);
> +	if (!res_han)
> +		return -ENOMEM;
> +
> +	res_han->notifier_call = ep93xx_restart_handle;
> +	res_han->priority = 128;
> +
> +	err = register_restart_handler(res_han);
> +	if (err)
> +		dev_err(dev, "can't register restart notifier (err=%d)\n", err);
> +
> +	return err;
> +}
> +
> +static const struct of_device_id ep93xx_reboot_of_match[] = {
> +	{
> +		.compatible = "cirrus,ep9301-reboot",
> +	},
> +	{}
> +};
> +
> +static struct platform_driver ep93xx_reboot_driver = {
> +	.probe = ep93xx_reboot_probe,
> +	.driver = {
> +		.name = "ep9301-reboot",
> +		.of_match_table = ep93xx_reboot_of_match,
> +	},
> +};
> +builtin_platform_driver(ep93xx_reboot_driver);
> -- 
> 2.39.2
> 

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ