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

Stefan Agner stefan at agner.ch
Fri Sep 1 18:19:03 UTC 2017


On 2017-09-01 09:48, Fabio Estevam wrote:
> 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?


That is the issue I am describing here:
https://lists.denx.de/pipermail/u-boot/2017-August/301952.html

Either enter recovery mode explicitly (by setting the BMODE pins or
using the bmode command)

Or you can use the USB PHY method which indicates whether the ROM used
serial downloader. We use this in our downstream U-Boot (NXP used that
method to go into "mgfr" mode...)
http://git.toradex.com/cgit/u-boot-toradex.git/commit/?h=2016.11-toradex-next&id=0d069117614b590848b490e348488362443c5547
http://git.toradex.com/cgit/u-boot-toradex.git/commit/?h=2016.11-toradex-next&id=80c3bd6c2750c3c2843537f015c0d675b1b74a58

--
Stefan


More information about the U-Boot mailing list