[PATCH 0/5] sysreset: Add Atmel/Microchip sysreset driver

This patch series implements the Atmel/Microchip sysreset driver. It also adds the missing RSTC node to the SAM9X60 and SAMA7G5 SoC files and removes the older default reset driver from armv7. The Makefile for arm926ejs has also been updated to ignore the default reset driver if SYSRESET is chosen. What is more, Atmel/Microchip defconfigs now enable sysreset by default.
Sergiu Moga (5): ARM: dts: at91: Add RSTC node sysreset: Add Atmel/Microchip sysreset driver configs: at91: Enable SYSRESET for Atmel/Microchip's platforms ARM: mach-at91: arm926ejs: Add SYSRESET conditional ARM: mach-at91: armv7: Remove default reset driver
arch/arm/dts/sam9x60.dtsi | 6 ++ arch/arm/dts/sama7g5.dtsi | 7 ++ arch/arm/mach-at91/arm926ejs/Makefile | 2 + arch/arm/mach-at91/armv7/Makefile | 3 - arch/arm/mach-at91/armv7/reset.c | 31 -------- configs/sam9x60ek_mmc_defconfig | 3 + configs/sam9x60ek_nandflash_defconfig | 3 + configs/sam9x60ek_qspiflash_defconfig | 3 + configs/sama5d27_giantboard_defconfig | 4 ++ configs/sama5d27_som1_ek_mmc1_defconfig | 4 ++ configs/sama5d27_som1_ek_mmc_defconfig | 4 ++ configs/sama5d27_som1_ek_qspiflash_defconfig | 4 ++ configs/sama5d27_wlsom1_ek_mmc_defconfig | 4 ++ .../sama5d27_wlsom1_ek_qspiflash_defconfig | 4 ++ configs/sama5d2_icp_mmc_defconfig | 4 ++ configs/sama5d2_icp_qspiflash_defconfig | 3 + configs/sama5d2_ptc_ek_mmc_defconfig | 3 + configs/sama5d2_ptc_ek_nandflash_defconfig | 3 + configs/sama5d2_xplained_emmc_defconfig | 4 ++ configs/sama5d2_xplained_mmc_defconfig | 4 ++ configs/sama5d2_xplained_qspiflash_defconfig | 4 ++ configs/sama5d2_xplained_spiflash_defconfig | 4 ++ configs/sama5d36ek_cmp_mmc_defconfig | 3 + configs/sama5d36ek_cmp_nandflash_defconfig | 3 + configs/sama5d36ek_cmp_spiflash_defconfig | 3 + configs/sama5d3_xplained_mmc_defconfig | 4 ++ configs/sama5d3_xplained_nandflash_defconfig | 4 ++ configs/sama5d3xek_mmc_defconfig | 4 ++ configs/sama5d3xek_nandflash_defconfig | 4 ++ configs/sama5d3xek_spiflash_defconfig | 4 ++ configs/sama5d4_xplained_mmc_defconfig | 4 ++ configs/sama5d4_xplained_nandflash_defconfig | 4 ++ configs/sama5d4_xplained_spiflash_defconfig | 4 ++ configs/sama5d4ek_mmc_defconfig | 4 ++ configs/sama5d4ek_nandflash_defconfig | 4 ++ configs/sama5d4ek_spiflash_defconfig | 4 ++ configs/sama7g5ek_mmc1_defconfig | 3 + configs/sama7g5ek_mmc_defconfig | 3 + configs/vinco_defconfig | 3 + drivers/sysreset/Kconfig | 15 ++++ drivers/sysreset/Makefile | 1 + drivers/sysreset/sysreset_at91.c | 71 +++++++++++++++++++ 42 files changed, 226 insertions(+), 34 deletions(-) delete mode 100644 arch/arm/mach-at91/armv7/reset.c create mode 100644 drivers/sysreset/sysreset_at91.c

