* Re: [PATCH 00/43] ep93xx device tree conversion
2023-04-24 12:34 [PATCH 00/43] ep93xx device tree conversion Nikita Shubin
@ 2023-04-24 11:31 ` Arnd Bergmann
[not found] ` <20230424152933.48b2ede1@kernel.org>
2023-04-24 12:34 ` [PATCH 13/43] power: reset: Add a driver for the ep93xx reset Nikita Shubin
` (3 subsequent siblings)
4 siblings, 1 reply; 12+ messages in thread
From: Arnd Bergmann @ 2023-04-24 11:31 UTC (permalink / raw)
To: Nikita Shubin
Cc: Arnd Bergmann, Linus Walleij, Alexander Sverdlin,
David S . Miller, Jonathan Neuschäfer, Russell King,
Uwe Kleine-König, Alessandro Zummo, Alexander Gordeev,
Alexandre Belloni, Andy Shevchenko, Bartosz Golaszewski,
Brian Norris, Chuanhong Guo, Conor.Dooley, Damien Le Moal,
Daniel Lezcano, Dmitry Torokhov, Emil Renner Berthing,
Eric Dumazet, Florian Fainelli, Guenter Roeck, Hartley Sweeten,
Heiko Stübner, Hitomi Hasegawa, Jakub Kicinski,
Jaroslav Kysela, Jean Delvare, Joel Stanley, Jonathan Cameron,
Krzysztof Kozlowski, Damien Le Moal, Liam Girdwood, Liang Yang,
Linus Walleij, Lukasz Majewski, Lv Ruyi, Mark Brown,
Masahiro Yamada, Michael Turquette, Miquel Raynal,
Nathan Chancellor, Nick Desaulniers, Nicolas Saenz Julienne,
Olof Johansson, Paolo Abeni, Qin Jian, Richard Weinberger,
Rob Herring, Robert Jarzmik, Russell King, Sebastian Reichel,
Sergey Shtylyov, Stephen Boyd, Sumanth Korikkar, Sven Peter,
Takashi Iwai, Thierry Reding, Thomas Gleixner, Ulf Hansson,
Vasily Gorbik, Vignesh Raghavendra, Vinod Koul, Walker Chen,
Wim Van Sebroeck, Yinbo Zhu, alsa-devel, devicetree, dmaengine,
linux-arm-kernel, linux-clk, open list:GPIO SUBSYSTEM, linux-ide,
linux-input, linux-kernel, linux-mtd, linux-pm, linux-pwm,
linux-rtc, linux-spi, linux-watchdog, Netdev, soc
On Mon, Apr 24, 2023, at 14:34, Nikita Shubin wrote:
> This series aims to convert ep93xx from platform to full device tree support.
>
> Tested on ts7250 64 RAM/128 MiB Nand flash, edb9302.
>
> Thank you Linus and Arnd for your support, review and comments, sorry
> if i missed something -
> these series are quite big for me.
>
> Big thanks to Alexander Sverdlin for his testing, support, review,
> fixes and patches.
Thanks a lot for your continued work. I can't merge any of this at
the moment since the upstream merge window just opened, but I'm
happy to take this all through the soc tree for 6.5, provided we
get the sufficient Acks from the subsystem maintainers. Merging
it through each individual tree would take a lot longer, so I
hope we can avoid that.
Arnd
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 13/43] power: reset: Add a driver for the ep93xx reset
2023-04-24 12:34 [PATCH 00/43] ep93xx device tree conversion Nikita Shubin
2023-04-24 11:31 ` Arnd Bergmann
@ 2023-04-24 12:34 ` Nikita Shubin
2023-04-29 20:06 ` Sebastian Reichel
2023-04-26 20:56 ` [PATCH 00/43] ep93xx device tree conversion Linus Walleij
` (2 subsequent siblings)
4 siblings, 1 reply; 12+ messages in thread
From: Nikita Shubin @ 2023-04-24 12:34 UTC (permalink / raw)
Cc: Arnd Bergmann, Linus Walleij, Alexander Sverdlin,
Sebastian Reichel, linux-kernel, linux-pm
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@maquefel.me>
---
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@maquefel.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
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH 13/43] power: reset: Add a driver for the ep93xx reset
2023-04-24 12:34 ` [PATCH 13/43] power: reset: Add a driver for the ep93xx reset Nikita Shubin
@ 2023-04-29 20:06 ` Sebastian Reichel
0 siblings, 0 replies; 12+ messages in thread
From: Sebastian Reichel @ 2023-04-29 20:06 UTC (permalink / raw)
To: Nikita Shubin
Cc: Arnd Bergmann, Linus Walleij, Alexander Sverdlin, linux-kernel,
linux-pm
[-- Attachment #1: Type: text/plain, Size: 4100 bytes --]
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@maquefel.me>
> ---
Acked-by: Sebastian Reichel <sre@kernel.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@maquefel.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
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 00/43] ep93xx device tree conversion
2023-04-24 12:34 [PATCH 00/43] ep93xx device tree conversion Nikita Shubin
2023-04-24 11:31 ` Arnd Bergmann
2023-04-24 12:34 ` [PATCH 13/43] power: reset: Add a driver for the ep93xx reset Nikita Shubin
@ 2023-04-26 20:56 ` Linus Walleij
[not found] ` <b5396ef5-3fed-4e98-8f37-a9cd4473bddc@sirena.org.uk>
2023-05-16 3:47 ` Florian Fainelli
2023-06-01 5:34 ` [PATCH v1 14/43] power: reset: Add a driver for the ep93xx reset Nikita Shubin
4 siblings, 1 reply; 12+ messages in thread
From: Linus Walleij @ 2023-04-26 20:56 UTC (permalink / raw)
To: Nikita Shubin
Cc: Arnd Bergmann, Linus Walleij, Alexander Sverdlin, David S. Miller,
Jonathan Neuschäfer, Russell King (Oracle),
Uwe Kleine-König, Alessandro Zummo, Alexander Gordeev,
Alexandre Belloni, Andy Shevchenko, Arnd Bergmann,
Bartosz Golaszewski, Brian Norris, Chuanhong Guo, Conor Dooley,
Damien Le Moal, Daniel Lezcano, Dmitry Torokhov,
Emil Renner Berthing, Eric Dumazet, Florian Fainelli,
Guenter Roeck, Hartley Sweeten, Heiko Stuebner, Hitomi Hasegawa,
Jakub Kicinski, Jaroslav Kysela, Jean Delvare, Joel Stanley,
Jonathan Cameron, Krzysztof Kozlowski, Le Moal, Liam Girdwood,
Liang Yang, Lukasz Majewski, Lv Ruyi, Mark Brown, Masahiro Yamada,
Michael Turquette, Miquel Raynal, Nathan Chancellor,
Nick Desaulniers, Nicolas Saenz Julienne, Olof Johansson,
Paolo Abeni, Qin Jian, Richard Weinberger, Rob Herring,
Robert Jarzmik, Russell King, Sebastian Reichel, Sergey Shtylyov,
Stephen Boyd, Sumanth Korikkar, Sven Peter, Takashi Iwai,
Thierry Reding, Thomas Gleixner, Ulf Hansson, Vasily Gorbik,
Vignesh Raghavendra, Vinod Koul, Walker Chen, Wim Van Sebroeck,
Yinbo Zhu, alsa-devel, devicetree, dmaengine, linux-arm-kernel,
linux-clk, linux-gpio, linux-ide, linux-input, linux-kernel,
linux-mtd, linux-pm, linux-pwm, linux-rtc, linux-spi,
linux-watchdog, netdev, soc
On Mon, Apr 24, 2023 at 11:35 AM Nikita Shubin
<nikita.shubin@maquefel.me> wrote:
> This series aims to convert ep93xx from platform to full device tree support.
>
> Tested on ts7250 64 RAM/128 MiB Nand flash, edb9302.
Neat, I'd say let's merge this for 6.5 once the final rough edges are
off. The DT bindings should be easy to fix.
This is a big patch set and the improvement to the ARM kernel it
brings is great, so I am a bit worried about over-review stalling the
merged. If there start to be nitpicky comments I would prefer that
we merge it and let minor comments and "nice-to-haves" be
addressed in-tree during the development cycle.
I encourage you to use b4 to manage the patch series if you
have time to learn it, it could help you:
https://people.kernel.org/monsieuricon/sending-a-kernel-patch-with-b4-part-1
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH 00/43] ep93xx device tree conversion
2023-04-24 12:34 [PATCH 00/43] ep93xx device tree conversion Nikita Shubin
` (2 preceding siblings ...)
2023-04-26 20:56 ` [PATCH 00/43] ep93xx device tree conversion Linus Walleij
@ 2023-05-16 3:47 ` Florian Fainelli
2023-05-16 10:37 ` Nikita Shubin
2023-06-01 5:34 ` [PATCH v1 14/43] power: reset: Add a driver for the ep93xx reset Nikita Shubin
4 siblings, 1 reply; 12+ messages in thread
From: Florian Fainelli @ 2023-05-16 3:47 UTC (permalink / raw)
To: Nikita Shubin
Cc: Arnd Bergmann, Linus Walleij, Alexander Sverdlin, David S. Miller,
Jonathan Neuschäfer, Russell King (Oracle),
Uwe Kleine-König, Alessandro Zummo, Alexander Gordeev,
Alexandre Belloni, Andy Shevchenko, Arnd Bergmann,
Bartosz Golaszewski, Brian Norris, Chuanhong Guo, Conor Dooley,
Damien Le Moal, Daniel Lezcano, Dmitry Torokhov,
Emil Renner Berthing, Eric Dumazet, Guenter Roeck,
Hartley Sweeten, Heiko Stuebner, Hitomi Hasegawa, Jakub Kicinski,
Jaroslav Kysela, Jean Delvare, Joel Stanley, Jonathan Cameron,
Krzysztof Kozlowski, Le Moal, Liam Girdwood, Liang Yang,
Linus Walleij, Lukasz Majewski, Lv Ruyi, Mark Brown,
Masahiro Yamada, Michael Turquette, Miquel Raynal,
Nathan Chancellor, Nick Desaulniers, Nicolas Saenz Julienne,
Olof Johansson, Paolo Abeni, Qin Jian, Richard Weinberger,
Rob Herring, Robert Jarzmik, Russell King, Sebastian Reichel,
Sergey Shtylyov, Stephen Boyd, Sumanth Korikkar, Sven Peter,
Takashi Iwai, Thierry Reding, Thomas Gleixner, Ulf Hansson,
Vasily Gorbik, Vignesh Raghavendra, Vinod Koul, Walker Chen,
Wim Van Sebroeck, Yinbo Zhu, alsa-devel, devicetree, dmaengine,
linux-arm-kernel, linux-clk, linux-gpio, linux-ide, linux-input,
linux-kernel, linux-mtd, linux-pm, linux-pwm, linux-rtc,
linux-spi, linux-watchdog, netdev, soc
On 4/24/2023 5:34 AM, Nikita Shubin wrote:
> This series aims to convert ep93xx from platform to full device tree support.
>
> Tested on ts7250 64 RAM/128 MiB Nand flash, edb9302.
>
> Thank you Linus and Arnd for your support, review and comments, sorry if i missed something -
> these series are quite big for me.
>
> Big thanks to Alexander Sverdlin for his testing, support, review, fixes and patches.
If anyone is interested I still have a TS-7300 board [1] that is fully
functional and could be sent out to a new home.
https://www.embeddedts.com/products/TS-7300
--
Florian
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH 00/43] ep93xx device tree conversion
2023-05-16 3:47 ` Florian Fainelli
@ 2023-05-16 10:37 ` Nikita Shubin
0 siblings, 0 replies; 12+ messages in thread
From: Nikita Shubin @ 2023-05-16 10:37 UTC (permalink / raw)
To: Florian Fainelli
Cc: Arnd Bergmann, Linus Walleij, Alexander Sverdlin, David S. Miller,
Jonathan Neuschäfer, Russell King (Oracle),
Uwe Kleine-König, Alessandro Zummo, Alexander Gordeev,
Alexandre Belloni, Andy Shevchenko, Arnd Bergmann,
Bartosz Golaszewski, Brian Norris, Chuanhong Guo, Conor Dooley,
Damien Le Moal, Daniel Lezcano, Dmitry Torokhov,
Emil Renner Berthing, Eric Dumazet, Guenter Roeck,
Hartley Sweeten, Heiko Stuebner, Hitomi Hasegawa, Jakub Kicinski,
Jaroslav Kysela, Jean Delvare, Joel Stanley, Jonathan Cameron,
Krzysztof Kozlowski, Le Moal, Liam Girdwood, Liang Yang,
Linus Walleij, Lukasz Majewski, Lv Ruyi, Mark Brown,
Masahiro Yamada, Michael Turquette, Miquel Raynal,
Nathan Chancellor, Nick Desaulniers, Nicolas Saenz Julienne,
Olof Johansson, Paolo Abeni, Qin Jian, Richard Weinberger,
Rob Herring, Robert Jarzmik, Russell King, Sebastian Reichel,
Sergey Shtylyov, Stephen Boyd, Sumanth Korikkar, Sven Peter,
Takashi Iwai, Thierry Reding, Thomas Gleixner, Ulf Hansson,
Vasily Gorbik, Vignesh Raghavendra, Vinod Koul, Walker Chen,
Wim Van Sebroeck, Yinbo Zhu, alsa-devel, devicetree, dmaengine,
linux-arm-kernel, linux-clk, linux-gpio, linux-ide, linux-input,
linux-kernel, linux-mtd, linux-pm, linux-pwm, linux-rtc,
linux-spi, linux-watchdog, netdev, soc
Hello Florian!
On Mon, 2023-05-15 at 20:47 -0700, Florian Fainelli wrote:
>
>
> On 4/24/2023 5:34 AM, Nikita Shubin wrote:
> > This series aims to convert ep93xx from platform to full device
> > tree support.
> >
> > Tested on ts7250 64 RAM/128 MiB Nand flash, edb9302.
> >
> > Thank you Linus and Arnd for your support, review and comments,
> > sorry if i missed something -
> > these series are quite big for me.
> >
> > Big thanks to Alexander Sverdlin for his testing, support, review,
> > fixes and patches.
>
> If anyone is interested I still have a TS-7300 board [1] that is
> fully
> functional and could be sent out to a new home.
Thank you kindly, i'll keep this in mind !
>
> https://www.embeddedts.com/products/TS-7300
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v1 14/43] power: reset: Add a driver for the ep93xx reset
2023-04-24 12:34 [PATCH 00/43] ep93xx device tree conversion Nikita Shubin
` (3 preceding siblings ...)
2023-05-16 3:47 ` Florian Fainelli
@ 2023-06-01 5:34 ` Nikita Shubin
2023-06-03 20:24 ` andy.shevchenko
4 siblings, 1 reply; 12+ messages in thread
From: Nikita Shubin @ 2023-06-01 5:34 UTC (permalink / raw)
To: Alexander Sverdlin, Arnd Bergmann, Linus Walleij,
Sebastian Reichel
Cc: Nikita Shubin, Michael Peters, Kris Bahnsen, linux-kernel,
linux-pm
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@maquefel.me>
Acked-by: Sebastian Reichel <sre@kernel.org>
---
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@maquefel.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.37.4
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH v1 14/43] power: reset: Add a driver for the ep93xx reset
2023-06-01 5:34 ` [PATCH v1 14/43] power: reset: Add a driver for the ep93xx reset Nikita Shubin
@ 2023-06-03 20:24 ` andy.shevchenko
0 siblings, 0 replies; 12+ messages in thread
From: andy.shevchenko @ 2023-06-03 20:24 UTC (permalink / raw)
To: Nikita Shubin
Cc: Alexander Sverdlin, Arnd Bergmann, Linus Walleij,
Sebastian Reichel, Michael Peters, Kris Bahnsen, linux-kernel,
linux-pm
Thu, Jun 01, 2023 at 08:34:05AM +0300, Nikita Shubin kirjoitti:
> Implement the reset behaviour of the various EP93xx SoCS in drivers/power/reset.
>
> It used to be located in arch/arm/mach-ep93xx.
...
> +config POWER_RESET_EP93XX
> + bool "Cirrus EP93XX reset driver" if COMPILE_TEST
Can you elaborate this construction, please?
> + 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.
...
Missing bits.h
> +#include <linux/delay.h>
> +#include <linux/notifier.h>
> +#include <linux/of_device.h>
Wrong header. One is mod_devicetable.h, dunno what other implicit dependencies
you have in mind when added this.
> +#include <linux/platform_device.h>
> +#include <linux/reboot.h>
> +#include <linux/soc/cirrus/ep93xx.h>
...
> + struct notifier_block *res_han;
> + struct device *dev = &pdev->dev;
Longer lines first?
> + int err;
> +
> + res_han = devm_kzalloc(&pdev->dev, sizeof(*res_han), GFP_KERNEL);
You have dev, use it.
> + if (!res_han)
> + return -ENOMEM;
...
> + err = register_restart_handler(res_han);
> + if (err)
> + dev_err(dev, "can't register restart notifier (err=%d)\n", err);
return dev_err_probe(...);
> + return err;
> +}
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 12+ messages in thread