summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-10-17 09:09:59 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-10-27 11:13:29 +0200
commit7f8f629c50dce14bb83e7d4e2614bdd518ca3952 (patch)
tree0765d66204b46928a11cf584af1a989067afb04c
parent594d5d58afcdb717620ca526ab390cef91e8ba21 (diff)
downloadbarebox-7f8f629c50dce14bb83e7d4e2614bdd518ca3952.tar.gz
barebox-7f8f629c50dce14bb83e7d4e2614bdd518ca3952.tar.xz
ARM: i.MX7: describe USB serial download boot mode
Due to i.MX7 erratum e10574: "Watchdog: A watchdog timeout or software trigger will not reset the SOC", we can't do warm reset via imxwd-warm for BootROM reboot mode as we do on other i.MX SoCs. What we can do instead though, is use the SoC's reset controller to toggle the Cortex-A7's reset. This will have us reenter BootROM with GPR registers intact. Forcing serial download on the i.MX7 now possible with: gpr.reboot_mode.next=serial reset -w Note that the new restart handler is not fit for general purpose. Depending on boot medium, it may hang, because the BootROM may not reinitialize the peripheral properly. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20221017071000.1458292-8-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/configs/imx_v7_defconfig2
-rw-r--r--arch/arm/dts/imx7.dtsi37
-rw-r--r--drivers/power/reset/syscon-reboot.c1
3 files changed, 40 insertions, 0 deletions
diff --git a/arch/arm/configs/imx_v7_defconfig b/arch/arm/configs/imx_v7_defconfig
index d07abe28ae..3cbec267fc 100644
--- a/arch/arm/configs/imx_v7_defconfig
+++ b/arch/arm/configs/imx_v7_defconfig
@@ -208,6 +208,8 @@ CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED=y
CONFIG_GENERIC_PHY=y
CONFIG_USB_NOP_XCEIV=y
+CONFIG_SYSCON_REBOOT_MODE=y
+CONFIG_POWER_RESET_SYSCON=y
CONFIG_FS_EXT4=y
CONFIG_FS_TFTP=y
CONFIG_FS_TFTP_MAX_WINDOW_SIZE=8
diff --git a/arch/arm/dts/imx7.dtsi b/arch/arm/dts/imx7.dtsi
new file mode 100644
index 0000000000..1c67bdc546
--- /dev/null
+++ b/arch/arm/dts/imx7.dtsi
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
+
+#include "imx7d-ddrc.dtsi"
+
+/ {
+ aliases {
+ gpr.reboot_mode = &reboot_mode_gpr;
+ };
+};
+
+&src {
+ compatible = "fsl,imx7d-src", "syscon", "simple-mfd";
+
+ reboot_mode_gpr: reboot-mode {
+ compatible = "barebox,syscon-reboot-mode";
+ offset = <0x94>, <0x98>; /* SRC_GPR{9,10} */
+ mask = <0xffffffff>, <0x40000000>;
+ mode-normal = <0>, <0>;
+ mode-serial = <0x00000010>, <0x40000000>;
+ };
+
+ ca7_reset: cortex-a7-reboot {
+ compatible = "syscon-reboot";
+ regmap = <&src>;
+ offset = <0x4>;
+ mask = <1>;
+ value = <1>;
+ /* This is not fit for use as general purpose reset */
+ restart-priority = <5>;
+ /*
+ * Can't use imxwd-warm due to errata e10574:
+ * Watchdog: A watchdog timeout or software trigger will
+ * not reset the SOC
+ */
+ barebox,restart-warm-bootrom;
+ };
+};
diff --git a/drivers/power/reset/syscon-reboot.c b/drivers/power/reset/syscon-reboot.c
index 2dbb6c1ddc..b6b8db75ca 100644
--- a/drivers/power/reset/syscon-reboot.c
+++ b/drivers/power/reset/syscon-reboot.c
@@ -71,6 +71,7 @@ static int syscon_reboot_probe(struct device_d *dev)
ctx->restart_handler.name = "syscon-reboot";
ctx->restart_handler.restart = syscon_restart_handle;
ctx->restart_handler.priority = 192;
+ ctx->restart_handler.of_node = dev->device_node;
err = restart_handler_register(&ctx->restart_handler);
if (err)