Add node for RSTC.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com --- arch/arm/dts/sam9x60.dtsi | 6 ++++++ arch/arm/dts/sama7g5.dtsi | 7 +++++++ 2 files changed, 13 insertions(+)
diff --git a/arch/arm/dts/sam9x60.dtsi b/arch/arm/dts/sam9x60.dtsi index be44519934..733cc5cec9 100644 --- a/arch/arm/dts/sam9x60.dtsi +++ b/arch/arm/dts/sam9x60.dtsi @@ -223,6 +223,12 @@ status = "okay"; };
+ reset_controller: rstc@fffffe00 { + compatible = "microchip,sam9x60-rstc"; + reg = <0xfffffe00 0x10>; + clocks = <&clk32 0>; + }; + pit: timer@fffffe40 { compatible = "atmel,at91sam9260-pit"; reg = <0xfffffe40 0x10>; diff --git a/arch/arm/dts/sama7g5.dtsi b/arch/arm/dts/sama7g5.dtsi index b7c261ebe9..7015bd7f6d 100644 --- a/arch/arm/dts/sama7g5.dtsi +++ b/arch/arm/dts/sama7g5.dtsi @@ -232,6 +232,13 @@ clocks = <&clk32k 0>; };
+ reset_controller: rstc@e001d000 { + compatible = "microchip,sama7g5-rstc", "microchip,sam9x60-rstc"; + reg = <0xe001d000 0xc>, <0xe001d0e4 0x4>; + #reset-cells = <1>; + clocks = <&clk32k 0>; + }; + clk32k: clock-controller@e001d050 { compatible = "microchip,sama7g5-sckc", "microchip,sam9x60-sckc"; reg = <0xe001d050 0x4>;

This patch adds a sysreset driver for Atmel/Microchip platforms.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com Reviewed-by: Claudiu Beznea claudiu.beznea@microchip.com --- drivers/sysreset/Kconfig | 15 +++++++ drivers/sysreset/Makefile | 1 + drivers/sysreset/sysreset_at91.c | 71 ++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 drivers/sysreset/sysreset_at91.c
diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig index f6d60038b8..25dd02c704 100644 --- a/drivers/sysreset/Kconfig +++ b/drivers/sysreset/Kconfig @@ -77,6 +77,21 @@ config SYSRESET_OCTEON This enables the system reset driver support for Marvell Octeon SoCs.
+config SYSRESET_AT91 + bool "Enable support for Microchip/Atmel reset driver" + depends on ARCH_AT91 + select SYSRESET_SPL_AT91 if SPL && SPL_SYSRESET + help + This enables the system reset driver support for Microchip/Atmel + SoCs. + +config SYSRESET_SPL_AT91 + bool "Enable support for Microchip/Atmel reset driver in SPL" + depends on ARCH_AT91 + help + This enables the system reset driver support for Microchip/Atmel + SoCs in SPL. + config SYSRESET_PSCI bool "Enable support for PSCI System Reset" depends on ARM_PSCI_FW diff --git a/drivers/sysreset/Makefile b/drivers/sysreset/Makefile index 8e00be0779..0ed3bbf356 100644 --- a/drivers/sysreset/Makefile +++ b/drivers/sysreset/Makefile @@ -20,5 +20,6 @@ obj-$(CONFIG_SYSRESET_TI_SCI) += sysreset-ti-sci.o obj-$(CONFIG_SYSRESET_SYSCON) += sysreset_syscon.o obj-$(CONFIG_SYSRESET_WATCHDOG) += sysreset_watchdog.o obj-$(CONFIG_SYSRESET_RESETCTL) += sysreset_resetctl.o +obj-$(CONFIG_SYSRESET_$(SPL_TPL_)AT91) += sysreset_at91.o obj-$(CONFIG_$(SPL_TPL_)SYSRESET_X86) += sysreset_x86.o obj-$(CONFIG_TARGET_XTFPGA) += sysreset_xtfpga.o diff --git a/drivers/sysreset/sysreset_at91.c b/drivers/sysreset/sysreset_at91.c new file mode 100644 index 0000000000..24b87ee987 --- /dev/null +++ b/drivers/sysreset/sysreset_at91.c @@ -0,0 +1,71 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2022 Microchip Technology, Inc. and its subsidiaries + */ + +#include <asm/arch/hardware.h> +#include <asm/io.h> +#include <asm/arch/at91_rstc.h> +#include <clk.h> +#include <common.h> +#include <cpu_func.h> +#include <dm.h> +#include <dm/device_compat.h> +#include <dm/device-internal.h> +#include <sysreset.h> + +static int at91_sysreset_request(struct udevice *dev, enum sysreset_t type) +{ + at91_rstc_t *rstc = (at91_rstc_t *)dev_get_priv(dev); + + writel(AT91_RSTC_KEY + | AT91_RSTC_CR_PROCRST /* Processor Reset */ + | AT91_RSTC_CR_PERRST /* Peripheral Reset */ +#ifdef CONFIG_AT91RESET_EXTRST + | AT91_RSTC_CR_EXTRST /* External Reset (assert nRST pin) */ +#endif + , &rstc->cr); + + return -EINPROGRESS; +} + +static int at91_sysreset_probe(struct udevice *dev) +{ + struct clk slck; + void *priv; + int ret; + + priv = dev_remap_addr(dev); + if (!priv) + return -EINVAL; + + dev_set_priv(dev, priv); + + ret = clk_get_by_index(dev, 0, &slck); + if (ret) + return ret; + + ret = clk_prepare_enable(&slck); + if (ret) + return ret; + + return 0; +} + +static struct sysreset_ops at91_sysreset = { + .request = at91_sysreset_request, +}; + +static const struct udevice_id a91_sysreset_ids[] = { + { .compatible = "atmel,sama5d3-rstc" }, + { .compatible = "microchip,sam9x60-rstc" }, + { } +}; + +U_BOOT_DRIVER(sysreset_at91) = { + .id = UCLASS_SYSRESET, + .name = "at91_reset", + .ops = &at91_sysreset, + .probe = at91_sysreset_probe, + .of_match = a91_sysreset_ids, +};

This commit enables SYSRESET in the defconfigs for the Atmel/Microchip platforms.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com --- configs/sam9x60ek_mmc_defconfig | 3 +++ configs/sam9x60ek_nandflash_defconfig | 3 +++ configs/sam9x60ek_qspiflash_defconfig | 3 +++ configs/sama5d27_giantboard_defconfig | 4 ++++ configs/sama5d27_som1_ek_mmc1_defconfig | 4 ++++ configs/sama5d27_som1_ek_mmc_defconfig | 4 ++++ configs/sama5d27_som1_ek_qspiflash_defconfig | 4 ++++ configs/sama5d27_wlsom1_ek_mmc_defconfig | 4 ++++ configs/sama5d27_wlsom1_ek_qspiflash_defconfig | 4 ++++ configs/sama5d2_icp_mmc_defconfig | 4 ++++ configs/sama5d2_icp_qspiflash_defconfig | 3 +++ configs/sama5d2_ptc_ek_mmc_defconfig | 3 +++ configs/sama5d2_ptc_ek_nandflash_defconfig | 3 +++ configs/sama5d2_xplained_emmc_defconfig | 4 ++++ configs/sama5d2_xplained_mmc_defconfig | 4 ++++ configs/sama5d2_xplained_qspiflash_defconfig | 4 ++++ configs/sama5d2_xplained_spiflash_defconfig | 4 ++++ configs/sama5d36ek_cmp_mmc_defconfig | 3 +++ configs/sama5d36ek_cmp_nandflash_defconfig | 3 +++ configs/sama5d36ek_cmp_spiflash_defconfig | 3 +++ configs/sama5d3_xplained_mmc_defconfig | 4 ++++ configs/sama5d3_xplained_nandflash_defconfig | 4 ++++ configs/sama5d3xek_mmc_defconfig | 4 ++++ configs/sama5d3xek_nandflash_defconfig | 4 ++++ configs/sama5d3xek_spiflash_defconfig | 4 ++++ configs/sama5d4_xplained_mmc_defconfig | 4 ++++ configs/sama5d4_xplained_nandflash_defconfig | 4 ++++ configs/sama5d4_xplained_spiflash_defconfig | 4 ++++ configs/sama5d4ek_mmc_defconfig | 4 ++++ configs/sama5d4ek_nandflash_defconfig | 4 ++++ configs/sama5d4ek_spiflash_defconfig | 4 ++++ configs/sama7g5ek_mmc1_defconfig | 3 +++ configs/sama7g5ek_mmc_defconfig | 3 +++ configs/vinco_defconfig | 3 +++ 34 files changed, 124 insertions(+)
diff --git a/configs/sam9x60ek_mmc_defconfig b/configs/sam9x60ek_mmc_defconfig index 238397f0ac..8bff8fc67d 100644 --- a/configs/sam9x60ek_mmc_defconfig +++ b/configs/sam9x60ek_mmc_defconfig @@ -76,6 +76,9 @@ CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_W1=y CONFIG_W1_GPIO=y diff --git a/configs/sam9x60ek_nandflash_defconfig b/configs/sam9x60ek_nandflash_defconfig index 0d3e9d0388..e77a297efa 100644 --- a/configs/sam9x60ek_nandflash_defconfig +++ b/configs/sam9x60ek_nandflash_defconfig @@ -78,6 +78,9 @@ CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_TIMER=y CONFIG_ATMEL_PIT_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_W1=y CONFIG_W1_GPIO=y CONFIG_W1_EEPROM=y diff --git a/configs/sam9x60ek_qspiflash_defconfig b/configs/sam9x60ek_qspiflash_defconfig index b0f74e61c3..bddf07a636 100644 --- a/configs/sam9x60ek_qspiflash_defconfig +++ b/configs/sam9x60ek_qspiflash_defconfig @@ -90,6 +90,9 @@ CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y CONFIG_TIMER=y CONFIG_ATMEL_PIT_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_W1=y CONFIG_W1_GPIO=y CONFIG_W1_EEPROM=y diff --git a/configs/sama5d27_giantboard_defconfig b/configs/sama5d27_giantboard_defconfig index 7d25474260..69b7e90aa6 100644 --- a/configs/sama5d27_giantboard_defconfig +++ b/configs/sama5d27_giantboard_defconfig @@ -84,3 +84,7 @@ CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_ATMEL_USBA=y CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y diff --git a/configs/sama5d27_som1_ek_mmc1_defconfig b/configs/sama5d27_som1_ek_mmc1_defconfig index 1df7ae0897..1a9f7d58f4 100644 --- a/configs/sama5d27_som1_ek_mmc1_defconfig +++ b/configs/sama5d27_som1_ek_mmc1_defconfig @@ -90,6 +90,10 @@ CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y diff --git a/configs/sama5d27_som1_ek_mmc_defconfig b/configs/sama5d27_som1_ek_mmc_defconfig index adb6580f19..f94f1c76dc 100644 --- a/configs/sama5d27_som1_ek_mmc_defconfig +++ b/configs/sama5d27_som1_ek_mmc_defconfig @@ -90,6 +90,10 @@ CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y diff --git a/configs/sama5d27_som1_ek_qspiflash_defconfig b/configs/sama5d27_som1_ek_qspiflash_defconfig index cd5142521a..1b8ba65bf5 100644 --- a/configs/sama5d27_som1_ek_qspiflash_defconfig +++ b/configs/sama5d27_som1_ek_qspiflash_defconfig @@ -89,6 +89,10 @@ CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y diff --git a/configs/sama5d27_wlsom1_ek_mmc_defconfig b/configs/sama5d27_wlsom1_ek_mmc_defconfig index 43be6fbeb3..097031fe04 100644 --- a/configs/sama5d27_wlsom1_ek_mmc_defconfig +++ b/configs/sama5d27_wlsom1_ek_mmc_defconfig @@ -95,6 +95,10 @@ CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y diff --git a/configs/sama5d27_wlsom1_ek_qspiflash_defconfig b/configs/sama5d27_wlsom1_ek_qspiflash_defconfig index 574a67e07e..090ab26ef8 100644 --- a/configs/sama5d27_wlsom1_ek_qspiflash_defconfig +++ b/configs/sama5d27_wlsom1_ek_qspiflash_defconfig @@ -99,6 +99,10 @@ CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y diff --git a/configs/sama5d2_icp_mmc_defconfig b/configs/sama5d2_icp_mmc_defconfig index 5b530f0da6..13503c1e7b 100644 --- a/configs/sama5d2_icp_mmc_defconfig +++ b/configs/sama5d2_icp_mmc_defconfig @@ -81,6 +81,10 @@ CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/configs/sama5d2_icp_qspiflash_defconfig b/configs/sama5d2_icp_qspiflash_defconfig index e103ae3dde..61c3b4d787 100644 --- a/configs/sama5d2_icp_qspiflash_defconfig +++ b/configs/sama5d2_icp_qspiflash_defconfig @@ -88,6 +88,9 @@ CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y diff --git a/configs/sama5d2_ptc_ek_mmc_defconfig b/configs/sama5d2_ptc_ek_mmc_defconfig index 609e202c34..307c285d1d 100644 --- a/configs/sama5d2_ptc_ek_mmc_defconfig +++ b/configs/sama5d2_ptc_ek_mmc_defconfig @@ -71,6 +71,9 @@ CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y diff --git a/configs/sama5d2_ptc_ek_nandflash_defconfig b/configs/sama5d2_ptc_ek_nandflash_defconfig index 132f31a3d4..09bee95f96 100644 --- a/configs/sama5d2_ptc_ek_nandflash_defconfig +++ b/configs/sama5d2_ptc_ek_nandflash_defconfig @@ -71,6 +71,9 @@ CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y diff --git a/configs/sama5d2_xplained_emmc_defconfig b/configs/sama5d2_xplained_emmc_defconfig index caacbabb7b..a0d59f42fc 100644 --- a/configs/sama5d2_xplained_emmc_defconfig +++ b/configs/sama5d2_xplained_emmc_defconfig @@ -90,6 +90,10 @@ CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y diff --git a/configs/sama5d2_xplained_mmc_defconfig b/configs/sama5d2_xplained_mmc_defconfig index de9fe9d13b..9891322c55 100644 --- a/configs/sama5d2_xplained_mmc_defconfig +++ b/configs/sama5d2_xplained_mmc_defconfig @@ -92,6 +92,10 @@ CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y diff --git a/configs/sama5d2_xplained_qspiflash_defconfig b/configs/sama5d2_xplained_qspiflash_defconfig index 24b509d062..ac10e7044d 100644 --- a/configs/sama5d2_xplained_qspiflash_defconfig +++ b/configs/sama5d2_xplained_qspiflash_defconfig @@ -91,6 +91,10 @@ CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y diff --git a/configs/sama5d2_xplained_spiflash_defconfig b/configs/sama5d2_xplained_spiflash_defconfig index e4a2e45965..200b0891b8 100644 --- a/configs/sama5d2_xplained_spiflash_defconfig +++ b/configs/sama5d2_xplained_spiflash_defconfig @@ -95,6 +95,10 @@ CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y diff --git a/configs/sama5d36ek_cmp_mmc_defconfig b/configs/sama5d36ek_cmp_mmc_defconfig index 3732b68cce..6a069de80f 100644 --- a/configs/sama5d36ek_cmp_mmc_defconfig +++ b/configs/sama5d36ek_cmp_mmc_defconfig @@ -66,6 +66,9 @@ CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_DM_VIDEO=y # CONFIG_VIDEO_BPP8 is not set diff --git a/configs/sama5d36ek_cmp_nandflash_defconfig b/configs/sama5d36ek_cmp_nandflash_defconfig index 2a261400b7..9c66c01e26 100644 --- a/configs/sama5d36ek_cmp_nandflash_defconfig +++ b/configs/sama5d36ek_cmp_nandflash_defconfig @@ -68,6 +68,9 @@ CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_DM_VIDEO=y # CONFIG_VIDEO_BPP8 is not set diff --git a/configs/sama5d36ek_cmp_spiflash_defconfig b/configs/sama5d36ek_cmp_spiflash_defconfig index df62e0e85b..035a9e4fcd 100644 --- a/configs/sama5d36ek_cmp_spiflash_defconfig +++ b/configs/sama5d36ek_cmp_spiflash_defconfig @@ -68,6 +68,9 @@ CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_DM_VIDEO=y # CONFIG_VIDEO_BPP8 is not set diff --git a/configs/sama5d3_xplained_mmc_defconfig b/configs/sama5d3_xplained_mmc_defconfig index d89b6f3618..a2bbde9f47 100644 --- a/configs/sama5d3_xplained_mmc_defconfig +++ b/configs/sama5d3_xplained_mmc_defconfig @@ -85,6 +85,10 @@ CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y diff --git a/configs/sama5d3_xplained_nandflash_defconfig b/configs/sama5d3_xplained_nandflash_defconfig index a06f524d0c..64946f5d74 100644 --- a/configs/sama5d3_xplained_nandflash_defconfig +++ b/configs/sama5d3_xplained_nandflash_defconfig @@ -88,6 +88,10 @@ CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y diff --git a/configs/sama5d3xek_mmc_defconfig b/configs/sama5d3xek_mmc_defconfig index 8bb3706076..2e640ffc99 100644 --- a/configs/sama5d3xek_mmc_defconfig +++ b/configs/sama5d3xek_mmc_defconfig @@ -93,6 +93,10 @@ CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y diff --git a/configs/sama5d3xek_nandflash_defconfig b/configs/sama5d3xek_nandflash_defconfig index b4568cda31..f97faff02b 100644 --- a/configs/sama5d3xek_nandflash_defconfig +++ b/configs/sama5d3xek_nandflash_defconfig @@ -95,6 +95,10 @@ CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y diff --git a/configs/sama5d3xek_spiflash_defconfig b/configs/sama5d3xek_spiflash_defconfig index 03c2b208b6..33a4550277 100644 --- a/configs/sama5d3xek_spiflash_defconfig +++ b/configs/sama5d3xek_spiflash_defconfig @@ -94,6 +94,10 @@ CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y diff --git a/configs/sama5d4_xplained_mmc_defconfig b/configs/sama5d4_xplained_mmc_defconfig index 878f3a316f..3e60b7c9d5 100644 --- a/configs/sama5d4_xplained_mmc_defconfig +++ b/configs/sama5d4_xplained_mmc_defconfig @@ -86,6 +86,10 @@ CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y diff --git a/configs/sama5d4_xplained_nandflash_defconfig b/configs/sama5d4_xplained_nandflash_defconfig index 1061762579..c44d30cbe0 100644 --- a/configs/sama5d4_xplained_nandflash_defconfig +++ b/configs/sama5d4_xplained_nandflash_defconfig @@ -90,6 +90,10 @@ CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y diff --git a/configs/sama5d4_xplained_spiflash_defconfig b/configs/sama5d4_xplained_spiflash_defconfig index 21e9fc3bf1..9567cb1218 100644 --- a/configs/sama5d4_xplained_spiflash_defconfig +++ b/configs/sama5d4_xplained_spiflash_defconfig @@ -92,6 +92,10 @@ CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y diff --git a/configs/sama5d4ek_mmc_defconfig b/configs/sama5d4ek_mmc_defconfig index 01b2a587df..e31599af3f 100644 --- a/configs/sama5d4ek_mmc_defconfig +++ b/configs/sama5d4ek_mmc_defconfig @@ -84,6 +84,10 @@ CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y diff --git a/configs/sama5d4ek_nandflash_defconfig b/configs/sama5d4ek_nandflash_defconfig index 25e2b98893..0a6ae70cc9 100644 --- a/configs/sama5d4ek_nandflash_defconfig +++ b/configs/sama5d4ek_nandflash_defconfig @@ -88,6 +88,10 @@ CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y diff --git a/configs/sama5d4ek_spiflash_defconfig b/configs/sama5d4ek_spiflash_defconfig index 484df6a4c6..ef659d1706 100644 --- a/configs/sama5d4ek_spiflash_defconfig +++ b/configs/sama5d4ek_spiflash_defconfig @@ -87,6 +87,10 @@ CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_USB=y diff --git a/configs/sama7g5ek_mmc1_defconfig b/configs/sama7g5ek_mmc1_defconfig index 4ad8115d3a..85e409a2a7 100644 --- a/configs/sama7g5ek_mmc1_defconfig +++ b/configs/sama7g5ek_mmc1_defconfig @@ -71,6 +71,9 @@ CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_MCHP_PIT64B_TIMER=y CONFIG_OF_LIBFDT_OVERLAY=y # CONFIG_EFI_LOADER_HII is not set diff --git a/configs/sama7g5ek_mmc_defconfig b/configs/sama7g5ek_mmc_defconfig index 7bbe6565ef..f6627b886e 100644 --- a/configs/sama7g5ek_mmc_defconfig +++ b/configs/sama7g5ek_mmc_defconfig @@ -71,6 +71,9 @@ CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_TIMER=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y CONFIG_MCHP_PIT64B_TIMER=y CONFIG_OF_LIBFDT_OVERLAY=y # CONFIG_EFI_LOADER_HII is not set diff --git a/configs/vinco_defconfig b/configs/vinco_defconfig index 2eb22829ee..2908a2b976 100644 --- a/configs/vinco_defconfig +++ b/configs/vinco_defconfig @@ -55,3 +55,6 @@ CONFIG_USB_GADGET=y CONFIG_USB_GADGET_MANUFACTURER="L+G VInCo" CONFIG_USB_GADGET_ATMEL_USBA=y CONFIG_USB_ETHER=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_CMD_RESET=y +CONFIG_SYSRESET_AT91=y

This commit adds a condition to the Makefile so that whenever the SYSRESET option is chosen in the configuration, the default reset driver is ignored.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com --- arch/arm/mach-at91/arm926ejs/Makefile | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/arm/mach-at91/arm926ejs/Makefile b/arch/arm/mach-at91/arm926ejs/Makefile index c1904d535b..72133e7f85 100644 --- a/arch/arm/mach-at91/arm926ejs/Makefile +++ b/arch/arm/mach-at91/arm926ejs/Makefile @@ -19,7 +19,9 @@ obj-$(CONFIG_AT91_EFLASH) += eflash.o obj-$(CONFIG_AT91_LED) += led.o obj-y += clock.o obj-y += cpu.o +ifndef CONFIG_$(SPL_TPL_)SYSRESET obj-y += reset.o +endif ifneq ($(CONFIG_ATMEL_PIT_TIMER),y) ifneq ($(CONFIG_MCHP_PIT64B_TIMER),y) # old non-DM timer driver

This commit removes the default reset driver for armv7, since it is no longer needed due to the presence of the SYSRESET driver.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com --- arch/arm/mach-at91/armv7/Makefile | 3 --- arch/arm/mach-at91/armv7/reset.c | 31 ------------------------------- 2 files changed, 34 deletions(-) delete mode 100644 arch/arm/mach-at91/armv7/reset.c
diff --git a/arch/arm/mach-at91/armv7/Makefile b/arch/arm/mach-at91/armv7/Makefile index 246050b67b..41f2b2c60b 100644 --- a/arch/arm/mach-at91/armv7/Makefile +++ b/arch/arm/mach-at91/armv7/Makefile @@ -11,9 +11,6 @@ obj-$(CONFIG_SAMA5D3) += sama5d3_devices.o clock.o obj-$(CONFIG_SAMA5D4) += sama5d4_devices.o clock.o obj-$(CONFIG_SAMA7G5) += sama7g5_devices.o obj-y += cpu.o -ifndef CONFIG_$(SPL_TPL_)SYSRESET -obj-y += reset.o -endif ifneq ($(CONFIG_ATMEL_PIT_TIMER),y) ifneq ($(CONFIG_MCHP_PIT64B_TIMER),y) # old non-DM timer driver diff --git a/arch/arm/mach-at91/armv7/reset.c b/arch/arm/mach-at91/armv7/reset.c deleted file mode 100644 index 1ea415ea9e..0000000000 --- a/arch/arm/mach-at91/armv7/reset.c +++ /dev/null @@ -1,31 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * (C) Copyright 2007-2008 - * Stelian Pop stelian@popies.net - * Lead Tech Design <www.leadtechdesign.com> - * - * (C) Copyright 2013 - * Bo Shen voice.shen@atmel.com - */ - -#include <common.h> -#include <cpu_func.h> -#include <asm/io.h> -#include <asm/arch/hardware.h> -#include <asm/arch/at91_rstc.h> - -/* Reset the cpu by telling the reset controller to do so */ -void reset_cpu(void) -{ - at91_rstc_t *rstc = (at91_rstc_t *)ATMEL_BASE_RSTC; - - writel(AT91_RSTC_KEY - | AT91_RSTC_CR_PROCRST /* Processor Reset */ - | AT91_RSTC_CR_PERRST /* Peripheral Reset */ -#ifdef CONFIG_AT91RESET_EXTRST - | AT91_RSTC_CR_EXTRST /* External Reset (assert nRST pin) */ -#endif - , &rstc->cr); - /* never reached */ - do { } while (1); -}

On 4/1/22 12:27 PM, Sergiu Moga wrote:
This patch series implements the Atmel/Microchip sysreset driver. It also adds the missing RSTC node to the SAM9X60 and SAMA7G5 SoC files and removes the older default reset driver from armv7. The Makefile for arm926ejs has also been updated to ignore the default reset driver if SYSRESET is chosen. What is more, Atmel/Microchip defconfigs now enable sysreset by default.
Sergiu Moga (5): ARM: dts: at91: Add RSTC node sysreset: Add Atmel/Microchip sysreset driver configs: at91: Enable SYSRESET for Atmel/Microchip's platforms ARM: mach-at91: arm926ejs: Add SYSRESET conditional ARM: mach-at91: armv7: Remove default reset driver
arch/arm/dts/sam9x60.dtsi | 6 ++ arch/arm/dts/sama7g5.dtsi | 7 ++ arch/arm/mach-at91/arm926ejs/Makefile | 2 + arch/arm/mach-at91/armv7/Makefile | 3 - arch/arm/mach-at91/armv7/reset.c | 31 -------- configs/sam9x60ek_mmc_defconfig | 3 + configs/sam9x60ek_nandflash_defconfig | 3 + configs/sam9x60ek_qspiflash_defconfig | 3 + configs/sama5d27_giantboard_defconfig | 4 ++ configs/sama5d27_som1_ek_mmc1_defconfig | 4 ++ configs/sama5d27_som1_ek_mmc_defconfig | 4 ++ configs/sama5d27_som1_ek_qspiflash_defconfig | 4 ++ configs/sama5d27_wlsom1_ek_mmc_defconfig | 4 ++ .../sama5d27_wlsom1_ek_qspiflash_defconfig | 4 ++ configs/sama5d2_icp_mmc_defconfig | 4 ++ configs/sama5d2_icp_qspiflash_defconfig | 3 + configs/sama5d2_ptc_ek_mmc_defconfig | 3 + configs/sama5d2_ptc_ek_nandflash_defconfig | 3 + configs/sama5d2_xplained_emmc_defconfig | 4 ++ configs/sama5d2_xplained_mmc_defconfig | 4 ++ configs/sama5d2_xplained_qspiflash_defconfig | 4 ++ configs/sama5d2_xplained_spiflash_defconfig | 4 ++ configs/sama5d36ek_cmp_mmc_defconfig | 3 + configs/sama5d36ek_cmp_nandflash_defconfig | 3 + configs/sama5d36ek_cmp_spiflash_defconfig | 3 + configs/sama5d3_xplained_mmc_defconfig | 4 ++ configs/sama5d3_xplained_nandflash_defconfig | 4 ++ configs/sama5d3xek_mmc_defconfig | 4 ++ configs/sama5d3xek_nandflash_defconfig | 4 ++ configs/sama5d3xek_spiflash_defconfig | 4 ++ configs/sama5d4_xplained_mmc_defconfig | 4 ++ configs/sama5d4_xplained_nandflash_defconfig | 4 ++ configs/sama5d4_xplained_spiflash_defconfig | 4 ++ configs/sama5d4ek_mmc_defconfig | 4 ++ configs/sama5d4ek_nandflash_defconfig | 4 ++ configs/sama5d4ek_spiflash_defconfig | 4 ++ configs/sama7g5ek_mmc1_defconfig | 3 + configs/sama7g5ek_mmc_defconfig | 3 + configs/vinco_defconfig | 3 + drivers/sysreset/Kconfig | 15 ++++ drivers/sysreset/Makefile | 1 + drivers/sysreset/sysreset_at91.c | 71 +++++++++++++++++++ 42 files changed, 226 insertions(+), 34 deletions(-) delete mode 100644 arch/arm/mach-at91/armv7/reset.c create mode 100644 drivers/sysreset/sysreset_at91.c
Applied to u-boot-at91/master , thanks !
participants (2)
-
Eugen.Hristev@microchip.com
-
Sergiu Moga