2014-06-17 08:37:25 +00:00
|
|
|
USB support
|
|
|
|
===========
|
|
|
|
|
|
|
|
USB host support
|
|
|
|
----------------
|
|
|
|
|
2014-07-03 12:50:36 +00:00
|
|
|
barebox has support for both USB host and USB device mode. USB devices
|
2014-06-17 08:37:25 +00:00
|
|
|
take a long time to probe, so they are not probed automatically. Probing
|
|
|
|
has to be triggered using the :ref:`command_usb` or :ref:`command_detect` command.
|
2014-07-03 12:50:36 +00:00
|
|
|
USB devices in barebox are not hot-pluggable. It is expected that USB
|
2014-06-17 08:37:25 +00:00
|
|
|
devices are not disconnected while barebox is running.
|
|
|
|
|
|
|
|
USB Networking
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
2014-07-03 12:50:36 +00:00
|
|
|
barebox supports ASIX-compatible devices and the SMSC95xx. After
|
|
|
|
detection, the device shows up as eth0 and can be used like a regular network
|
2014-06-17 08:37:25 +00:00
|
|
|
device.
|
|
|
|
|
|
|
|
To use a USB network device together with the :ref:`command_ifup` command, add the
|
2014-07-03 12:50:36 +00:00
|
|
|
following to ``/env/network/eth0-discover``:
|
2014-06-17 08:37:25 +00:00
|
|
|
|
|
|
|
.. code-block:: sh
|
|
|
|
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
usb
|
|
|
|
|
|
|
|
USB mass storage
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
barebox supports USB mass storage devices. After probing them with the :ref:`command_usb`
|
2014-07-03 12:50:36 +00:00
|
|
|
command, they show up as ``/dev/diskx`` and can be used like any other device.
|
2014-06-17 08:37:25 +00:00
|
|
|
|
|
|
|
USB device support
|
|
|
|
------------------
|
|
|
|
|
|
|
|
DFU
|
|
|
|
^^^
|
|
|
|
|
|
|
|
USB Device Firmware Upgrade (DFU) is an official USB device class specification of the USB
|
2014-07-03 12:50:36 +00:00
|
|
|
Implementers Forum. It provides a vendor-independent way to update the firmware of embedded
|
2014-06-17 08:37:25 +00:00
|
|
|
devices. The current specification is version 1.1 and can be downloaded here:
|
|
|
|
http://www.usb.org/developers/devclass_docs/DFU_1.1.pdf
|
|
|
|
|
2014-07-03 12:50:36 +00:00
|
|
|
On the barebox side, the update is handled with the :ref:`command_dfu` command.
|
|
|
|
It is passed a list of partitions to provide to the host. The partition list
|
|
|
|
has the form ``<file>(<name>)<flags>``. ``file`` is the path to the device or
|
|
|
|
regular file which shall be updated. ``name`` is the name under which the partition
|
|
|
|
shall be provided to the host. For the possible ``flags`` see
|
2014-06-17 08:37:25 +00:00
|
|
|
:ref:`command_dfu`. A typical ``dfu`` command could look like this:
|
|
|
|
|
|
|
|
.. code-block:: sh
|
|
|
|
|
|
|
|
dfu "/dev/nand0.barebox.bb(barebox)sr,/dev/nand0.kernel.bb(kernel)r,/dev/nand0.root.bb(root)r"
|
|
|
|
|
2014-07-03 12:50:36 +00:00
|
|
|
On the host side, the tool `dfu-util <http://dfu-util.gnumonks.org/>`_ can be used
|
|
|
|
to update the partitions. It is available for most distributions and typically
|
|
|
|
supports the following options::
|
|
|
|
|
|
|
|
dfu-util -h
|
|
|
|
Usage: dfu-util [options] ...
|
|
|
|
-h --help Print this help message
|
|
|
|
-V --version Print the version number
|
|
|
|
-v --verbose Print verbose debug statements
|
|
|
|
-l --list List the currently attached DFU capable USB devices
|
|
|
|
-e --detach Detach the currently attached DFU capable USB devices
|
|
|
|
-d --device vendor:product Specify Vendor/Product ID of DFU device
|
|
|
|
-p --path bus-port. ... .port Specify path to DFU device
|
|
|
|
-c --cfg config_nr Specify the Configuration of DFU device
|
|
|
|
-i --intf intf_nr Specify the DFU Interface number
|
|
|
|
-a --alt alt Specify the Altsetting of the DFU Interface
|
|
|
|
by name or by number
|
|
|
|
-t --transfer-size Specify the number of bytes per USB Transfer
|
|
|
|
-U --upload file Read firmware from device into <file>
|
|
|
|
-D --download file Write firmware from <file> into device
|
|
|
|
-R --reset Issue USB Reset signalling once we're finished
|
|
|
|
-s --dfuse-address address ST DfuSe mode, specify target address for
|
|
|
|
raw file download or upload. Not applicable for
|
|
|
|
DfuSe file (.dfu) downloads
|
|
|
|
|
|
|
|
To update the kernel for the above example, you would use something like
|
|
|
|
the following:
|
2014-06-17 08:37:25 +00:00
|
|
|
|
|
|
|
.. code-block:: sh
|
|
|
|
|
|
|
|
dfu-util -D arch/arm/boot/zImage -a kernel
|
|
|
|
|
2014-07-03 12:50:36 +00:00
|
|
|
The ``dfu-util`` command automatically finds DFU-capable devices. If there are
|
|
|
|
multiple devices found, you need to identify one with the ``-d``/``-p`` options.
|