From patchwork Wed Jan 15 14:49:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudius Heine X-Patchwork-Id: 239616 List-Id: U-Boot discussion From: ch at denx.de (Claudius Heine) Date: Wed, 15 Jan 2020 15:49:32 +0100 Subject: [RFC PATCH] imx: imx8mm-evk/imx8mn-evk: enable sysreset driver for SPL In-Reply-To: <65d46ac8-a5f5-505c-4991-59fe4d946341@denx.de> References: <65d46ac8-a5f5-505c-4991-59fe4d946341@denx.de> Message-ID: <20200115144938.730627-1-ch@denx.de> Hi, I have only tested compiling, but if the reset in the SPL on i.MX8MM and i.MX8MN still works with this patch applied, then we don't need board specific 'do_reset' function and special configurations flags for this case. I currently don't have access to the hardware to test this. regards, Claudius -- >8 -- Subject: [RFC PATCH] imx: imx8mm-evk/imx8mn-evk: enable sysreset driver for SPL Instead of implementing a custom reset function for the SPL, it can directly use the sysreset DM driver. Signed-off-by: Claudius Heine Reviewed-by: Simon Glass --- arch/arm/mach-imx/imx8m/soc.c | 19 ------------------- board/freescale/imx8mm_evk/spl.c | 9 --------- board/freescale/imx8mn_evk/spl.c | 9 --------- configs/imx8mm_evk_defconfig | 1 + configs/imx8mn_ddr4_evk_defconfig | 1 + 5 files changed, 2 insertions(+), 37 deletions(-) diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c index 5ce5a180e8..519108d4c9 100644 --- a/arch/arm/mach-imx/imx8m/soc.c +++ b/arch/arm/mach-imx/imx8m/soc.c @@ -378,22 +378,3 @@ int ft_system_setup(void *blob, bd_t *bd) return 0; } #endif - -#if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SYSRESET) -void reset_cpu(ulong addr) -{ - struct watchdog_regs *wdog = (struct watchdog_regs *)addr; - - if (!addr) - wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR; - - /* Clear WDA to trigger WDOG_B immediately */ - writew((WCR_WDE | WCR_SRS), &wdog->wcr); - - while (1) { - /* - * spin for .5 seconds before reset - */ - } -} -#endif diff --git a/board/freescale/imx8mm_evk/spl.c b/board/freescale/imx8mm_evk/spl.c index 2d08f9a563..e8dec452ea 100644 --- a/board/freescale/imx8mm_evk/spl.c +++ b/board/freescale/imx8mm_evk/spl.c @@ -159,12 +159,3 @@ void board_init_f(ulong dummy) board_init_r(NULL, 0); } - -int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{ - puts ("resetting ...\n"); - - reset_cpu(WDOG1_BASE_ADDR); - - return 0; -} diff --git a/board/freescale/imx8mn_evk/spl.c b/board/freescale/imx8mn_evk/spl.c index cbde9f6b3c..0c70fbb155 100644 --- a/board/freescale/imx8mn_evk/spl.c +++ b/board/freescale/imx8mn_evk/spl.c @@ -112,12 +112,3 @@ void board_init_f(ulong dummy) board_init_r(NULL, 0); } - -int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{ - puts("resetting ...\n"); - - reset_cpu(WDOG1_BASE_ADDR); - - return 0; -} diff --git a/configs/imx8mm_evk_defconfig b/configs/imx8mm_evk_defconfig index 87560ef989..c07f4104f9 100644 --- a/configs/imx8mm_evk_defconfig +++ b/configs/imx8mm_evk_defconfig @@ -83,5 +83,6 @@ CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_MXC_UART=y CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_PSCI=y CONFIG_DM_THERMAL=y diff --git a/configs/imx8mn_ddr4_evk_defconfig b/configs/imx8mn_ddr4_evk_defconfig index 50b03d0763..c55998da4c 100644 --- a/configs/imx8mn_ddr4_evk_defconfig +++ b/configs/imx8mn_ddr4_evk_defconfig @@ -75,5 +75,6 @@ CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_MXC_UART=y CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_PSCI=y CONFIG_DM_THERMAL=y