From e7b5250612ed4ffbf962911d49c6bb4c520eb1f2 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Wed, 27 Mar 2024 08:49:59 -0300 Subject: mx6cuboxi: Fix board revision detection Currently, an i.MX6 Cuboxi board is incorrectly detected as the HummingBoard model: U-Boot 2024.04-rc5 (Mar 26 2024 - 15:59:22 +0100) CPU: Freescale i.MX6Q rev1.3 996 MHz (running at 792 MHz) CPU: Extended Commercial temperature grade (-20C to 105C) at 26C Reset cause: POR Model: SolidRun HummingBoard2 Dual/Quad (1.5som+emmc) gpio@20a4000: set_dir_flags: error: gpio GPIO3_8 not reserved gpio@20a4000: get_value: error: gpio GPIO3_8 not reserved gpio@20a8000: set_dir_flags: error: gpio GPIO4_4 not reserved gpio@20a8000: get_value: error: gpio GPIO4_4 not reserved gpio@20b0000: set_dir_flags: error: gpio GPIO6_9 not reserved gpio@20b0000: get_value: error: gpio GPIO6_9 not reserved Board: MX6 HummingBoard DRAM: 2 GiB ... This error happens because request_detect_gpios() uses the GPIO DM API, but board_type() still uses the legacy non-DM GPIO API. Fix it by using the GPIO DM API in board_type() to read the board revision pins in SPL. Reported-by: Christian Gmeiner Signed-off-by: Fabio Estevam Tested-by: Christian Gmeiner --- board/solidrun/mx6cuboxi/mx6cuboxi.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c index 8edabf4404c..7dffb96f0a2 100644 --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c @@ -336,20 +336,17 @@ static enum board_type board_type(void) * HB 1 1 x */ - gpio_direction_input(IMX_GPIO_NR(2, 8)); - val3 = gpio_get_value(IMX_GPIO_NR(2, 8)); + val3 = !!dm_gpio_get_value(&board_detect_desc[0]); if (val3 == 0) return HUMMINGBOARD2; - gpio_direction_input(IMX_GPIO_NR(3, 4)); - val2 = gpio_get_value(IMX_GPIO_NR(3, 4)); + val2 = !!dm_gpio_get_value(&board_detect_desc[1]); if (val2 == 0) return HUMMINGBOARD; - gpio_direction_input(IMX_GPIO_NR(4, 9)); - val1 = gpio_get_value(IMX_GPIO_NR(4, 9)); + val1 = !!dm_gpio_get_value(&board_detect_desc[2]); if (val1 == 0) { return CUBOXI; @@ -363,8 +360,8 @@ static bool is_rev_15_som(void) int val1, val2; SETUP_IOMUX_PADS(som_rev_detect); - val1 = gpio_get_value(IMX_GPIO_NR(6, 0)); - val2 = gpio_get_value(IMX_GPIO_NR(6, 4)); + val1 = !!dm_gpio_get_value(&board_detect_desc[3]); + val2 = !!dm_gpio_get_value(&board_detect_desc[4]); if (val1 == 1 && val2 == 0) return true; -- cgit v1.2.3 From ea2b074a1ca646a9a88454753af0676599917b02 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Wed, 27 Mar 2024 10:46:51 -0300 Subject: warp7: Convert to watchdog driver model Commit 68dcbdd594d4 ("ARM: imx: Add weak default reset_cpu()") caused the 'reset' command in U-Boot to not cause a board reset. Fix it by switching to the watchdog driver model via sysreset, which is the preferred method for implementing the watchdog reset. Signed-off-by: Fabio Estevam Reviewed-by: Peng Fan --- arch/arm/dts/imx7s-warp-u-boot.dtsi | 10 ++++++++++ configs/warp7_defconfig | 3 +++ 2 files changed, 13 insertions(+) diff --git a/arch/arm/dts/imx7s-warp-u-boot.dtsi b/arch/arm/dts/imx7s-warp-u-boot.dtsi index 4f44598c9a2..98784fd7a2e 100644 --- a/arch/arm/dts/imx7s-warp-u-boot.dtsi +++ b/arch/arm/dts/imx7s-warp-u-boot.dtsi @@ -7,6 +7,12 @@ chosen { stdout-path = &uart1; }; + + wdt-reboot { + compatible = "wdt-reboot"; + wdt = <&wdog1>; + bootph-pre-ram; + }; }; &aips3 { @@ -24,3 +30,7 @@ &uart1 { bootph-all; }; + +&wdog1 { + bootph-pre-ram; +}; diff --git a/configs/warp7_defconfig b/configs/warp7_defconfig index 9b518a121be..48042b702c2 100644 --- a/configs/warp7_defconfig +++ b/configs/warp7_defconfig @@ -67,6 +67,8 @@ CONFIG_DM_REGULATOR_GPIO=y CONFIG_SPECIFY_CONSOLE_INDEX=y CONFIG_DM_SERIAL=y CONFIG_MXC_UART=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_WATCHDOG=y CONFIG_IMX_THERMAL=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y @@ -80,5 +82,6 @@ CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_USB_ETHER=y CONFIG_USB_ETH_CDC=y CONFIG_USBNET_HOST_ADDR="de:ad:be:af:00:00" +CONFIG_IMX_WATCHDOG=y CONFIG_OPTEE_TZDRAM_SIZE=0x3000000 CONFIG_BOOTM_OPTEE=y -- cgit v1.2.3 From fc07cac02adebc87b69cd82f6ca6f0283d11cd5a Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Wed, 27 Mar 2024 11:18:49 -0300 Subject: mx6cuboxi: Convert to watchdog driver model Commit 68dcbdd594d4 ("ARM: imx: Add weak default reset_cpu()") caused the 'reset' command in U-Boot to not cause a board reset. Fix it by switching to the watchdog driver model via sysreset, which is the preferred method for implementing the watchdog reset. Signed-off-by: Fabio Estevam Tested-by: Christian Gmeiner --- arch/arm/dts/imx6qdl-hummingboard2-emmc-som-v15-u-boot.dtsi | 10 ++++++++++ configs/mx6cuboxi_defconfig | 3 +++ 2 files changed, 13 insertions(+) diff --git a/arch/arm/dts/imx6qdl-hummingboard2-emmc-som-v15-u-boot.dtsi b/arch/arm/dts/imx6qdl-hummingboard2-emmc-som-v15-u-boot.dtsi index 23a05773b57..e9b188ed658 100644 --- a/arch/arm/dts/imx6qdl-hummingboard2-emmc-som-v15-u-boot.dtsi +++ b/arch/arm/dts/imx6qdl-hummingboard2-emmc-som-v15-u-boot.dtsi @@ -13,6 +13,12 @@ &gpio6 4 0 >; }; + + wdt-reboot { + compatible = "wdt-reboot"; + wdt = <&wdog1>; + bootph-pre-ram; + }; }; &soc { @@ -58,3 +64,7 @@ &usdhc3 { bootph-all; }; + +&wdog1 { + bootph-pre-ram; +}; diff --git a/configs/mx6cuboxi_defconfig b/configs/mx6cuboxi_defconfig index 66d4aaeda2d..27ceb22599a 100644 --- a/configs/mx6cuboxi_defconfig +++ b/configs/mx6cuboxi_defconfig @@ -71,6 +71,8 @@ CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_SERIAL=y CONFIG_MXC_UART=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_WATCHDOG=y CONFIG_DM_THERMAL=y CONFIG_IMX_THERMAL=y CONFIG_USB=y @@ -89,3 +91,4 @@ CONFIG_IMX_HDMI=y CONFIG_SPLASH_SCREEN=y CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_BMP_16BPP=y +CONFIG_IMX_WATCHDOG=y -- cgit v1.2.3