Changes between Initial Version and Version 1 of uboot


Ignore:
Timestamp:
05/01/2023 09:42:53 PM (19 months ago)
Author:
Tim Harvey
Comment:

initial page

Legend:

Unmodified
Added
Removed
Modified
  • uboot

    v1 v1  
     1[[PageOutline]]
     2
     3= U-Boot Bootloader
     4Gateworks uses U-Boot (the Universal Boot Loader) as a primary bootloader for all current product families. In some cases U-Boot is used as the 'secondary program loader' as well as the 'primary program loader'.
     5
     6The purpose of a bootloader is to load the Operating System (OS) and execute it. In terms of a Linux based OS this means loading the kernel image, device-tree blobs (optional), and initial ramdisk images (optional) into DRAM and executing the kernel with any necessary kernel arguments. Often this is done in an OS specific fashion via a U-Boot bootscript stored along-side the kernel Image.
     7
     8== Features and Peripheral support
     9U-Boot has many features and peripheral support but it is not intended to be a full OS so some features do not work as well as they would on a Linux based OS for example. The intention of U-Boot is to provide enough support to load and execute the kernel therefore support for things like USB peripherals and high performance networking and I/O is not a priority and should not be expected.
     10
     11Many features can be enabled by re-building and re-installing U-Boot. For more information on building U-Boot see the product specific BSP pages.
     12
     13== Product Family specific notes
     14
     15[=#malibu]
     16=== Malibu
     17The Marvell CN913x based Malibu product family boots via a BOOT ROM internal to the CN913x which loads ARM Trusted Firmware (ATF) which contains a U-Boot payload image. In this case initial SoC chip and DRAM configuration is done by components in the ARM Trusted firmware
     18
     19see also [wiki:malibu/boot#u-boot]
     20
     21[=#venice]
     22=== Venice
     23The NXP i.MX 8M !Mini/Nano/Plus based Venice product family boots via a BOOT ROM internal to the i.MX8M which loads U-Boot SPL (Secondary Program Loader) which then loads U-Boot proper. In this case initial SoC chip and DRAM configuration is done by U-Boot SPL.
     24
     25see also [wiki:ventana/bootloader]
     26
     27
     28[=#newport]
     29=== Newport
     30The Marvell CN803x based Newport product family boots via a BOOT ROM internal to the CN803 which loads Marvell's 'Board Disagnostics Kit' (BDK) (which we call the SPL) which in turn loads the ATF and U-Boot from a payload inside the ATF. In this case initial SoC chip and DRAM configuration is done by the Marvell BDK software.
     31
     32see also [wiki:newport/boot#u-boot]
     33
     34
     35[=#ventana]
     36=== Ventana
     37The NXP i.MX 6Q/DL based Ventana product family boots via a BOOT ROM internal to the i.MX6 which loads U-Boot SPL (Secondary Program Loader) which then loads U-Boot proper. In this case initial SoC chip and DRAM configuration is done by U-Boot SPL.
     38
     39Ventana U-Boot enables and supports PCI and the PCI based i210 NIC found on several of the Ventana boards.
     40 
     41see also [wiki:ventana/bootloader]
     42
     43
     44[=#env]
     45== Environment variables and scripts
     46U-Boot uses environment variables to configure much of its functionality. U-Boot environment variables can also be treated as scripts and therefore the environment dictates how U-Boot achieves its goal of loading and executing the OS.
     47
     48You can use {{{env}}} commands to get or set env vars. For example:
     49 * Get a var:
     50{{{#!bash
     51env print model
     52}}}
     53 * Set a var:
     54{{{#!bash
     55env set quiet 1
     56}}}
     57 * Load default values (does not save):
     58{{{#!bash
     59env default -f -a
     60}}}
     61 * Save current env:
     62{{{#!bash
     63env save
     64}}}
     65
     66If you want to erase the env:
     67{{{#!bash
     68env erase
     69}}}
     70
     71Some notable env variables used in U-Boot:
     72||= Category =||= Name    =||= Purpose  =||
     73|| boot || preboot   || script executed before 'Hit any key to abort' if CONFIG_USE_PREBOOT=y ||
     74|| boot || bootcmd   || script executed at boot ||
     75|| boot || bootdelay || number of seconds to wait for a key to abort automatic boot (if 0 will not wait) ||
     76|| ||
     77|| console || baudrate  || baudrate of serial console ||
     78|| console || device of serial console ||
     79|| ||
     80|| network || ethprime  || primary ethernet device (used at boot) ||
     81|| network || ethaddr   || mac addr of first eth interface ||
     82|| network || eth1addr  || mac addr of second eth interface ||
     83|| network || ethact    || active ethernet device (current) ||
     84|| network || ipaddr    || local ip address ||
     85|| network || serverip  || ip address of server for tftp commands ||
     86|| network || netmask   || netmask address (optional) ||
     87|| network || gatewayip || ip address of gateway (optional) ||
     88|| network || ethrotate || if set to 'no' will not automatically rotate through network devices on network operations ||
     89|| network || dhcp      || issue a DHCP request for network configuration (set 'autoload=no' to disable attempting to load an image)
     90|| ||
     91|| distro config || boot_targets || ordered list of boot targets (ie 'mmc1 mmc2 usb0 usb1') ||
     92|| distro config || boot_prefixes || ordered list of prefixes of boot scripts (ie '/ /boot') ||
     93|| distro config || boot_scripts || ordered list of boot script names (ie 'boot.scr') ||
     94|| ||
     95|| automatic || board || board model (automatically set during boot) ||
     96|| automatic || serial# || board serial number (automatically set during boot) ||
     97
     98=== U-Boot env location, format, and accessing outside of U-Boot
     99There are several U-Boot config items (CONFIG_ENV_*) that specify where and how the U-Boot env is stored. Typically Gateworks configures 32KiB redundant env located at the end of the boot firmware. This means that U-Boot flips back and forth between the two env areas so that if a power-cut occurs during a 'saveenv' command it will default to the previous env saved.
     100
     101There are several applications built by U-Boot that facilitate accessing U-Boot env outside of U-Boot:
     102 * fw_printenv / fw_setenv - uses a config file to allow env get/set from Linux
     103 * mkenvimage - creates a binary image from a source file in the format of name=value
     104
     105The Ubuntu u-boot-tools package provides {{{fw_printenv}}} and {{{fw_setenv}}} but a config file must exist in {{{/etc/fw_env.config}}} (or specified via the -c parameter) which describe the env location and size:
     106 * Malibu:
     107{{{#!bash
     108# Device               offset          Env. size
     109/dev/mmcblk0boot0      0x3f0000        0x8000
     110/dev/mmcblk0boot0      0x3f8000        0x8000
     111}}}
     112 * Venice:
     113{{{#!bash
     114# Device               offset          Env. size
     115/dev/mmcblk2           0xff0000        0x8000
     116/dev/mmcblk2           0xff8000        0x8000
     117}}}
     118 * Newport:
     119{{{#!bash
     120# Device               offset          Env. size
     121/dev/mmcblk0           0xff0000        0x8000
     122/dev/mmcblk0           0xff8000        0x8000
     123}}}
     124 * Ventana (NAND boot device):
     125  - cat /proc/mtd
     126{{{#!bash
     127dev:    size   erasesize  name
     128mtd0: 01000000 00040000 "uboot"
     129mtd1: 00100000 00040000 "env"
     130mtd2: 7ef00000 00040000 "rootfs"
     131}}}
     132  - cat /etc/fw_env.config
     133{{{#!bash
     134# device  offset size erasesize
     135/dev/mtd1 0x0 0x20000 0x40000
     136/dev/mtd1 0x80000 0x20000 0x40000
     137}}}
     138  * make sure /dev/mtd1 is your env partition
     139 * Ventana (MMC boot device)
     140{{{#!bash
     141# device  offset size erasesize
     142/dev/mmcblk0 0xb1400 0x20000 0x20000
     143/dev/mmcblk0 0xd1400 0x20000 0x20000
     144}}}
     145
     146This will define the device being used, offset according to flash layout, size from flash map, and size of erase block (unless the device is a file). Ventana U-boot environment is redundant hence two entries, both locations need their variables updated. 
     147
     148Note that in certain circumstances the Linux representation of the boot device can change - please ensure that the devices specified do indeed point to your boot device.
     149
     150It is important to understand the meaning of the '''Warning: Bad CRC, using default environment''' message. This means that the non-volatile env area specified by the config file is empty or corrupt and that the built-in env within U-Boot will be used which is not appropriate. Note that Gateworks Ventana boards ship with an empty env area and use built-in defaults so if you wish to use the u-boot-tools to access the env from Linux first do a 'saveenv' from U-Boot to provide a valid default env.
     151
     152If you use {{{fw_setenv}}} on an environment in this state it will properly set the variable you specify and all other variables will continue to use their built-in default values within U-Boot. Essentially you are 'overriding' the defaults as you would expect.
     153
     154
     155Example usage:
     156{{{#!bash
     157# display environment
     158fw_printenv -c fw_env.config
     159# set environment variable
     160fw_setenv  -c fw_env.config foo bar #foo being variable name bar being value variable will be set to
     161#second example
     162fw_setenv  -c fw_env.config ipaddr 192.168.1.10
     163#print single environment variable
     164fw_printenv  -c fw_env.config foo
     165#second example
     166fw_printenv ipaddr
     167}}}
     168
     169[=#bootflow]
     170== Boot Flow
     171Boot flow in U-Boot refers to how specifically U-Boot loads and passed control to the OS.
     172
     173After U-Boot initializes it does the following
     174 * executes contents of 'preboot' env variable (if configured with CONFIG_USE_PREBOOT)
     175 * based on the contents of 'bootdelay' env variable it prints 'Hit any key to stop autoboot:' and counts down the number of seconds specified (if set to 0 it will skip this and not allow you to stop execution manually)
     176 * executes contents of 'bootcmd' env variable
     177
     178
     179[=#distroconfig]
     180=== Distro Config
     181A set of scripts referred to as 'distro config' can be used to scan bootable partitions on a set of specified devices for boot scripts and execute the first one it finds.
     182
     183'''This configuration is used on Newport, Venice, and Malibu product families (not Ventana which pre-dated this concept)'''
     184
     185This feature provides a well defined U-Boot env intended to make it easier for distro maintainers to develop compatible bootscripts. This primarily entails a set of 'boot scripts' and variables that control them.
     186
     187Ultimately this U-Boot environment is looking for a U-Boot boot script on a 'bootable' partition (partitions with the 'boot' flag enabled). It searches in this order with these rules:
     188 - **boot_targets** - list of target device type/nums to search: defaults to mmc1 mmc0 usb0 usb1 pxe dhcp
     189 - **devplist** - ''dynamically created'' list of all partitions flagged as 'bootable'
     190 - **boot_prefixes** - list of directories within a partition searched for bootscripts
     191 - **boot_scripts** - list of boot script names searched for
     192
     193The boot device order is specified by the {{{boot_targets}}} env variable which typically defaults to something like {{{mmc1 mmc0 usb0 usb1 pxe dhcp}}}. For example, to limit OS booting to only mmc device 2 you would 'setenv boot_targets mmc 2; saveenv'.
     194
     195The Distro-Config environment supports legacy uImage scripts (it does not support FIT images with scripts).
     196
     197
     198[=#bootscript]
     199=== Boot script
     200A boot script is a U-Boot specific set of commands wrapped inside a U-Boot binary header which can be loaded from a device or filesystem and executed via the 'source <address>' command.
     201
     202You can create these with the {{{mkimage}}} tool from U-Boot as such:
     203{{{#!bash
     204mkimage -A arm64 -T script -C none -d boot.txt boot.scr
     205}}}
     206
     207The bootscript can be updated at runtime on the Linux target. For example:
     208{{{#!bash
     209mkimage -A arm64 -T script -C none -d boot.txt /boot/boot.scr
     210}}}
     211
     212
     213When writing bootscripts compatible with Generic Distro Config you can assume the following env variables:
     214 - **devtype** - the device type the script was loaded from (mmc|usb|sata)
     215 - **devnum** - the device number the script was loaded from (ie 0 for mmc0, 1 for mmc1, etc)
     216 - **distro_bootpart** - the partition number the script was loaded from (ie 0, 1, etc)
     217 - **fdtcontroladdr** - the address the device-tree is at (Note that the Malibu bootloader contains a static version of the board device-tree)
     218 - **kernel_addr_r** - address where kernel can be loaded
     219 - **bootargs** - default bootargs to pass to the kernel - you probably want to add to this and not overwrite it
     220 - **console** - the serial console device to pass to the kernel
     221
     222Additionally you should note the following:
     223 - use load/ls/save commands which support FAT/ext filesystem types automatically instead of the fs specific commands
     224 - if using a root filesystem that is not supported by the bootloader (ie F2FS or BTRFS) you can place your bootscript and kernel image in the FAT12 filesystem on partition 1 of the boot device. This filesystem is part of the 16MB 'Boot Firmware' image. If doing so you will need to compress the kernel and package it into a [#fit FIT image] in order to fit it in the available space.
     225
     226
     227[=#fit]
     228== Flattened Image Tree (FIT) images
     229The U-Boot bootloader supports Flattened Image Tree (FIT) images which expand greatly on the legacy U-Boot image (uImage) format by allowing multiple binary blobs within an image. These blobs can be kernel images, ramdisk images, device-tree blobs, and bootloader scripts. Each image can also be optionally compressed (meaning U-Boot will decompress it) and check-sumed with a variety of hash mechanisms (meaning U-Boot will verify the image before using it).
     230
     231Quick summary of FIT Images:
     232 * introduced to resolve limitations with original single-image formats and follow-on multi-image format supported by UBoot bootm (boot memory)
     233 * uses power of the Device-Tree-Compiler (DTC)
     234 * FIT .itb files can be created with mkimage by passing in a .its file which in device-tree notation describes the images
     235 * U-Boot supports FIT with several commands:
     236  - {{{source <addr>:<name>}}} # source a script by name from FIT image in memory
     237  - {{{iminfo <fitaddress>}}} # print all the info contained in a FIT image in memory and verify (just not boot it)
     238  - {{{imextract <fitaddress> <item> <addr>}}} # extract item (ie kernel@1) to addr
     239  - {{{bootm <fitaddress>[#conf] - $fdtcontroladdr}}} # boot default or 'conf' configuration (ie #config@1)
     240  - {{{bootm start <fitaddress>[#conf] - $fdtcontroladdr}}} # boot from memory a specific configuration (or default configuration) from FIT image
     241
     242Example:
     243 * kernel.its with a single compressed kernel for ARM64
     244{{{#!bash
     245/dts-v1/;
     246/ {
     247        description = "Simple image with single Linux kernel";
     248        #address-cells = <1>;
     249        images {
     250                kernel@1 {
     251                        description = "Linux kernel";
     252                        data = /incbin/("./Image.gz");
     253                        type = "kernel";
     254                        arch = "arm64";
     255                        os = "linux";
     256                        compression = "gzip";
     257                        load = <0x40200000>;
     258                        entry = <0x40200000>;
     259                        hash@1 {
     260                                algo = "sha256";
     261                        };
     262                };
     263        };
     264
     265        configurations {
     266                default = "conf@1";
     267                conf@1 {
     268                        description = "Boot Linux kernel";
     269                        kernel = "kernel@1";
     270                };
     271        };
     272};
     273}}}
     274 * create image:
     275{{{#!bash
     276cp arch/arm64/boot/Image .
     277gzip Image
     278mkimage -f kernel.its /tftpboot/kernel.itb
     279}}}
     280 * boot the default configuration from U-Boot:
     281{{{#!bash
     282tftpboot $loadaddr kernel.itb && bootm $loadaddr - $fdtcontroladdr
     283}}}
     284
     285References:
     286 * [http://git.denx.de/?p=u-boot.git;a=tree;f=doc/uImage.FIT doc/uImage.FIT]
     287 * http://www.denx.de/wiki/pub/U-Boot/Documentation/multi_image_booting_scenarios.pdf
     288 * http://elinux.org/images/f/f4/Elc2013_Fernandes.pdf
     289
     290
     291
     292[=#gpio]
     293== General Purpose I/O (GPIO)
     294The {{{gpio}}} command provides the ability to list and configure board-specific GPIO's.
     295
     296Examples:
     297 * List GPIO's:
     298{{{#!bash
     299u-boot=> gpio status
     300Bank GPIO1_:
     301GPIO1_0: output: 0 [x] rs485_term.gpio-hog
     302GPIO1_1: input: 0 [x] mipi_gpio4.gpio-hog
     303GPIO1_5: output: 0 [x] regulator-wifi-en.gpio
     304GPIO1_6: output: 0 [x] pci_usb_sel.gpio-hog
     305GPIO1_7: input: 1 [x] dio0.gpio-hog
     306GPIO1_8: output: 0 [x] regulator-usb-otg2.gpio
     307GPIO1_9: input: 1 [x] dio1.gpio-hog
     308GPIO1_12: output: 0 [x] regulator-usb-otg1.gpio
     309
     310Bank GPIO2_:
     311GPIO2_12: input: 1 [x] mmc@30b50000.cd-gpios
     312
     313Bank GPIO3_:
     314GPIO3_0: output: 0 [x] ethernet@30be0000.phy-reset-gpios
     315
     316Bank GPIO4_:
     317GPIO4_0: output: 0 [x] rs485_en.gpio-hog
     318GPIO4_1: input: 0 [x] mipi_gpio3.gpio-hog
     319GPIO4_2: output: 0 [x] rs485_hd.gpio-hog
     320GPIO4_3: input: 0 [x] mipi_gpio2.gpio-hog
     321GPIO4_4: input: 0 [x] mipi_gpio1.gpio-hog
     322GPIO4_7: output: 1 [x] pci_wdis#.gpio-hog
     323
     324Bank GPIO5_:
     325GPIO5_4: output: 0 [x] led-1.gpios
     326GPIO5_5: output: 0 [x] led-0.gpios
     327}}}
     328 * set GPIO named DIO1 to logic 1:
     329{{{#!bash
     330u-boot=> gpio set dio1
     331gpio: pin dio1 (gpio 9) value is 1
     332}}}
     333 * set GPIO named DIO1 to logic 0:
     334{{{#!bash
     335u-boot=> gpio clr dio1
     336gpio: pin dio1 (gpio 9) value is 0
     337}}}
     338 * read GPIO DIO1 logic level:
     339{{{#!bash
     340u-boot=> gpio input dio1
     341gpio: pin dio1 (gpio 9) value is 0
     342}}}
     343
     344
     345
     346[=#led]
     347== LED support
     348If LED support is enabled you can configure board LED's via U-Boot:
     349 * List LED's:
     350{{{#!bash
     351u-boot=> led list
     352led-0           off
     353led-1           off
     354}}}
     355 * turn an LED on:
     356{{{#!bash
     357u-boot=> led led-0 on
     358}}}
     359 * turn an LED off:
     360{{{#!bash
     361u-boot=> led led-0 off
     362}}}
     363
     364Note that many Gateworks boards have a front-panel bi-color LED which is supported by two distinct LED's for 'red' and 'green'. In this case you must enable one and disable the other (setting both 'on' is the same as setting both 'off').
     365
     366
     367[=#gsc]
     368== GSC support ==
     369The {{{gsc}}} command that will let you interact with the Gateworks System controller on Gateworks boards.
     370
     371Examples:
     372 * see basic info
     373{{{#!bash
     374u-boot=> gsc 
     375GSCv3   : v61 0x1d6f RST:VIN Thermal protection:enabled at 96C
     376RTC     : 1970-01-05  22:36:56 UTC
     377Model   : GW7301-01-CF
     378Serial  : 928012
     379MFGDate : 01-09-2023
     380SOM     : GW7001-F 928012 01-09-2023
     381BASE    : GW7301-C 878707 05-04-2022
     382}}}
     383 * disable primary power supply for 5 seconds
     384{{{#!bash
     385u-boot=> gsc sleep 5
     386GSC Sleeping for 5 seconds
     387}}}
     388 * Show hardware monitor values:
     389{{{#!bash
     390u-boot=> gsc hwmon
     391temp    : 47.9C
     392vdd_bat : 3.216V
     393vdd_vin : 16.724V
     394vdd_adc1: 0.000V
     395vdd_adc2: 0.000V
     396vdd_dram: 1.119V
     397vdd_1p2 : 1.192V
     398vdd_1p0 : 0.000V
     399vdd_2p5 : 0.000V
     400vdd_3p3 : 3.272V
     401vdd_0p95: 0.938V
     402vdd_1p8 : 1.793V
     403vdd_gsc : 2.950V
     404}}}
     405  - Note that the voltage rails connected to the GSC hardware monitor vary per board
     406
     407
     408[=#net]
     409== Network
     410U-Boot network support exists for the network controllers found within the SoC of the board. If PCI is supported by the product family there are a few PCI based network controller drivers as well.
     411
     412Because U-Boot is not a full OS and does not support background drivers network operations occur based on various network commands such as 'tftpboot', 'dhcp'. The network interface used for these commands is specified by the 'ethact' env variable. The 'net list' command available in newer versions of U-Boot can help identify the names of the network interface that can be used.
     413
     414To see a table showing the physical network interface mapping to U-Boot devices refer to:
     415 * [wiki:malibu/ethernet Malibu Ethernet page]
     416 * [wiki:venice/ethernet Venice Ethernet page]
     417 * [wiki:newport/ethernet Newport Ethernet page]
     418 * [wiki:ventana/ethernet Ventana Ethernet page]
     419
     420The following U-Boot environment variables are used with networking:
     421 * {{{ipaddr}}} - local IP address
     422 * {{{serverip}}} - TFTP server IP
     423 * {{{netmask}}} - Netmask
     424 * {{{gatewayip}}} - Gateway IP if needed
     425 * {{{ethact}}} - controls which interface is currently active
     426 * {{{ethprime}}} - controls which interface is used first
     427 * {{{ethrotate}}} - when set to 'no' uboot does not go through all available network interfaces and instead just stays at the currently selected interface (ethact)
     428 * {{{filesize}}} - gets set to the size of data transferred
     429 * {{{netretry}}} - when set to 'no' each network operation will either success or fail without retrying. When set to 'once' the operation will fail only when all available network interfaces have been tried once without success.
     430 * {{{tftpsrcport}}} - UDP source port (if not set uses default)
     431 * {{{tftpdstport}}} - UDP dest port (if not set uses well known port 69)
     432 * {{{tftpblocksize}}} - if not set will use TFTP server's default block size
     433 * {{{tftptimeout}}} - retransmission timeout for TFTP packets in ms (min value is 1000, default is 5000)
     434 * {{{dhcp}}} - Use DHCP to configure networking env
     435
     436
     437[=#filesystem]
     438== Generic File System and File Management support for Block storage devices
     439For modern versions of U-Boot there are several commands that work with files which support multiple file systems and device interfaces eliminating the need for you to know what filesystem is used and avoid using the deprecated filesystem specific commands. For these commands you specify the interface name (ie mmc,usb,sata) , a device number and optionally a partition.
     440 * load <interface> [<dev[:part]> [<addr> [<filename> [bytes [pos]]]]] - load a file to memory
     441 * save <interface> [<dev[:part]> <addr> <filename> bytes [pos] - save a file from memory
     442 * ls <interface> [<dev[:part]> [directory]] - list files on a device/directory
     443 * ln <interface> <dev[:part]> target linkname - create a symlink
     444 * size <interface> <dev[:part] <filename> - determine size of a file (saved in 'filesize' env variable)
     445
     446The 'part' command can be used to work with partition tables (both GPT and MBR if enabled):
     447 * part uuid <interface> <dev>:<part> - print partition UUID
     448 * part uuid <interface> <dev>:<part> <varname> - set varname to partition UUID
     449 * part list <interface> <dev> - print partition table
     450 * help part - see more options
     451
     452Note that for the usb interface you must start the interface first with a 'usb start' operation. USB bus enumeration does not happen in the background.
     453
     454
     455[=#mmc]
     456== MMC (eMMC and microSD)
     457The 'mmc' command supports various low level operations on !MultiMediaCard bus devices such as eMMC and microSD when not working at the [#filesystem fileystem layer]. When working at this level you must set the current mmc device manually.
     458 
     459Examples:
     460 * mmc list - list available device numbers
     461{{{#!bash
     462u-boot=> mmc list
     463FSL_SDHC: 0
     464FSL_SDHC: 1
     465FSL_SDHC: 2 (eMMC)
     466}}}
     467 * mmc dev [dev] [part] [mode] - show or set the current mmc device
     468{{{#!bash
     469u-boot=> mmc dev 2
     470switch to partitions #0, OK
     471mmc2(part 0) is current device
     472u-boot=> mmc dev
     473switch to partitions #0, OK
     474mmc2(part 0) is current device
     475}}}
     476 * mmc info - show info for currently selected device:
     477{{{#!bash
     478u-boot=> mmc info
     479Device: FSL_SDHC
     480Manufacturer ID: 70
     481OEM: 0
     482Name: IB2964
     483Bus Speed: 200000000
     484Mode: HS400 (200MHz)
     485Rd Block Len: 512
     486MMC version 5.1
     487High Capacity: Yes
     488Capacity: 58.4 GiB
     489Bus Width: 8-bit DDR
     490Erase Group Size: 512 KiB
     491HC WP Group Size: 8 MiB
     492User Capacity: 58.4 GiB
     493Boot Capacity: 4 MiB ENH
     494RPMB Capacity: 4 MiB ENH
     495Boot area 0 is not write protected
     496Boot area 1 is not write protected
     497}}}
     498 * mmc help - show more options
     499
     500
     501[=#usb]
     502== USB
     503The 'usb' command supports various low level operations on Universal Serial Bus hosts and devices when not working at the [#filesystem fileystem layer]. When working at this level you must set the current usb device manually. Additionally you must use the 'usb start' command to initialize the USB subsystem and enumerate the bus. USB bus enumeration does not happen in the background.
     504 
     505Examples:
     506 * usb start - start and scan the USB controllers
     507 * usb tree - show a tree view of USB enumerated devices
     508 * help usb - more USB commands and options
     509
     510Example Usage:
     511{{{#!bash
     512u-boot=> usb start && usb tree
     513starting USB...
     514Bus usb@32e40000: Bus usb@32e50000: USB EHCI 1.00
     515scanning bus usb@32e40000 for devices... 1 USB Device(s) found
     516scanning bus usb@32e50000 for devices... 4 USB Device(s) found
     517       scanning usb for storage devices... 1 Storage Device(s) found
     518USB device tree:
     519  1  Hub (480 Mb/s, 0mA)
     520     u-boot EHCI Host Controller
     521   
     522  1  Hub (480 Mb/s, 0mA)
     523  |  u-boot EHCI Host Controller
     524  |
     525  +-2  Hub (480 Mb/s, 0mA)
     526    |  Microchip Tech USB2744
     527    |
     528    +-3  Mass Storage (480 Mb/s, 100mA)
     529    |     CENTON USB 52D0CE92
     530    | 
     531    +-4  Vendor specific (480 Mb/s, 0mA)
     532         Microchip Tech Hub Controller
     533
     534}}}
     535
     536
     537=== USB Device support (via USB Host mode)
     538A very small set of USB devices are supported in U-Boot depending on the version and configuration. Typically the following devices are used during development:
     539 * USB Network Adapters
     540 * USB Mass Storage
     541
     542
     543[=#usbnet]
     544==== USB Network Adapters
     545A very small set of USB network adapters are supported in U-Boot depending on the version and configuration:
     546 * ASIX AX8817X - (ie [http://plugable.com/products/usb2-e100 Plugable USB2-E100 10/100mbps)
     547  * network device: asx0
     548 * SMSC LAN95xx
     549  * network device: sms0
     550
     551Depending on the version of U-Boot more devices may be available
     552
     553To use these use the following U-Boot configuration:
     554 1. scan USB bus for supported devices:
     555{{{#!bash
     556usb start
     557}}}
     558  * If you have a supported USB device attached you will see a message to that effect
     559 2. set active ethernet device (use 'net list' to see a list of device names)
     560{{{#!bash
     561setenv ethact asx0
     562}}}
     563 3. Use networking as needed:
     564{{{#!bash
     565ping 192.168.1.254
     566tftp ${loadaddr} ${file}
     567}}}
     568
     569
     570[=#ums]
     571==== USB Mass Storage (UMS) Device
     572USB Mass Storage (UMS) device support is not as robust as it is on Linux. Specifically some older devices that have support for various quirks in Linux may not work in U-Boot.
     573
     574Older UMS devices sometimes fail to enumerate on the bus. If you encounter this you can try the following:
     575 - see if it enumerates on a different port (sometimes enumerating through an on-board USB HUB can be problematic). If your board has a USB OTG or Type-C connector those interfaces do not go through a USB HUB so try your UMS device there
     576 - try setting the 'usb_pgood_delay' env variable to something like 2000 before you do your 'usb start'. This represents a millisecond delay between enabling the VBUS regulator and enumerating the bus
     577
     578Example:
     579{{{#!bash
     580u-boot=> usb start && usb tree
     581starting USB...
     582Bus usb@32e40000: Bus usb@32e50000: USB EHCI 1.00
     583scanning bus usb@32e40000 for devices... 1 USB Device(s) found
     584scanning bus usb@32e50000 for devices... 4 USB Device(s) found
     585       scanning usb for storage devices... 1 Storage Device(s) found
     586USB device tree:
     587  1  Hub (480 Mb/s, 0mA)
     588     u-boot EHCI Host Controller
     589   
     590  1  Hub (480 Mb/s, 0mA)
     591  |  u-boot EHCI Host Controller
     592  |
     593  +-2  Hub (480 Mb/s, 0mA)
     594    |  Microchip Tech USB2744
     595    |
     596    +-3  Mass Storage (480 Mb/s, 100mA)
     597    |     CENTON USB 52D0CE92
     598    | 
     599    +-4  Vendor specific (480 Mb/s, 0mA)
     600         Microchip Tech Hub Controller
     601       
     602u-boot=> usb storage
     603  Device 0: Vendor: CENTON   Rev: 8.07 Prod:                 
     604            Type: Removable Hard Disk
     605            Capacity: 61500.0 MB = 60.0 GB (125952000 x 512)
     606u-boot=> ls usb 0:1 boot
     607<DIR>       4096 .
     608<DIR>       4096 ..
     609             860 boot.scr
     610        10407524 Image
     611}}}
     612
     613
     614[=#gadget]
     615=== USB Device Gadget support
     616Very limited support for USB device/gadget mode exists
     617
     618
     619[=#gadgetums]
     620==== USB Mass Storage (UMS) Gadget
     621The 'ums' command can be used to allow a host PC to access (slowly!) a block storage device on your target board.
     622
     623On boards that support this with a USB OTG or Type-C connector cabled to a PC USB host you can use:
     624 * ums <usb_controller> [<devtype>] <dev[:part]> - usb controller is the number of the usb controller (ie 0 or 1) to present the interface on while devtype, dev, and part specify the interface (devtype), device number (dev), and optional partition to expose via the USB Mass Storage device class
     625
     626Examples:
     627 * expose mmc device 0 on USB host controller 0 as a USB Mass Storage device:
     628{{{#!bash
     629usb start && ums 0 mmc 0
     630}}}
     631
     632
     633[=#pci]
     634== PCI
     635PCI bus support is enabled on the Ventana family due to the fact that at least one Ventana board model has only PCI based network interfaces.
     636
     637
     638
     639[=#netconsole]
     640== !NetConsole (access U-Boot console from network)
     641U-Boot does not contain any TCP implementation and as such there is no 'telnet server' or 'telnetd' support. There is however something similar called '!NetConsole' which will allow stdin/stdout/stderr to be directed to a UDP network port. If you set this up you can use the Linux 'nc' or 'netcat' tool or use the the 'netconsole' shell script provided in tools/netconsole (which uses these tools) to talk to U-Boot's interpreter from a Linux host.
     642
     643Using !NetConsole, the paradigm is reversed from the telnet/ssh perspective a bit such that you need to configure U-Boot to listen to a specifc IP address of a server.
     644
     645To enable !NetConsole you must do the following:
     646 - U-Boot:
     647  * configure networking: For example have a network interface supported by U-boot, set {{{ipaddr}}} env variable and {{{serverip}}} env variable (make sure you can {{{ping $serverip}}}):
     648{{{
     649setenv ipaddr 192.168.1.1 # local ip
     650setenv serverip 192.168.1.146 # host ip running netcat/netconsole
     651}}}
     652  * set the {{{ncip}}} address to your server:
     653{{{
     654setenv ncip ${serverip}
     655}}}
     656  * set stdin/stdout/stderr as desired to {{{nc}}}:
     657{{{
     658setenv stdin nc; setenv stdout nc; setenv stderr nc
     659}}}
     660  * (optional) if you want these changed persistent, do a {{{saveenv}}}:
     661{{{
     662saveenv
     663}}}
     664 - Linux host:
     665  * make sure you have netcat (either {{{nc}}} or {{{netcat}}} applications)
     666  * grab the {{{netconsole}}} shell script from U-Boot's tools directory:
     667{{{#!bash
     668wget https://raw.githubusercontent.com/Gateworks/u-boot-imx6/gateworks_v2015.04/tools/netconsole
     669chmod +x netconsole
     670}}}
     671  * use {{{netconsole}}} to listen to your target IP address for input/output:
     672{{{#!bash
     673netconsole 192.168.1.1
     674}}}
     675   - Note that netconsole remaps the interrupt from Cntl-C to Cntl-T so that you can use Cntl-C over the network console
     676
     677
     678For a bootloader configuration that sits waiting for network commands from a specific host but with a timeout you can use the preboot env variable to execute a script prior to bootcmd such as:
     679{{{
     680setenv serverip 192.168.1.146 # your server ip
     681setenv ipaddr 192.168.1.1 # your local ip
     682setenv netretry no
     683setenv preboot 'echo "Looking for server at $serverip..."; \
     684 if ping $serverip; then setenv ncip ${serverip}; setenv bootdelay 10; \
     685 echo "Starting NetConsole to ${ncip} and waiting for ${bootdelay} seconds..."; \
     686 setenv stdin nc; setenv stdout nc; setenv stderr nc; \
     687 fi'
     688saveenv
     689}}}
     690 * Note that we set {{{netretry}}} to 'no' which causes network operations to not retry (otherwise the ping will go forever). This could also be set to 'once' if you wish to cycle through all available network interfaces (such as on-board NIC's as well as USB nics) instead of just 'ethprime'.
     691
     692This only pertains to input/output of the U-Boot environment. Once the bootloader jumps to the kernel, the kernel is in charge of what to do about its input/output, which is controlled via the 'console' kernel cmdline. Note that there is a CONFIG_NETCONSOLE option in the kernel that uses a 'netconsole' kernel cmdline however that option is not enabled in the Gateworks kernels by default
     693
     694References:
     695 * https://github.com/Gateworks/u-boot-imx6/blob/gateworks_v2015.04/doc/README.NetConsole