[U-Boot] [PATCH v2 0/8] imx: add USB Serial Download Protocol (SDP) support

Fabio Estevam festevam at gmail.com
Fri Sep 1 16:48:09 UTC 2017


Hi Stefan,

On Wed, Aug 16, 2017 at 3:00 PM, Stefan Agner <stefan at agner.ch> wrote:
> From: Stefan Agner <stefan.agner at toradex.com>
>
> This series adds NXP's Serial Download Protocol (SDP) support via
> USB for SPL/U-Boot. It allows to download U-Boot via USB from a
> (recovered) SPL using the same tools used to download SPL itself
> (specifically imx_usb, but also sb_loader seems to work).
>
> The idea has been brought up when the first targets started to make
> use of SPL for DDR initialization, see:
> https://lists.denx.de/pipermail/u-boot/2015-July/220330.html
>
> The initial SDP implementation (patch 2) requires the payload to
> have the imx specific headers (hence the move of the imx header
> file in patch 1).
>
> Patch 3 extends image header support beyond the SDP specification,
> specifically implements also support for U-Boot headers. This
> allows to use the same SPL/U-Boot binaries for recovery as used on
> the regular boot device (SD/eMMC). For that to work also the host
> side imx_usb tools needed an extension, currently available here:
>
> https://github.com/toradex/imx_loader/tree/imx_usb_batch_mode_refactored
>
> (in case this patchset gets accepted in U-Boot, I plan to push
> these imx_usb changes upstream as well)
>
> The full patchset allows to download SPL and U-Boot over USB to a
> target in recovery mode using the same usb_imx utility. Refer to
> the new README.sdp for details how to use usb_imx in combination
> with this implementation.

I am trying to use this feature on a imx6qsabresd board.

Here are the changes I made (against u-boot-imx latest tree):

diff --git a/board/freescale/mx6sabresd/mx6sabresd.c
b/board/freescale/mx6sabresd/mx6sabresd.c
index 5b50bc8..6ca2485 100644
--- a/board/freescale/mx6sabresd/mx6sabresd.c
+++ b/board/freescale/mx6sabresd/mx6sabresd.c
@@ -29,6 +29,7 @@
 #include <power/pfuze100_pmic.h>
 #include "../common/pfuze.h"
 #include <usb.h>
+#include <g_dnl.h>

 DECLARE_GLOBAL_DATA_PTR;

@@ -1033,6 +1034,19 @@ static void spl_dram_init(void)
                ddr_init(mx6dl_dcd_table, ARRAY_SIZE(mx6dl_dcd_table));
 }

+#ifdef CONFIG_SPL_USB_GADGET_SUPPORT
+#define FSL_USB_PRODUCT_NUM_OFFSET        0xa4a5
+int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
+{
+       unsigned short usb_pid;
+
+       usb_pid = FSL_USB_PRODUCT_NUM_OFFSET + 0xff;
+       put_unaligned(usb_pid, &dev->idProduct);
+
+       return 0;
+}
+#endif
+
 void board_init_f(ulong dummy)
 {
        /* DDR initialization */
diff --git a/configs/mx6sabresd_defconfig b/configs/mx6sabresd_defconfig
index 7949c5e..1c08639 100644
--- a/configs/mx6sabresd_defconfig
+++ b/configs/mx6sabresd_defconfig
@@ -19,6 +19,9 @@ CONFIG_SPL=y
 CONFIG_SPL_EXT_SUPPORT=y
 CONFIG_SPL_I2C_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
+CONFIG_SPL_USB_HOST_SUPPORT=y
+CONFIG_SPL_USB_GADGET_SUPPORT=y
+CONFIG_SPL_USB_SDP_SUPPORT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_CMD_BOOTZ=y
 # CONFIG_CMD_IMLS is not set
@@ -32,6 +35,7 @@ CONFIG_CMD_PART=y
 CONFIG_CMD_PCI=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_USB=y
+CONFIG_CMD_USB_SDP=y
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y

Then I use the imx_usb tool from
https://github.com/toradex/imx_loader/tree/imx_usb_batch_mode_refactored

I remove the SD card, so that the board goes to SDP and then run:

sudo ./imx_usb SPL

and then I see in the board console:

U-Boot SPL 2017.09-rc2-36996-g63af4b0-dirty (Sep 01 2017 - 13:42:55)
Trying to boot from MMC1
MMC: no card present
mmc_init: -123, time 1
spl: mmc init failed with error: -123
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

I was expecting to see:

  Trying to boot from USB SDP
  SDP: initialize...
  SDP: handle requests...

as per the README.sdp

Any ideas as to what I am missing?

Thanks


More information about the U-Boot mailing list