]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
board: apalis/colibri imx6/imx6ull/imx7: Add fastboot bootcmd support
authorHiago De Franco <hiagofranco@gmail.com>
Thu, 9 Nov 2023 16:24:01 +0000 (13:24 -0300)
committerFabio Estevam <festevam@gmail.com>
Wed, 13 Dec 2023 13:03:14 +0000 (10:03 -0300)
This commit adds support for Fastboot boot commands by checking both
CONFIG_CMD_USB_SDP and CONFIG_USB_FUNCTION_FASTBOOT. If either of these
configurations is set, it indicates that the board is in recovery mode
and can use either SDP or Fastboot.

The default option remains the SDP command, but if
CONFIG_CMD_FASTBOOT is set, it changes to 'fastboot usb 0' as
the boot command.

Signed-off-by: Hiago De Franco <hiago.franco@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
board/toradex/apalis_imx6/apalis_imx6.c
board/toradex/colibri-imx6ull/colibri-imx6ull.c
board/toradex/colibri_imx6/colibri_imx6.c
board/toradex/colibri_imx7/colibri_imx7.c

index dc0e09991ddedd8beb8e00bfa9be232d240ade34..164fcc41f5508224434c9fe05752534a10b9fdfa 100644 (file)
@@ -701,13 +701,16 @@ int board_late_init(void)
        env_set("board_rev", env_str);
 #endif /* CONFIG_BOARD_LATE_INIT */
 
-#ifdef CONFIG_CMD_USB_SDP
-       if (is_boot_from_usb()) {
-               printf("Serial Downloader recovery mode, using sdp command\n");
+       if (IS_ENABLED(CONFIG_USB) && is_boot_from_usb()) {
                env_set("bootdelay", "0");
-               env_set("bootcmd", "sdp 0");
+               if (IS_ENABLED(CONFIG_CMD_USB_SDP)) {
+                       printf("Serial Downloader recovery mode, using sdp command\n");
+                       env_set("bootcmd", "sdp 0");
+               } else if (IS_ENABLED(CONFIG_CMD_FASTBOOT)) {
+                       printf("Fastboot recovery mode, using fastboot command\n");
+                       env_set("bootcmd", "fastboot usb 0");
+               }
        }
-#endif /* CONFIG_CMD_USB_SDP */
 
        return 0;
 }
index 6c8eeff38fa59af3e702a39d632cb83ade155503..a775f54eb3f42a506836a50902858bdcf8d15dff 100644 (file)
@@ -187,13 +187,16 @@ int board_late_init(void)
        add_board_boot_modes(board_boot_modes);
 #endif
 
-#ifdef CONFIG_CMD_USB_SDP
-       if (is_boot_from_usb()) {
-               printf("Serial Downloader recovery mode, using sdp command\n");
+       if (IS_ENABLED(CONFIG_USB) && is_boot_from_usb()) {
                env_set("bootdelay", "0");
-               env_set("bootcmd", "sdp 0");
+               if (IS_ENABLED(CONFIG_CMD_USB_SDP)) {
+                       printf("Serial Downloader recovery mode, using sdp command\n");
+                       env_set("bootcmd", "sdp 0");
+               } else if (IS_ENABLED(CONFIG_CMD_FASTBOOT)) {
+                       printf("Fastboot recovery mode, using fastboot command\n");
+                       env_set("bootcmd", "fastboot usb 0");
+               }
        }
-#endif /* CONFIG_CMD_USB_SDP */
 
 #if defined(CONFIG_VIDEO)
        setup_lcd();
index 7635c5811d263cf810add22f417d853466502ce6..784ca7f65f7bc6ea55c00fcb14c9ea4c764407aa 100644 (file)
@@ -621,13 +621,16 @@ int board_late_init(void)
        env_set("board_rev", env_str);
 #endif
 
-#ifdef CONFIG_CMD_USB_SDP
-       if (is_boot_from_usb()) {
-               printf("Serial Downloader recovery mode, using sdp command\n");
+       if (IS_ENABLED(CONFIG_USB) && is_boot_from_usb()) {
                env_set("bootdelay", "0");
-               env_set("bootcmd", "sdp 0");
+               if (IS_ENABLED(CONFIG_CMD_USB_SDP)) {
+                       printf("Serial Downloader recovery mode, using sdp command\n");
+                       env_set("bootcmd", "sdp 0");
+               } else if (IS_ENABLED(CONFIG_CMD_FASTBOOT)) {
+                       printf("Fastboot recovery mode, using fastboot command\n");
+                       env_set("bootcmd", "fastboot usb 0");
+               }
        }
-#endif /* CONFIG_CMD_USB_SDP */
 
        return 0;
 }
index c3478b15111bbd329d7cfbc15a377959e6f74357..e23f9af20da0b47bcdf5e875bca47ffb8cced473 100644 (file)
@@ -360,13 +360,17 @@ int board_late_init(void)
        setup_lcd();
 #endif
 
-#if defined(CONFIG_CMD_USB_SDP)
-       if (is_boot_from_usb()) {
-               printf("Serial Downloader recovery mode, using sdp command\n");
+       if (IS_ENABLED(CONFIG_USB) && is_boot_from_usb()) {
                env_set("bootdelay", "0");
-               env_set("bootcmd", "sdp 0");
+               if (IS_ENABLED(CONFIG_CMD_USB_SDP)) {
+                       printf("Serial Downloader recovery mode, using sdp command\n");
+                       env_set("bootcmd", "sdp 0");
+               } else if (IS_ENABLED(CONFIG_CMD_FASTBOOT)) {
+                       printf("Fastboot recovery mode, using fastboot command\n");
+                       env_set("bootcmd", "fastboot usb 0");
+               }
        }
-#endif
+
        if (is_emmc)
                env_set("variant", "-emmc");
        else