ARM: imx: Do not define do_reset() if sysreset is enabled
Subsystems (3)
PATCH 1/5 ARM: imx: Do not define do_reset() if sysreset is enabled
The SPL can also be compiled with sysreset drivers just fine, so update the condition to cater for that option.
--- arch/arm/mach-imx/imx8m/soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/imx8m/soc.c +1 -1
@@ -382,7 +382,7 @@ int ft_system_setup(void *blob, bd_t *bd) }#endif -#if defined(CONFIG_SPL_BUILD ) || !defined(CONFIG_SYSRESET ) +#if !CONFIG_IS_ENABLED (SYSRESET )void reset_cpu (ulong addr) {struct watchdog_regs *wdog = (struct watchdog_regs *)addr;
Signature · 1 line
2.25.1
PATCH 2/5 ARM: imx: Fix reset in SPL on NXP iMX8MM EVK
Board files should not re-implement do_reset() to work around this function not being defined in for specific configurations. Rather, the fix is to compile in drivers which implement this properly. This patch enables sysreset and watchdog drivers in SPL and ties them together to implement the same as the do_reset() hack in the board file, except correctly in the DM/DT framework.
--- arch/arm/dts/imx8mm-evk-u-boot.dtsi | 12 ++++++++++++ board/freescale/imx8mm_evk/spl.c | 9 --------- configs/imx8mm_evk_defconfig | 5 +++++ 3 files changed, 17 insertions(+), 9 deletions(-)
arch/arm/dts/imx8mm-evk-u-boot.dtsi +12 -0
@@ -3,6 +3,14 @@ * Copyright 2019 NXP */ +/ { + wdt-reboot { + compatible = "wdt-reboot"; + wdt = <&wdog1>; + u-boot,dm-spl; + }; +}; + &{/soc at 0} { u-boot,dm-pre-reloc; u-boot,dm-spl;
@@ -117,3 +125,7 @@ &fec1 { phy-reset-gpios = <&gpio4 22 GPIO_ACTIVE_LOW>; }; + +&wdog1 { + u-boot,dm-spl; +};
board/freescale/imx8mm_evk/spl.c +0 -9
@@ -161,12 +161,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 ; -}
configs/imx8mm_evk_defconfig +5 -0
@@ -30,6 +30,7 @@ CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_POWER_SUPPORT=y +CONFIG_SPL_WATCHDOG_SUPPORT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="u-boot=> " # CONFIG_CMD_EXPORTENV is not set
@@ -82,5 +83,9 @@ 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_SYSRESET_WATCHDOG=y CONFIG_DM_THERMAL=y +# CONFIG_WATCHDOG is not set +CONFIG_IMX_WATCHDOG=y
Signature · 1 line
2.25.1
PATCH 3/5 ARM: imx: Fix reset in SPL on NXP iMX8MN EVK
In reply to Marek VasutBoard files should not re-implement do_reset() to work around this function not being defined in for specific configurations. Rather, the fix is to compile in drivers which implement this properly. This patch enables sysreset and watchdog drivers in SPL and ties them together to implement the same as the do_reset() hack in the board file, except correctly in the DM/DT framework.
--- arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi | 12 ++++++++++++ board/freescale/imx8mn_evk/spl.c | 9 --------- configs/imx8mn_ddr4_evk_defconfig | 5 +++++ 3 files changed, 17 insertions(+), 9 deletions(-)
arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi +12 -0
@@ -3,6 +3,14 @@ * Copyright 2019 NXP */ +/ { + wdt-reboot { + compatible = "wdt-reboot"; + wdt = <&wdog1>; + u-boot,dm-spl; + }; +}; + &{/soc at 0} { u-boot,dm-pre-reloc; u-boot,dm-spl;
@@ -90,3 +98,7 @@ &usdhc3 { u-boot,dm-spl; }; + +&wdog1 { + u-boot,dm-spl; +};
board/freescale/imx8mn_evk/spl.c +0 -9
@@ -114,12 +114,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 ; -}
configs/imx8mn_ddr4_evk_defconfig +5 -0
@@ -32,6 +32,7 @@ CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_BOOTROM_SUPPORT=y CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_I2C_SUPPORT=y +CONFIG_SPL_WATCHDOG_SUPPORT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="u-boot=> " # CONFIG_CMD_EXPORTENV is not set
@@ -76,5 +77,9 @@ 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_SYSRESET_WATCHDOG=y CONFIG_DM_THERMAL=y +# CONFIG_WATCHDOG is not set +CONFIG_IMX_WATCHDOG=y
Signature · 1 line
2.25.1
PATCH 4/5 ARM: imx: Fix reset in SPL on NXP iMX8MP EVK
In reply to Marek VasutBoard files should not re-implement do_reset() to work around this function not being defined in for specific configurations. Rather, the fix is to compile in drivers which implement this properly. This patch enables sysreset and watchdog drivers in SPL and ties them together to implement the same as the do_reset() hack in the board file, except correctly in the DM/DT framework.
--- arch/arm/dts/imx8mp-evk-u-boot.dtsi | 12 ++++++++++++ board/freescale/imx8mp_evk/spl.c | 9 --------- configs/imx8mp_evk_defconfig | 4 ++++ 3 files changed, 16 insertions(+), 9 deletions(-)
arch/arm/dts/imx8mp-evk-u-boot.dtsi +12 -0
@@ -3,6 +3,14 @@ * Copyright 2019 NXP */ +/ { + wdt-reboot { + compatible = "wdt-reboot"; + wdt = <&wdog1>; + u-boot,dm-spl; + }; +}; + &{/soc at 0} { u-boot,dm-pre-reloc; u-boot,dm-spl;
@@ -119,3 +127,7 @@ &usdhc3 { u-boot,dm-spl; }; + +&wdog1 { + u-boot,dm-spl; +};
board/freescale/imx8mp_evk/spl.c +0 -9
@@ -149,12 +149,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 ; -}
configs/imx8mp_evk_defconfig +4 -0
@@ -81,4 +81,8 @@ 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_SYSRESET_WATCHDOG=y +# CONFIG_WATCHDOG is not set +CONFIG_IMX_WATCHDOG=y
Signature · 1 line
2.25.1
PATCH 5/5 ARM: imx: Fix reset in SPL on Toradex iMX8MM Verdin
In reply to Marek VasutBoard files should not re-implement do_reset() to work around this function not being defined in for specific configurations. Rather, the fix is to compile in drivers which implement this properly. This patch enables sysreset and watchdog drivers in SPL and ties them together to implement the same as the do_reset() hack in the board file, except correctly in the DM/DT framework.
--- arch/arm/dts/imx8mm-verdin-u-boot.dtsi | 12 ++++++++++++ board/toradex/verdin-imx8mm/spl.c | 9 --------- configs/verdin-imx8mm_defconfig | 5 +++++ 3 files changed, 17 insertions(+), 9 deletions(-)
arch/arm/dts/imx8mm-verdin-u-boot.dtsi +12 -0
@@ -3,6 +3,14 @@ * Copyright 2020 Toradex */ +/ { + wdt-reboot { + compatible = "wdt-reboot"; + wdt = <&wdog1>; + u-boot,dm-spl; + }; +}; + &aips1 { u-boot,dm-spl; u-boot,dm-pre-reloc;
@@ -105,3 +113,7 @@ &usdhc3 { u-boot,dm-spl; }; + +&wdog1 { + u-boot,dm-spl; +};
board/toradex/verdin-imx8mm/spl.c +0 -9
@@ -169,12 +169,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 ; -}
configs/verdin-imx8mm_defconfig +5 -0
@@ -38,6 +38,7 @@ CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_POWER_SUPPORT=y CONFIG_SPL_USB_HOST_SUPPORT=y +CONFIG_SPL_WATCHDOG_SUPPORT=y CONFIG_SYS_PROMPT="Verdin iMX8MM # " # CONFIG_BOOTM_NETBSD is not set CONFIG_CMD_ASKENV=y
@@ -94,5 +95,9 @@ 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_SYSRESET_WATCHDOG=y CONFIG_DM_THERMAL=y +# CONFIG_WATCHDOG is not set +CONFIG_IMX_WATCHDOG=y
Signature · 1 line
2.25.1
PATCH 1/5 ARM: imx: Do not define do_reset() if sysreset is enabled
In reply to Marek VasutHello Marek,
Quoted 2 lines · Marek Vasut
The SPL can also be compiled with sysreset drivers just fine, so update the condition to cater for that option.
Me and Claudius solved the same problem in a different way a while back (see [1] and [2]).
The two approaches overlap but both contain some unique code that is useful. I'll merge the two patchsets and send them anew if that is ok with you.
[1]: https://lists.denx.de/pipermail/u-boot/2020-March/401935.html
[2]: https://patchwork.ozlabs.org/project/uboot/list/?series=162379
Quoted 26 lines
Signed-off-by Marek Vasut <[email protected]>Cc Fabio Estevam <[email protected]>Cc Flavio Suligoi <[email protected]>Cc Harald Seiler <[email protected]>Cc Igor Opaniuk <[email protected]>Cc Marcel Ziswiler <[email protected]>Cc Oleksandr Suvorov <[email protected]>Cc Peng Fan <[email protected]>Cc Stefano Babic <[email protected]>--- arch/arm/mach-imx/imx8m/soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/mach-imx/imx8m/soc.c +1
-1@@ -382,7 +382,7 @@ int ft_system_setup(void *blob, bd_t *bd) }#endif -#if defined(CONFIG_SPL_BUILD ) || !defined(CONFIG_SYSRESET ) +#if !CONFIG_IS_ENABLED (SYSRESET )void reset_cpu (ulong addr) {struct watchdog_regs *wdog = (struct watchdog_regs *)addr;
Signature · 5 lines
Harald DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-62 Fax: +49-8142-66989-80 Email: hws at denx.de
PATCH 1/5 ARM: imx: Do not define do_reset() if sysreset is enabled
Quoted 1 line · Harald Seiler
Hello Marek,
Hi,
Quoted 10 lines · Marek Vasut
Quoted 2 lines
The SPL can also be compiled with sysreset drivers just fine, so update the condition to cater for that option.
Me and Claudius solved the same problem in a different way a while back (see [1] and [2]).
The two approaches overlap but both contain some unique code that is useful. I'll merge the two patchsets and send them anew if that is ok with you.
Can you be more specific about what is your plan ?
Since the MX8M already has DM enabled in SPL for quite a few things and has enough SRAM space left, I would be inclined to just go with DM-based implementation of the reset over a non-DM one.
PATCH 1/5 ARM: imx: Do not define do_reset() if sysreset is enabled
Hello Marek,
Quoted 16 lines · Marek Vasut
Quoted 1 line · Harald Seiler
Hello Marek,
Hi,
Quoted 10 lines · Marek Vasut
Quoted 2 lines
The SPL can also be compiled with sysreset drivers just fine, so update the condition to cater for that option.
Me and Claudius solved the same problem in a different way a while back (see [1] and [2]).
The two approaches overlap but both contain some unique code that is useful. I'll merge the two patchsets and send them anew if that is ok with you.
Quoted 5 lines
Can you be more specific about what is your plan ?
Since the MX8M already has DM enabled in SPL for quite a few things and has enough SRAM space left, I would be inclined to just go with DM-based implementation of the reset over a non-DM one.
For me personally, the patch I care most about is the first of Claudius and my series ("ARM: reset: use do_reset in SPL/TPL if SYSRESET was not enabled for them") [1]. It is necessary to make SPL_USB_SDP_SUPPORT work on the DH imx6 board (which does not use SYSRESET in SPL at the moment).
As this patch breaks the imx8m* boards in their present form, we tried fixing them in their current non-DM state in "imx: imx8m*: Remove do_reset from board files" [2] and "imx: imx8m: Don't use the addr parameter of reset_cpu" [3]. These patches are theoretically superseeded by your series which solves the problem much better and more future-proof. But I think it would not hurt to pull in Claudius and my changes as well so the non-DM version isn't lying around, silently broken.
Additionally, "imx: imx8m: Don't use the addr parameter of reset_cpu" [3] is groundwork for removing this addr parameter altogether from the whole tree which I want to do after this imx8 story is over.
So to summarize, the final state I'd want is this:
- "ARM: reset: use do_reset in SPL/TPL if SYSRESET was not enabled for them" is applied for my own needs.
- No board defines do_reset().
- The imx8m boards use DM_SYSRESET in SPL (from your patches).
- The non-DM reset code for imx8 is also fixed, even though it is not used in any mainline board anymore.
[1]: https://patchwork.ozlabs.org/project/uboot/patch/62c163018998fcf476f0ad2edf83d1787d69445d.1583328917.git.hws at denx.de/ [2]: https://patchwork.ozlabs.org/project/uboot/patch/25277ba3658920ff3be7464020438070844f05da.1583328917.git.hws at denx.de/ [3]: https://patchwork.ozlabs.org/project/uboot/patch/b31a2cbb66950bff2e09ab07b710d53d9d46cf09.1583328917.git.hws at denx.de/
Signature · 1 line
Harald
PATCH 1/5 ARM: imx: Do not define do_reset() if sysreset is enabled
Quoted 1 line · Harald Seiler
Hello Marek,
Hi,
Quoted 40 lines · Marek Vasut
Quoted 16 lines · Harald Seiler
Quoted 1 line
Hello Marek,
Hi,
Quoted 10 lines · Marek Vasut
Quoted 2 lines
The SPL can also be compiled with sysreset drivers just fine, so update the condition to cater for that option.
Me and Claudius solved the same problem in a different way a while back (see [1] and [2]).
The two approaches overlap but both contain some unique code that is useful. I'll merge the two patchsets and send them anew if that is ok with you.
Quoted 5 lines
Can you be more specific about what is your plan ?
Since the MX8M already has DM enabled in SPL for quite a few things and has enough SRAM space left, I would be inclined to just go with DM-based implementation of the reset over a non-DM one.
For me personally, the patch I care most about is the first of Claudius and my series ("ARM: reset: use
do_resetin SPL/TPL if SYSRESET was not enabled for them") [1]. It is necessary to makeSPL_USB_SDP_SUPPORTwork on the DH imx6 board (which does not use SYSRESET in SPL at the moment).As this patch breaks the imx8m* boards in their present form, we tried fixing them in their current non-DM state in "imx: imx8m*: Remove
do_resetfrom board files" [2] and "imx: imx8m: Don't use the addr parameter ofreset_cpu" [3]. These patches are theoretically superseeded by your series which solves the problem much better and more future-proof. But I think it would not hurt to pull in Claudius and my changes as well so the non-DM version isn't lying around, silently broken.Additionally, "imx: imx8m: Don't use the addr parameter of
reset_cpu" [3] is groundwork for removing this addr parameter altogether from the whole tree which I want to do after this imx8 story is over.
Quoted 8 lines
So to summarize, the final state I'd want is this:
- "ARM: reset: use
do_resetin SPL/TPL if SYSRESET was not enabled for them" is applied for my own needs.
- No board definesdo_reset().
- The imx8m boards useDM_SYSRESETin SPL (from your patches).
- The non-DM reset code for imx8 is also fixed, even though it is not used in any mainline board anymore.
All right, I totally forgot about the MX6 SDP. So go ahead, prepare a series and let's see how that looks.