sysreset: add support for socfpga sysreset
Subsystems (3)
PATCH 1/1 sysreset: add support for socfpga sysreset
This moves sysreset support for socfgpa from ad-hoc code in mach-socfpga to a UCLASS_SYSRESET based dm driver.
A side effect is that gen5 and a10 can now differ between cold and warm reset.
---
arch/arm/Kconfig | 3 + arch/arm/mach-socfpga/Makefile | 1 - .../mach-socfpga/include/mach/reset_manager.h | 1 + arch/arm/mach-socfpga/reset_manager.c | 41 ------------- drivers/sysreset/Kconfig | 6 ++ drivers/sysreset/Makefile | 1 + drivers/sysreset/sysreset_socfpga.c | 58 +++++++++++++++++++ 7 files changed, 69 insertions(+), 42 deletions(-) delete mode 100644 arch/arm/mach-socfpga/reset_manager.c create mode 100644 drivers/sysreset/sysreset_socfpga.c
arch/arm/Kconfig +3 -0
@@ -823,6 +823,7 @@ config ARCH_SOCFPGA select OF_CONTROL select SPL_DM_RESET if DM_RESET select SPL_DM_SERIAL + select SPL_DRIVERS_MISC_SUPPORT select SPL_LIBCOMMON_SUPPORT select SPL_LIBGENERIC_SUPPORT select SPL_NAND_SUPPORT if SPL_NAND_DENALI
@@ -833,6 +834,8 @@ config ARCH_SOCFPGA select SUPPORT_SPL select SYS_NS16550 select SYS_THUMB_BUILD if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10 + select SYSRESET + select SYSRESET_SOCFPGA imply CMD_DM imply CMD_MTDPARTS imply CRC32_VERIFY
arch/arm/mach-socfpga/Makefile +0 -1
@@ -8,7 +8,6 @@ obj-y += board.o obj-y += clock_manager.o obj-y += misc.o -obj-y += reset_manager.o ifdef CONFIG_TARGET_SOCFPGA_GEN5 obj-y += clock_manager_gen5.o
arch/arm/mach-socfpga/include/mach/reset_manager.h +1 -0
@@ -11,6 +11,7 @@ void reset_cpu(ulong addr);void socfpga_per_reset (u32 reset,int set);void socfpga_per_reset_all (void ); +#define RSTMGR_CTRL_SWCOLDRSTREQ_LSB 0#define RSTMGR_CTRL_SWWARMRSTREQ_LSB 1/*
arch/arm/mach-socfpga/reset_manager.c deleted +0 -41
41 lines not on this page · raw message
drivers/sysreset/Kconfig +6 -0
@@ -36,6 +36,12 @@ config SYSRESET_PSCI Enable PSCI SYSTEM_RESET function call. To use this, PSCI firmware must be running on your system. +config SYSRESET_SOCFPGA + bool "Enable support for Intel SOCFPGA family" + depends on ARCH_SOCFPGA + help + This enables the system reset driver support for Intel SOCFPGA SoCs. + config SYSRESET_TI_SCI bool "TI System Control Interface (TI SCI) system reset driver" depends on TI_SCI_PROTOCOL
drivers/sysreset/Makefile +1 -0
@@ -11,6 +11,7 @@ obj-$(CONFIG_SYSRESET_GPIO) += sysreset_gpio.o obj-$(CONFIG_SYSRESET_MCP83XX) += sysreset_mpc83xx.o obj-$(CONFIG_SYSRESET_MICROBLAZE) += sysreset_microblaze.o obj-$(CONFIG_SYSRESET_PSCI) += sysreset_psci.o +obj-$(CONFIG_SYSRESET_SOCFPGA) += sysreset_socfpga.o obj-$(CONFIG_SYSRESET_TI_SCI) += sysreset-ti-sci.o obj-$(CONFIG_SYSRESET_SYSCON) += sysreset_syscon.o obj-$(CONFIG_SYSRESET_WATCHDOG) += sysreset_watchdog.o
drivers/sysreset/sysreset_socfpga.c new file +58 -0
58 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 1/1 sysreset: add support for socfpga sysreset
Quoted 5 lines · Simon Goldschmidt
This moves sysreset support for socfgpa from ad-hoc code in mach-socfpga to a
UCLASS_SYSRESETbased dm driver.A side effect is that gen5 and a10 can now differ between cold and warm reset.
s/differ/select/ ?
Quoted 19 lines
Signed-off-by Simon Goldschmidt <[email protected]>---
arch/arm/Kconfig | 3 + arch/arm/mach-socfpga/Makefile | 1 - .../mach-socfpga/include/mach/reset_manager.h | 1 + arch/arm/mach-socfpga/reset_manager.c | 41 ------------- drivers/sysreset/Kconfig | 6 ++ drivers/sysreset/Makefile | 1 + drivers/sysreset/sysreset_socfpga.c | 58 +++++++++++++++++++ 7 files changed, 69 insertions(+), 42 deletions(-) delete mode 100644 arch/arm/mach-socfpga/reset_manager.c create mode 100644 drivers/sysreset/sysreset_socfpga.carch/arm/Kconfig +0
-0
arch/arm/Kconfig config ARCH_SOCFPGA · line 826
Quoted 4 lines
arch/arm/Kconfig +1
-0@@ -823,6 +823,7 @@ config ARCH_SOCFPGA select OF_CONTROL select SPL_DM_RESET if DM_RESET select SPL_DM_SERIAL + select SPL_DRIVERS_MISC_SUPPORT
Why MISC ?
Quoted 29 lines
arch/arm/Kconfig +2
-0select SPL_LIBCOMMON_SUPPORT select SPL_LIBGENERIC_SUPPORT select SPL_NAND_SUPPORT if SPL_NAND_DENALI@@ -833,6 +834,8 @@ config ARCH_SOCFPGA select SUPPORT_SPL select SYS_NS16550 select SYS_THUMB_BUILD if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10 + select SYSRESET + select SYSRESET_SOCFPGA imply CMD_DM imply CMD_MTDPARTS imply CRC32_VERIFYarch/arm/mach-socfpga/Makefile +0
-1@@ -8,7 +8,6 @@ obj-y += board.o obj-y += clock_manager.o obj-y += misc.o -obj-y += reset_manager.o ifdef CONFIG_TARGET_SOCFPGA_GEN5 obj-y += clock_manager_gen5.oarch/arm/mach-socfpga/include/mach/reset_manager.h +0
-0
arch/arm/mach-socfpga/include/mach/reset_manager.h void reset_cpu(ulong addr); · line 14
Quoted 4 lines
arch/arm/mach-socfpga/include/mach/reset_manager.h +1
-0@@ -11,6 +11,7 @@ void reset_cpu(ulong addr);void socfpga_per_reset (u32 reset,int set);void socfpga_per_reset_all (void ); +#define RSTMGR_CTRL_SWCOLDRSTREQ_LSB 0
Separate patch
Quoted 93 lines
arch/arm/mach-socfpga/include/mach/reset_manager.h +0
-0#define RSTMGR_CTRL_SWWARMRSTREQ_LSB 1/* arch/arm/mach-socfpga/reset_manager.c deleted +0
-41@@ -1,41 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* -* Copyright (C) 2013 Altera Corporation <www.altera.com> -*/ - - -#include <common.h> -#include <asm/io.h> -#include <asm/arch/reset_manager.h> - -#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10 ) -#include <asm/arch/mailbox_s10.h> -#endif - -DECLARE_GLOBAL_DATA_PTR ; - -#if !defined(CONFIG_TARGET_SOCFPGA_STRATIX10 ) -static const struct socfpga_reset_manager *reset_manager_base = - (void *)SOCFPGA_RSTMGR_ADDRESS ; -#endif - -/* -* Write the reset manager register to cause reset -*/ -void reset_cpu (ulong addr) -{ -/* request a warm reset */ -#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10 ) -puts ("Mailbox: Issuing mailbox cmd REBOOT_HPS\n" ); -mbox_reset_cold (); -#else -writel (1 <<RSTMGR_CTRL_SWWARMRSTREQ_LSB , - &reset_manager_base->ctrl); -#endif -/* -* infinite loop here as watchdog will trigger and reset -* the processor -*/ -while (1 ) - ; -}drivers/sysreset/Kconfig +6
-0@@ -36,6 +36,12 @@ config SYSRESET_PSCI Enable PSCI SYSTEM_RESET function call. To use this, PSCI firmware must be running on your system. +config SYSRESET_SOCFPGA + bool "Enable support for Intel SOCFPGA family" + depends on ARCH_SOCFPGA + help + This enables the system reset driver support for Intel SOCFPGA SoCs. + config SYSRESET_TI_SCI bool "TI System Control Interface (TI SCI) system reset driver" depends on TI_SCI_PROTOCOLdrivers/sysreset/Makefile +1
-0@@ -11,6 +11,7 @@ obj-$(CONFIG_SYSRESET_GPIO) += sysreset_gpio.o obj-$(CONFIG_SYSRESET_MCP83XX) += sysreset_mpc83xx.o obj-$(CONFIG_SYSRESET_MICROBLAZE) += sysreset_microblaze.o obj-$(CONFIG_SYSRESET_PSCI) += sysreset_psci.o +obj-$(CONFIG_SYSRESET_SOCFPGA) += sysreset_socfpga.o obj-$(CONFIG_SYSRESET_TI_SCI) += sysreset-ti-sci.o obj-$(CONFIG_SYSRESET_SYSCON) += sysreset_syscon.o obj-$(CONFIG_SYSRESET_WATCHDOG) += sysreset_watchdog.odrivers/sysreset/sysreset_socfpga.c new file +8
-0@@ -0,0 +1,58 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2019 Pepperl+Fuchs +* Simon Goldschmidt <[email protected]> +*/ + +#include <common.h> +#include <dm.h>
drivers/sysreset/sysreset_socfpga.c line 18
Quoted 10 lines
drivers/sysreset/sysreset_socfpga.c new file +10
-0+#include <errno.h> +#include <sysreset.h> +#include <asm/io.h> +#include <asm/arch/reset_manager.h> + +#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10 ) +#include <asm/arch/mailbox_s10.h> +#else +static const struct socfpga_reset_manager *reset_manager_base = + (void *)SOCFPGA_RSTMGR_ADDRESS ;
Shouldn't this come from DT ?
drivers/sysreset/sysreset_socfpga.c line 25
Quoted 7 lines
drivers/sysreset/sysreset_socfpga.c new file +7
-0+ +#endif + +static int socfpga_sysreset_request (struct udevice *dev, +enum sysreset_t type) +{ +#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10 )
You want a different driver for S10 instead of this ifdeffery.
Quoted 20 lines
drivers/sysreset/sysreset_socfpga.c new file +20
-0+puts ("Mailbox: Issuing mailbox cmd REBOOT_HPS\n" ); +mbox_reset_cold (); +#else +switch (type) { +case SYSRESET_WARM : +writel (1 <<RSTMGR_CTRL_SWWARMRSTREQ_LSB , + &reset_manager_base->ctrl); +break ; +case SYSRESET_COLD : +writel (1 <<RSTMGR_CTRL_SWCOLDRSTREQ_LSB , + &reset_manager_base->ctrl); +break ; +default : +return -EPROTONOSUPPORT ; + } +#endif +return -EINPROGRESS ; +} + +static struct sysreset_ops socfpga_sysreset = {
drivers/sysreset/sysreset_socfpga.c line 55
Quoted 10 lines
drivers/sysreset/sysreset_socfpga.c new file +10
-0+ .request = socfpga_sysreset_request, +}; + +U_BOOT_DRIVER (sysreset_socfpga) = { + .id =UCLASS_SYSRESET , + .name ="socfpga_sysreset" , + .ops = &socfpga_sysreset, +}; + +/* The reset driver does not have a device node, so bind it here */
Isn't that part of reset manager ?
Quoted 4 lines
drivers/sysreset/sysreset_socfpga.c new file +3
-0+U_BOOT_DEVICE (sysreset_socfpga) = { + .name ="socfpga_sysreset" , +};
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/1 sysreset: add support for socfpga sysreset
Quoted 8 lines · Marek Vasut
Quoted 5 lines · Simon Goldschmidt
This moves sysreset support for socfgpa from ad-hoc code in mach-socfpga to a
UCLASS_SYSRESETbased dm driver.A side effect is that gen5 and a10 can now differ between cold and warm reset.
s/differ/select/ ?
Right.
Quoted 15 lines
Quoted 15 lines
Signed-off-by Simon Goldschmidt <[email protected]>---
arch/arm/Kconfig | 3 + arch/arm/mach-socfpga/Makefile | 1 - .../mach-socfpga/include/mach/reset_manager.h | 1 + arch/arm/mach-socfpga/reset_manager.c | 41 ------------- drivers/sysreset/Kconfig | 6 ++ drivers/sysreset/Makefile | 1 + drivers/sysreset/sysreset_socfpga.c | 58 +++++++++++++++++++ 7 files changed, 69 insertions(+), 42 deletions(-)delete mode 100644
arch/arm/mach-socfpga/reset_manager.ccreate mode 100644drivers/sysreset/sysreset_socfpga.c
Quoted 11 lines
arch/arm/Kconfig config ARCH_SOCFPGA · line 826
Quoted 9 lines
arch/arm/Kconfig +1
-0@@ -823,6 +823,7 @@ config ARCH_SOCFPGA select OF_CONTROL select SPL_DM_RESET if DM_RESET select SPL_DM_SERIAL + select SPL_DRIVERS_MISC_SUPPORTWhy MISC ?
Because that's what includes the sysreset drivers into SPL.
Quoted 33 lines
Quoted 33 lines
arch/arm/Kconfig +2
-0select SPL_LIBCOMMON_SUPPORT select SPL_LIBGENERIC_SUPPORT select SPL_NAND_SUPPORT if SPL_NAND_DENALI@@ -833,6 +834,8 @@ config ARCH_SOCFPGA select SUPPORT_SPL select SYS_NS16550 select SYS_THUMB_BUILD if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10 + select SYSRESET + select SYSRESET_SOCFPGA imply CMD_DM imply CMD_MTDPARTS imply CRC32_VERIFYarch/arm/mach-socfpga/Makefile +0
-1@@ -8,7 +8,6 @@ obj-y += board.o obj-y += clock_manager.o obj-y += misc.o -obj-y += reset_manager.o ifdef CONFIG_TARGET_SOCFPGA_GEN5 obj-y += clock_manager_gen5.oarch/arm/mach-socfpga/include/mach/reset_manager.h +0
-0@@ -11,6 +11,7 @@ void reset_cpu(ulong addr);void socfpga_per_reset (u32 reset,int set);void socfpga_per_reset_all (void );
Quoted 3 lines
arch/arm/mach-socfpga/include/mach/reset_manager.h void reset_cpu(ulong addr); · line 14
Quoted 1 line
arch/arm/mach-socfpga/include/mach/reset_manager.h +1
-0+#define RSTMGR_CTRL_SWCOLDRSTREQ_LSB 0Separate patch
Fair enough.
Quoted 98 lines
Quoted 98 lines
arch/arm/mach-socfpga/include/mach/reset_manager.h +0
-0#define RSTMGR_CTRL_SWWARMRSTREQ_LSB 1/* arch/arm/mach-socfpga/reset_manager.c deleted +0
-41@@ -1,41 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* -* Copyright (C) 2013 Altera Corporation <www.altera.com> -*/ - - -#include <common.h> -#include <asm/io.h> -#include <asm/arch/reset_manager.h> - -#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10 ) -#include <asm/arch/mailbox_s10.h> -#endif - -DECLARE_GLOBAL_DATA_PTR ; - -#if !defined(CONFIG_TARGET_SOCFPGA_STRATIX10 ) -static const struct socfpga_reset_manager *reset_manager_base = - (void *)SOCFPGA_RSTMGR_ADDRESS ; -#endif - -/* -* Write the reset manager register to cause reset -*/ -void reset_cpu (ulong addr) -{ -/* request a warm reset */ -#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10 ) -puts ("Mailbox: Issuing mailbox cmd REBOOT_HPS\n" ); -mbox_reset_cold (); -#else -writel (1 <<RSTMGR_CTRL_SWWARMRSTREQ_LSB , - &reset_manager_base->ctrl); -#endif -/* -* infinite loop here as watchdog will trigger and reset -* the processor -*/ -while (1 ) - ; -}drivers/sysreset/Kconfig +6
-0@@ -36,6 +36,12 @@ config SYSRESET_PSCI Enable PSCI SYSTEM_RESET function call. To use this, PSCI firmware must be running on your system. +config SYSRESET_SOCFPGA + bool "Enable support for Intel SOCFPGA family" + depends on ARCH_SOCFPGA + help + This enables the system reset driver support for Intel SOCFPGA SoCs. + config SYSRESET_TI_SCI bool "TI System Control Interface (TI SCI) system reset driver" depends on TI_SCI_PROTOCOLdrivers/sysreset/Makefile +1
-0@@ -11,6 +11,7 @@ obj-$(CONFIG_SYSRESET_GPIO) += sysreset_gpio.o obj-$(CONFIG_SYSRESET_MCP83XX) += sysreset_mpc83xx.o obj-$(CONFIG_SYSRESET_MICROBLAZE) += sysreset_microblaze.o obj-$(CONFIG_SYSRESET_PSCI) += sysreset_psci.o +obj-$(CONFIG_SYSRESET_SOCFPGA) += sysreset_socfpga.o obj-$(CONFIG_SYSRESET_TI_SCI) += sysreset-ti-sci.o obj-$(CONFIG_SYSRESET_SYSCON) += sysreset_syscon.o obj-$(CONFIG_SYSRESET_WATCHDOG) += sysreset_watchdog.odrivers/sysreset/sysreset_socfpga.c new file +12
-0@@ -0,0 +1,58 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2019 Pepperl+Fuchs +* Simon Goldschmidt <[email protected]> +*/ + +#include <common.h> +#include <dm.h> +#include <errno.h> +#include <sysreset.h> +#include <asm/io.h> +#include <asm/arch/reset_manager.h>
Quoted 8 lines
drivers/sysreset/sysreset_socfpga.c line 18
Quoted 6 lines
drivers/sysreset/sysreset_socfpga.c new file +6
-0+ +#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10 ) +#include <asm/arch/mailbox_s10.h> +#else +static const struct socfpga_reset_manager *reset_manager_base = + (void *)SOCFPGA_RSTMGR_ADDRESS ;Shouldn't this come from DT ?
Hmm, that would indeed be better, yes. The thing is we do have a driver matching the dts node in question, but it supplies peripheral resets, not sysreset. Thinking about this, I don't know how to make 2 drivers match the same dts node...?
Quoted 10 lines
drivers/sysreset/sysreset_socfpga.c line 25
Quoted 8 lines
drivers/sysreset/sysreset_socfpga.c new file +7
-0+ +#endif + +static int socfpga_sysreset_request (struct udevice *dev, +enum sysreset_t type) +{ +#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10 )You want a different driver for S10 instead of this ifdeffery.
That might indeed be a better solution, yes.
Quoted 25 lines
Quoted 25 lines
drivers/sysreset/sysreset_socfpga.c new file +24
-0+puts ("Mailbox: Issuing mailbox cmd REBOOT_HPS\n" ); +mbox_reset_cold (); +#else +switch (type) { +case SYSRESET_WARM : +writel (1 <<RSTMGR_CTRL_SWWARMRSTREQ_LSB , + &reset_manager_base->ctrl); +break ; +case SYSRESET_COLD : +writel (1 <<RSTMGR_CTRL_SWCOLDRSTREQ_LSB , + &reset_manager_base->ctrl); +break ; +default : +return -EPROTONOSUPPORT ; + } +#endif +return -EINPROGRESS ; +} + +static struct sysreset_ops socfpga_sysreset = { + .request = socfpga_sysreset_request, +}; + +U_BOOT_DRIVER (sysreset_socfpga) = {
Quoted 8 lines
drivers/sysreset/sysreset_socfpga.c line 55
Quoted 6 lines
drivers/sysreset/sysreset_socfpga.c new file +6
-0+ .id = UCLASS_SYSRESET, + .name = "socfpga_sysreset", + .ops = &socfpga_sysreset, +}; + +/* The reset driver does not have a device node, so bind it here */ Isn't that part of reset manager ?
Exactly, see above. 1 dts node, 2 UCLASSes...
Any idea how to overcome this limit?
Regards,
Simon
Quoted 7 lines
Quoted 5 lines
drivers/sysreset/sysreset_socfpga.c new file +3
-0+U_BOOT_DEVICE (sysreset_socfpga) = { + .name ="socfpga_sysreset" , +};
PATCH 1/1 sysreset: add support for socfpga sysreset
Quoted 41 lines · Simon Goldschmidt
Quoted 8 lines · Marek Vasut
Quoted 5 lines · Simon Goldschmidt
This moves sysreset support for socfgpa from ad-hoc code in mach-socfpga to a
UCLASS_SYSRESETbased dm driver.A side effect is that gen5 and a10 can now differ between cold and warm reset.
s/differ/select/ ?
Right.
Quoted 15 lines
Quoted 15 lines
Signed-off-by Simon Goldschmidt <[email protected]>---
arch/arm/Kconfig | 3 + arch/arm/mach-socfpga/Makefile | 1 -
.../mach-socfpga/include/mach/reset_manager.h| 1 + arch/arm/mach-socfpga/reset_manager.c | 41 ------------- drivers/sysreset/Kconfig | 6 ++ drivers/sysreset/Makefile | 1 + drivers/sysreset/sysreset_socfpga.c | 58 +++++++++++++++++++7 files changed, 69 insertions(+), 42 deletions(-)delete mode 100644
arch/arm/mach-socfpga/reset_manager.ccreate mode 100644drivers/sysreset/sysreset_socfpga.cQuoted 11 lines
Quoted 9 lines
arch/arm/Kconfig +0
-0@@ -823,6 +823,7 @@ config ARCH_SOCFPGAselect
OF_CONTROL
selectSPL_DM_RESETifDM_RESET
selectSPL_DM_SERIAL
+ selectSPL_DRIVERS_MISC_SUPPORTWhy MISC ?
Quoted 1 line
Because that's what includes the sysreset drivers into SPL.
That seems wrong ?
Quoted 148 lines
Quoted 28 lines
Quoted 28 lines
select
SPL_LIBCOMMON_SUPPORT
selectSPL_LIBGENERIC_SUPPORT
selectSPL_NAND_SUPPORTifSPL_NAND_DENALIarch/arm/Kconfig +0
-0@@ -833,6 +834,8 @@ config ARCH_SOCFPGAselect
SUPPORT_SPL
selectSYS_NS16550
selectSYS_THUMB_BUILDifTARGET_SOCFPGA_GEN5||TARGET_SOCFPGA_ARRIA10
+ select SYSRESET
+ selectSYSRESET_SOCFPGA
implyCMD_DM
implyCMD_MTDPARTS
implyCRC32_VERIFYarch/arm/mach-socfpga/Makefile +0
-0@@ -8,7 +8,6 @@obj-y += board.o
obj-y += clock_manager.o
obj-y += misc.o
-obj-y += reset_manager.o
ifdefCONFIG_TARGET_SOCFPGA_GEN5
obj-y += clock_manager_gen5.oarch/arm/mach-socfpga/include/mach/reset_manager.h +0
-0Quoted 8 lines
Quoted 6 lines
arch/arm/mach-socfpga/include/mach/reset_manager.h +0
-0@@ -11,6 +11,7 @@ void reset_cpu(ulong addr); void socfpga_per_reset(u32 reset, int set); void socfpga_per_reset_all(void);+#define
RSTMGR_CTRL_SWCOLDRSTREQ_LSB0Separate patch
Fair enough.
Quoted 100 lines
Quoted 100 lines
#define
RSTMGR_CTRL_SWWARMRSTREQ_LSB1
/*arch/arm/mach-socfpga/reset_manager.c deleted +0
-41@@ -1,41 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* -* Copyright (C) 2013 Altera Corporation <www.altera.com> -*/ - - -#include <common.h> -#include <asm/io.h> -#include <asm/arch/reset_manager.h> - -#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10 ) -#include <asm/arch/mailbox_s10.h> -#endif - -DECLARE_GLOBAL_DATA_PTR ; - -#if !defined(CONFIG_TARGET_SOCFPGA_STRATIX10 ) -static const struct socfpga_reset_manager *reset_manager_base = - (void *)SOCFPGA_RSTMGR_ADDRESS; -#endif - -/* -* Write the reset manager register to cause reset -*/ -void reset_cpu (ulong addr) -{ - /* request a warm reset */ -#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10 ) - puts("Mailbox: Issuing mailbox cmd REBOOT_HPS\n"); - mbox_reset_cold(); -#else - writel(1 << RSTMGR_CTRL_SWWARMRSTREQ_LSB, - &reset_manager_base->ctrl); -#endif - /* - * infinite loop here as watchdog will trigger and reset - * the processor - */ - while (1) - ; -}drivers/sysreset/Kconfig +0
-0@@ -36,6 +36,12 @@ config SYSRESET_PSCIEnable PSCI
SYSTEM_RESETfunction call. To use this, PSCI firmware
must be running on your system.
+configSYSRESET_SOCFPGA
+ bool "Enable support for Intel SOCFPGA family"
+ depends onARCH_SOCFPGA
+ help
+ This enables the system reset driver support for Intel SOCFPGA SoCs.
+
configSYSRESET_TI_SCI
bool "TI System Control Interface (TI SCI) system reset driver" depends onTI_SCI_PROTOCOLdrivers/sysreset/Makefile +0
-0@@ -11,6 +11,7 @@ obj-$(CONFIG_SYSRESET_GPIO) += sysreset_gpio.oobj-$(CONFIG_SYSRESET_MCP83XX) += sysreset_mpc83xx.o obj-$(CONFIG_SYSRESET_MICROBLAZE) += sysreset_microblaze.o obj-$(CONFIG_SYSRESET_PSCI) += sysreset_psci.o +obj-$(CONFIG_SYSRESET_SOCFPGA) += sysreset_socfpga.o obj-$(CONFIG_SYSRESET_TI_SCI) += sysreset-ti-sci.o obj-$(CONFIG_SYSRESET_SYSCON) += sysreset_syscon.o obj-$(CONFIG_SYSRESET_WATCHDOG) += sysreset_watchdog.o
drivers/sysreset/sysreset_socfpga.c new file +12
-0@@ -0,0 +1,58 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2019 Pepperl+Fuchs +* Simon Goldschmidt <[email protected]> +*/ + +#include <common.h> +#include <dm.h> +#include <errno.h> +#include <sysreset.h> +#include <asm/io.h> +#include <asm/arch/reset_manager.h> Quoted 8 lines
drivers/sysreset/sysreset_socfpga.c line 18
Quoted 6 lines
drivers/sysreset/sysreset_socfpga.c new file +6
-0+ +#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10 ) +#include <asm/arch/mailbox_s10.h> +#else +static const struct socfpga_reset_manager *reset_manager_base = + (void *)SOCFPGA_RSTMGR_ADDRESS;Shouldn't this come from DT ?
Quoted 4 lines
Hmm, that would indeed be better, yes. The thing is we do have a driver matching the dts node in question, but it supplies peripheral resets, not sysreset. Thinking about this, I don't know how to make 2 drivers match the same dts node...?
Make it one driver or something MFDish ?
Quoted 10 lines
Quoted 8 lines
drivers/sysreset/sysreset_socfpga.c line 25
Quoted 6 lines
drivers/sysreset/sysreset_socfpga.c new file +6
-0+#endif + +static int socfpga_sysreset_request (struct udevice *dev, + enum sysreset_t type) +{ +#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10 )You want a different driver for S10 instead of this ifdeffery.
That might indeed be a better solution, yes.
Yes please
Quoted 33 lines
Quoted 24 lines
Quoted 24 lines
drivers/sysreset/sysreset_socfpga.c new file +24
-0+ puts("Mailbox: Issuing mailbox cmd REBOOT_HPS\n"); + mbox_reset_cold(); +#else + switch (type) { + case SYSRESET_WARM: + writel(1 << RSTMGR_CTRL_SWWARMRSTREQ_LSB, + &reset_manager_base->ctrl); + break; + case SYSRESET_COLD: + writel(1 << RSTMGR_CTRL_SWCOLDRSTREQ_LSB, + &reset_manager_base->ctrl); + break; + default: + return -EPROTONOSUPPORT; + } +#endif + return -EINPROGRESS; +} + +static struct sysreset_ops socfpga_sysreset = { + .request = socfpga_sysreset_request, +}; + +U_BOOT_DRIVER (sysreset_socfpga) = {Quoted 8 lines
drivers/sysreset/sysreset_socfpga.c line 55
Quoted 6 lines
drivers/sysreset/sysreset_socfpga.c new file +6
-0+ .id = UCLASS_SYSRESET, + .name = "socfpga_sysreset", + .ops = &socfpga_sysreset, +}; + +/* The reset driver does not have a device node, so bind it here */ Isn't that part of reset manager ?
Quoted 2 lines
Exactly, see above. 1 dts node, 2 UCLASSes...
Any idea how to overcome this limit?
See above, or look at syscon_get_regmap() to export a register to a different driver(s).
Signature · 2 lines
Best regards, Marek Vasut