Stefan Agner | 86ef44f | 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 |
Stefan Agner | 36e3767 | 2017-10-03 16:43:26 +0200 | [diff] [blame] | 17 | imx_loader utility (https://github.com/boundarydevices/imx_usb_loader). |
Stefan Agner | 86ef44f | 2017-08-16 11:00:55 -0700 | [diff] [blame] | 18 | |
Breno Matheus Lima | f013f17 | 2018-10-10 01:10:31 +0000 | [diff] [blame] | 19 | imx_usb_loader is a very nice tool by Boundary Devices that allow to |
| 20 | install U-Boot without a JTAG debugger, using the USB boot mode as |
| 21 | described in the manual. It is a replacement for Freescale's |
| 22 | MFGTOOLS. |
| 23 | |
Stefan Agner | 86ef44f | 2017-08-16 11:00:55 -0700 | [diff] [blame] | 24 | The host side utilities are typically capable to interpret the i.MX |
| 25 | specific image header (see doc/README.imximage). There are extensions |
| 26 | for imx_loader's imx_usb utility which allow to interpret the U-Boot |
| 27 | specific legacy image format (see mkimage(1)). Also the U-Boot side |
| 28 | support beside the i.MX specific header the U-Boot legacy header. |
| 29 | |
Breno Matheus Lima | f013f17 | 2018-10-10 01:10:31 +0000 | [diff] [blame] | 30 | 1. Using imx_usb_loader for first install with SPL |
| 31 | -------------------------------------------------- |
Stefan Agner | 86ef44f | 2017-08-16 11:00:55 -0700 | [diff] [blame] | 32 | |
| 33 | This implementation can be started in U-Boot using the sdp command |
| 34 | (CONFIG_CMD_USB_SDP) or in SPL if Serial Downloader boot mode has been |
| 35 | detected (CONFIG_SPL_USB_SDP_SUPPORT). |
| 36 | |
| 37 | A typical use case is downloading full U-Boot after SPL has been |
| 38 | downloaded through the boot ROM's Serial Downloader. Using boot mode |
| 39 | detection the SPL will run the SDP implementation automatically in |
| 40 | this case: |
| 41 | |
| 42 | # imx_usb SPL |
| 43 | |
| 44 | Targets Serial Console: |
| 45 | |
| 46 | Trying to boot from USB SDP |
| 47 | SDP: initialize... |
| 48 | SDP: handle requests... |
| 49 | |
| 50 | At this point the SPL reenumerated as a new HID device and emulating |
| 51 | the boot ROM's SDP protocol. The USB VID/PID will depend on standard |
| 52 | U-Boot configurations CONFIG_G_DNL_(VENDOR|PRODUCT)_NUM. Make sure |
| 53 | imx_usb is aware of the USB VID/PID for your device by adding a |
| 54 | configuration entry in imx_usb.conf: |
| 55 | |
| 56 | 0x1b67:0x4fff, mx6_usb_sdp_spl.conf |
| 57 | |
| 58 | And the device specific configuration file mx6_usb_sdp_spl.conf: |
| 59 | |
| 60 | mx6_spl_sdp |
| 61 | hid,uboot_header,1024,0x910000,0x10000000,1G,0x00900000,0x40000 |
| 62 | |
| 63 | This allows to download the regular U-Boot with legacy image headers |
| 64 | (u-boot.img) using a second invocation of imx_usb: |
| 65 | |
| 66 | # imx_usb u-boot.img |
| 67 | |
| 68 | Furthermore, when U-Boot is running the sdp command can be used to |
| 69 | download and run scripts: |
| 70 | |
| 71 | # imx_usb script.scr |
| 72 | |
| 73 | imx_usb configuration files can be also used to download multiple |
| 74 | files and of arbitrary types, e.g. |
| 75 | |
| 76 | mx6_usb_sdp_uboot |
| 77 | hid,1024,0x10000000,1G,0x00907000,0x31000 |
| 78 | full.itb:load 0x12100000 |
| 79 | boot.scr:load 0x12000000,jump 0x12000000 |
| 80 | |
| 81 | There is also a batch mode which allows imx_usb to handle multiple |
| 82 | consecutive reenumerations by adding multiple VID/PID specifications |
| 83 | in imx_usb.conf: |
| 84 | |
| 85 | 0x15a2:0x0061, mx6_usb_rom.conf, 0x1b67:0x4fff, mx6_usb_sdp_spl.conf |
| 86 | |
| 87 | In this mode the file to download (imx_usb job) needs to be specified |
| 88 | in the configuration files. |
| 89 | |
| 90 | mx6_usb_rom.conf: |
| 91 | |
| 92 | mx6_qsb |
| 93 | hid,1024,0x910000,0x10000000,1G,0x00900000,0x40000 |
| 94 | SPL:jump header2 |
| 95 | |
| 96 | mx6_usb_sdp_spl.conf: |
| 97 | |
| 98 | mx6_spl_sdp |
| 99 | hid,uboot_header,1024,0x10000000,1G,0x00907000,0x31000 |
| 100 | u-boot.img:jump header2 |
| 101 | |
| 102 | With that SPL and U-Boot can be downloaded with a single invocation |
| 103 | of imx_usb without arguments: |
| 104 | |
| 105 | # imx_usb |
Breno Matheus Lima | f013f17 | 2018-10-10 01:10:31 +0000 | [diff] [blame] | 106 | |
| 107 | 2. Using imx_usb_loader non-SPL images |
| 108 | --------------------------------------- |
| 109 | |
| 110 | Booting in USB mode, the i.MX6 announces itself to the Linux Host as: |
| 111 | |
| 112 | Bus 001 Device 111: ID 15a2:0061 Freescale Semiconductor, Inc. |
| 113 | |
| 114 | imx_usb_loader is able to download a single file (u-boot.imx) |
| 115 | to the board. For boards without SPL support, it is enough to |
| 116 | issue the command: |
| 117 | |
| 118 | sudo ../imx_usb_loader/imx_usb -v u-boot.imx |