Stefan Agner | f9c39d9 | 2017-08-16 11:00:55 -0700 | [diff] [blame] | 1 | ------------- |
| 2 | SDP in U-Boot |
| 3 | ------------- |
| 4 | |
| 5 | SDP stands for serial download protocol. It is the protocol used in NXP's |
| 6 | i.MX SoCs ROM Serial Downloader and provides means to download a program |
| 7 | image to the chip over USB and UART serial connection. |
| 8 | |
| 9 | The implementation in U-Boot uses the USB Downloader Gadget (g_dnl) to |
| 10 | provide a SDP implementation over USB. This allows to download program |
| 11 | images to the target in SPL/U-Boot using the same protocol/tooling the |
| 12 | SoC's recovery mechanism is using. |
| 13 | |
| 14 | The SDP protocol over USB is a USB HID class protocol. USB HID class |
| 15 | protocols allow to access a USB device without OS specific drivers. The |
| 16 | U-Boot implementation has primarly been tested using the open source |
| 17 | imx_loader utility (https://github.com/toradex/imx_loader). |
| 18 | |
| 19 | The host side utilities are typically capable to interpret the i.MX |
| 20 | specific image header (see doc/README.imximage). There are extensions |
| 21 | for imx_loader's imx_usb utility which allow to interpret the U-Boot |
| 22 | specific legacy image format (see mkimage(1)). Also the U-Boot side |
| 23 | support beside the i.MX specific header the U-Boot legacy header. |
| 24 | |
| 25 | Usage |
| 26 | ----- |
| 27 | |
| 28 | This implementation can be started in U-Boot using the sdp command |
| 29 | (CONFIG_CMD_USB_SDP) or in SPL if Serial Downloader boot mode has been |
| 30 | detected (CONFIG_SPL_USB_SDP_SUPPORT). |
| 31 | |
| 32 | A typical use case is downloading full U-Boot after SPL has been |
| 33 | downloaded through the boot ROM's Serial Downloader. Using boot mode |
| 34 | detection the SPL will run the SDP implementation automatically in |
| 35 | this case: |
| 36 | |
| 37 | # imx_usb SPL |
| 38 | |
| 39 | Targets Serial Console: |
| 40 | |
| 41 | Trying to boot from USB SDP |
| 42 | SDP: initialize... |
| 43 | SDP: handle requests... |
| 44 | |
| 45 | At this point the SPL reenumerated as a new HID device and emulating |
| 46 | the boot ROM's SDP protocol. The USB VID/PID will depend on standard |
| 47 | U-Boot configurations CONFIG_G_DNL_(VENDOR|PRODUCT)_NUM. Make sure |
| 48 | imx_usb is aware of the USB VID/PID for your device by adding a |
| 49 | configuration entry in imx_usb.conf: |
| 50 | |
| 51 | 0x1b67:0x4fff, mx6_usb_sdp_spl.conf |
| 52 | |
| 53 | And the device specific configuration file mx6_usb_sdp_spl.conf: |
| 54 | |
| 55 | mx6_spl_sdp |
| 56 | hid,uboot_header,1024,0x910000,0x10000000,1G,0x00900000,0x40000 |
| 57 | |
| 58 | This allows to download the regular U-Boot with legacy image headers |
| 59 | (u-boot.img) using a second invocation of imx_usb: |
| 60 | |
| 61 | # imx_usb u-boot.img |
| 62 | |
| 63 | Furthermore, when U-Boot is running the sdp command can be used to |
| 64 | download and run scripts: |
| 65 | |
| 66 | # imx_usb script.scr |
| 67 | |
| 68 | imx_usb configuration files can be also used to download multiple |
| 69 | files and of arbitrary types, e.g. |
| 70 | |
| 71 | mx6_usb_sdp_uboot |
| 72 | hid,1024,0x10000000,1G,0x00907000,0x31000 |
| 73 | full.itb:load 0x12100000 |
| 74 | boot.scr:load 0x12000000,jump 0x12000000 |
| 75 | |
| 76 | There is also a batch mode which allows imx_usb to handle multiple |
| 77 | consecutive reenumerations by adding multiple VID/PID specifications |
| 78 | in imx_usb.conf: |
| 79 | |
| 80 | 0x15a2:0x0061, mx6_usb_rom.conf, 0x1b67:0x4fff, mx6_usb_sdp_spl.conf |
| 81 | |
| 82 | In this mode the file to download (imx_usb job) needs to be specified |
| 83 | in the configuration files. |
| 84 | |
| 85 | mx6_usb_rom.conf: |
| 86 | |
| 87 | mx6_qsb |
| 88 | hid,1024,0x910000,0x10000000,1G,0x00900000,0x40000 |
| 89 | SPL:jump header2 |
| 90 | |
| 91 | mx6_usb_sdp_spl.conf: |
| 92 | |
| 93 | mx6_spl_sdp |
| 94 | hid,uboot_header,1024,0x10000000,1G,0x00907000,0x31000 |
| 95 | u-boot.img:jump header2 |
| 96 | |
| 97 | With that SPL and U-Boot can be downloaded with a single invocation |
| 98 | of imx_usb without arguments: |
| 99 | |
| 100 | # imx_usb |