drivers/soc/litex: Add restart handler
Subsystems (2)
PATCH v2 1/1 drivers/soc/litex: Add restart handler
Let the LiteX SoC Controller a register a restart handler, which resets the LiteX SoC by writing 1 to CSR_CTRL_RESET_ADDR.
---
Tested with linux-on-litex-vexriscv.
This patch is based on upstream, i.e. not on top of Gabriel Somlo's "[PATCH v5 0/4] drivers/soc/litex: support 32-bit subregisters, 64-bit CPUs"
(https://lore.kernel.org/lkml/[email protected]/)
v2:
- Rebase on top of v5.11-rc1,
- Change reset handler priority to recommended default value of 128
(was 192).
(v1 was not sent to a mailing list)
--- drivers/soc/litex/litex_soc_ctrl.c | 33 +++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-)
drivers/soc/litex/litex_soc_ctrl.c +30 -3
@@ -15,6 +15,11 @@#include <linux/module.h> #include <linux/errno.h> #include <linux/io.h> +#include <linux/reboot.h> + +/* reset register located at the base address */ +#define RESET_REG_OFF 0x00 +#define RESET_REG_VALUE 0x00000001/* * LiteX SoC Generator, depending on the configuration, can split a single
@@ -136,8 +141,20 @@ static int litex_check_csr_access(void __iomem *reg_addr)return 0 ; } -struct litex_soc_ctrl_device { +static struct litex_soc_ctrl_device {void __iomem *base; +} *soc_ctrl_dev; + +static int litex_reset_handler (struct notifier_block *this,unsigned long mode, +void *cmd) +{ +litex_write32 (soc_ctrl_dev->base +RESET_REG_OFF ,RESET_REG_VALUE ); +return NOTIFY_DONE ; +} + +static struct notifier_block litex_reset_nb = { + .notifier_call = litex_reset_handler, + .priority =128 , };static const struct of_device_id litex_soc_ctrl_of_match[] = {
@@ -149,7 +166,7 @@ MODULE_DEVICE_TABLE(of, litex_soc_ctrl_of_match);static int litex_soc_ctrl_probe (struct platform_device *pdev) { -struct litex_soc_ctrl_device *soc_ctrl_dev; +int error; soc_ctrl_dev =devm_kzalloc (&pdev->dev,sizeof (*soc_ctrl_dev),GFP_KERNEL );if (!soc_ctrl_dev)
@@ -159,7 +176,17 @@ static int litex_soc_ctrl_probe(struct platform_device *pdev)if (IS_ERR (soc_ctrl_dev->base))return PTR_ERR (soc_ctrl_dev->base); -return litex_check_csr_access (soc_ctrl_dev->base); + error =litex_check_csr_access (soc_ctrl_dev->base); +if (error) +return error; + + error =register_restart_handler (&litex_reset_nb); +if (error) { +dev_warn (&pdev->dev,"cannot register restart handler: %d\n" , + error); + } + +return 0 ; }static struct platform_driver litex_soc_ctrl_driver = {
Signature · 7 lines
2.25.1 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Quoted 11 lines · Geert Uytterhoeven
Let the LiteX SoC Controller a register a restart handler, which resets the LiteX SoC by writing 1 to
CSR_CTRL_RESET_ADDR.Signed-off-by Geert Uytterhoeven <[email protected]>---
Tested with linux-on-litex-vexriscv.This patch is based on upstream, i.e. not on top of Gabriel Somlo's "[PATCH v5 0/4]
drivers/soc/litex: support 32-bit subregisters, 64-bit CPUs"
(https://lore.kernel.org/lkml/[email protected]/)
Bummer, and that's why the RESET_REG_* definitions are no longer next to the SCRATCH_REG_* definitions :-(
Well, I assume that will be fixed by evolution ;-)
Quoted 16 lines
v2:
- Rebase on top of v5.11-rc1,
- Change reset handler priority to recommended default value of 128(was 192).(v1 was not sent to a mailing list)
--- drivers/soc/litex/litex_soc_ctrl.c | 33 +++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-)drivers/soc/litex/litex_soc_ctrl.c +0
-0@@ -15,6 +15,11 @@#include <linux/module.h>
drivers/soc/litex/litex_soc_ctrl.c line 25
Quoted 10 lines
drivers/soc/litex/litex_soc_ctrl.c +5
-0#include <linux/errno.h> #include <linux/io.h> +#include <linux/reboot.h> + +/* reset register located at the base address */ +#define RESET_REG_OFF 0x00 +#define RESET_REG_VALUE 0x00000001/* * LiteX SoC Generator, depending on the configuration, can split a single
Gr{oetje,eeting}s,
Geert
Signature · 10 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Quoted 8 lines · Geert Uytterhoeven
Quoted 7 lines · Geert Uytterhoeven
Let the LiteX SoC Controller a register a restart handler, which resets the LiteX SoC by writing 1 to
CSR_CTRL_RESET_ADDR.Signed-off-by Geert Uytterhoeven <[email protected]>---
Tested with linux-on-litex-vexriscv.
Quoted 7 lines
Quoted 4 lines
This patch is based on upstream, i.e. not on top of Gabriel Somlo's "[PATCH v5 0/4]
drivers/soc/litex: support 32-bit subregisters, 64-bit CPUs"
(https://lore.kernel.org/lkml/[email protected]/)Bummer, and that's why the RESET_REG_* definitions are no longer next to the SCRATCH_REG_* definitions :-(
If it helps I have accepted Gabriel's patches and put them onto for-next.
https://github.com/openrisc/linux/commits/for-next
I am happy to take and test a patch based on that. Or I can do the adjustments to base the patch on that myself. Let me know.
-Stafford
Quoted 26 lines
Well, I assume that will be fixed by evolution ;-)
Quoted 24 lines
v2:
- Rebase on top of v5.11-rc1,
- Change reset handler priority to recommended default value of 128(was 192).(v1 was not sent to a mailing list)
--- drivers/soc/litex/litex_soc_ctrl.c | 33 +++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-)drivers/soc/litex/litex_soc_ctrl.c +5
-0@@ -15,6 +15,11 @@#include <linux/module.h> #include <linux/errno.h> #include <linux/io.h> +#include <linux/reboot.h> + +/* reset register located at the base address */ +#define RESET_REG_OFF 0x00 +#define RESET_REG_VALUE 0x00000001
Quoted 13 lines
drivers/soc/litex/litex_soc_ctrl.c line 25
Quoted 2 lines
drivers/soc/litex/litex_soc_ctrl.c +0
-0/* * LiteX SoC Generator, depending on the configuration, can split a single Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Hi Stafford,
Quoted 17 lines · Stafford Horne
Quoted 8 lines · Geert Uytterhoeven
Quoted 7 lines · Geert Uytterhoeven
Let the LiteX SoC Controller a register a restart handler, which resets the LiteX SoC by writing 1 to
CSR_CTRL_RESET_ADDR.Signed-off-by Geert Uytterhoeven <[email protected]>---
Tested with linux-on-litex-vexriscv.Quoted 7 lines
Quoted 4 lines
This patch is based on upstream, i.e. not on top of Gabriel Somlo's "[PATCH v5 0/4]
drivers/soc/litex: support 32-bit subregisters, 64-bit CPUs"
(https://lore.kernel.org/lkml/[email protected]/)Bummer, and that's why the RESET_REG_* definitions are no longer next to the SCRATCH_REG_* definitions :-(
Quoted 6 lines
If it helps I have accepted Gabriel's patches and put them onto for-next.
https://github.com/openrisc/linux/commits/for-next
I am happy to take and test a patch based on that. Or I can do the adjustments to base the patch on that myself. Let me know.
Thanks for letting me know! V3 sent.
Gr{oetje,eeting}s,
Geert
Signature · 10 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Quoted 20 lines · Geert Uytterhoeven
Hi Stafford,
Quoted 17 lines · Stafford Horne
Quoted 15 lines · Geert Uytterhoeven
Quoted 11 lines · Geert Uytterhoeven
Let the LiteX SoC Controller a register a restart handler, which resets the LiteX SoC by writing 1 to
CSR_CTRL_RESET_ADDR.Signed-off-by Geert Uytterhoeven <[email protected]>---
Tested with linux-on-litex-vexriscv.This patch is based on upstream, i.e. not on top of Gabriel Somlo's "[PATCH v5 0/4]
drivers/soc/litex: support 32-bit subregisters, 64-bit CPUs"
(https://lore.kernel.org/lkml/[email protected]/)Bummer, and that's why the RESET_REG_* definitions are no longer next to the SCRATCH_REG_* definitions :-(
Quoted 8 lines
Quoted 6 lines
If it helps I have accepted Gabriel's patches and put them onto for-next.
https://github.com/openrisc/linux/commits/for-next
I am happy to take and test a patch based on that. Or I can do the adjustments to base the patch on that myself. Let me know.
Thanks for letting me know! V3 sent.
Hi Geert,
I don't seem to see v3 anywhere. Where did you send it and what is the subject?
-Stafford
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Hi Stafford,
Quoted 23 lines · Stafford Horne
Quoted 22 lines · Geert Uytterhoeven
Quoted 21 lines · Stafford Horne
Quoted 8 lines · Geert Uytterhoeven
Quoted 7 lines · Geert Uytterhoeven
Let the LiteX SoC Controller a register a restart handler, which resets the LiteX SoC by writing 1 to
CSR_CTRL_RESET_ADDR.Signed-off-by Geert Uytterhoeven <[email protected]>---
Tested with linux-on-litex-vexriscv.Quoted 7 lines
Quoted 4 lines
This patch is based on upstream, i.e. not on top of Gabriel Somlo's "[PATCH v5 0/4]
drivers/soc/litex: support 32-bit subregisters, 64-bit CPUs"
(https://lore.kernel.org/lkml/[email protected]/)Bummer, and that's why the RESET_REG_* definitions are no longer next to the SCRATCH_REG_* definitions :-(
If it helps I have accepted Gabriel's patches and put them onto for-next.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
I am happy to take and test a patch based on that. Or I can do the adjustments to base the patch on that myself. Let me know.
Thanks for letting me know! V3 sent.
Hi Geert,
I don't seem to see v3 anywhere. Where did you send it and what is the subject?
https://lore.kernel.org/linux-riscv/[email protected]/
So "b4 am [email protected]" should give you a copy.
Thanks!
Gr{oetje,eeting}s,
Geert
Signature · 10 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Quoted 8 lines · Geert Uytterhoeven
Hi Stafford,
Quoted 5 lines · Stafford Horne
Quoted 4 lines · Geert Uytterhoeven
Quoted 3 lines · Stafford Horne
Quoted 2 lines · Geert Uytterhoeven
Quoted 1 line · Geert Uytterhoeven
Let the LiteX SoC Controller a register a restart handler, which resets
I think there is a typo here:
Let the LiteX SoC Controller a register a restart ...
should remove the first 'a' and say
Let the LiteX SoC Controller register a restart ...
Quoted 23 lines
Quoted 23 lines
Quoted 22 lines
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
the LiteX SoC by writing 1 to
CSR_CTRL_RESET_ADDR.Signed-off-by Geert Uytterhoeven <[email protected]>---
Tested with linux-on-litex-vexriscv.Quoted 7 lines
Quoted 4 lines
This patch is based on upstream, i.e. not on top of Gabriel Somlo's "[PATCH v5 0/4]
drivers/soc/litex: support 32-bit subregisters, 64-bit CPUs"
(https://lore.kernel.org/lkml/[email protected]/)Bummer, and that's why the RESET_REG_* definitions are no longer next to the SCRATCH_REG_* definitions :-(
Quoted 6 lines
If it helps I have accepted Gabriel's patches and put them onto for-next.
https://github.com/openrisc/linux/commits/for-next
I am happy to take and test a patch based on that. Or I can do the adjustments to base the patch on that myself. Let me know.
Thanks for letting me know! V3 sent.
Quoted 8 lines
Quoted 3 lines
Hi Geert,
I don't seem to see v3 anywhere. Where did you send it and what is the subject?
https://lore.kernel.org/linux-riscv/[email protected]/
So "b4 am [email protected]" should give you a copy.
Thanks I got it, I am not sure why it does not show up in my inbox anywhere, sometimes gmail drops mails. Hence, I am replying here.
As per the typo above I can fix during applying or you could send during a v4.
One more small nit is that you move soc_ctrl_dev out to a static instance it might help to mention. But it's easy to see why.
-Stafford
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Hi Stafford,
Quoted 43 lines · Stafford Horne
Quoted 6 lines · Geert Uytterhoeven
Quoted 5 lines · Stafford Horne
Quoted 4 lines · Geert Uytterhoeven
Quoted 3 lines · Stafford Horne
Quoted 2 lines · Geert Uytterhoeven
Quoted 1 line · Geert Uytterhoeven
Let the LiteX SoC Controller a register a restart handler, which resets
I think there is a typo here:
Let the LiteX SoC Controller a register a restart ...
should remove the first 'a' and say
Let the LiteX SoC Controller register a restart ...
Quoted 27 lines
Quoted 26 lines
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Quoted 10 lines
the LiteX SoC by writing 1 to
CSR_CTRL_RESET_ADDR.Signed-off-by Geert Uytterhoeven <[email protected]>---
Tested with linux-on-litex-vexriscv.This patch is based on upstream, i.e. not on top of Gabriel Somlo's "[PATCH v5 0/4]
drivers/soc/litex: support 32-bit subregisters, 64-bit CPUs"
(https://lore.kernel.org/lkml/[email protected]/)Bummer, and that's why the RESET_REG_* definitions are no longer next to the SCRATCH_REG_* definitions :-(
Quoted 8 lines
Quoted 6 lines
If it helps I have accepted Gabriel's patches and put them onto for-next.
https://github.com/openrisc/linux/commits/for-next
I am happy to take and test a patch based on that. Or I can do the adjustments to base the patch on that myself. Let me know.
Thanks for letting me know! V3 sent.
Hi Geert,
I don't seem to see v3 anywhere. Where did you send it and what is the subject?
Quoted 7 lines
Quoted 4 lines
https://lore.kernel.org/linux-riscv/[email protected]/
So "b4 am [email protected]" should give you a copy.
Thanks I got it, I am not sure why it does not show up in my inbox anywhere, sometimes gmail drops mails. Hence, I am replying here.
You may want to add a rule to never mark as spam emails with "PATCH" in the subject. And check your spam folder regularly, and teach gmail by marking non-spam as non-spam.
Quoted 4 lines
As per the typo above I can fix during applying or you could send during a v4.
One more small nit is that you move
soc_ctrl_devout to a static instance it might help to mention. But it's easy to see why.
Found a way to get rid of it. Will send v4 shortly.
Gr{oetje,eeting}s,
Geert
Signature · 10 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv