Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add USB loaders for sunxi, tegra, samsung #1482

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
189 changes: 189 additions & 0 deletions doc/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,58 @@ Arguments:
Used by:
- `RKUSBDriver`_

SamsungUSBLoader
~~~~~~~~~~~~~~~~
A :any:`SamsungUSBLoader` resource describes a USB device in the *Samsung
loader state*.

.. code-block:: yaml

SamsungUSBLoader:
match:
ID_PATH: pci-0000:03:00.2-usb-0:4.2.4

Arguments:
- match (dict): key and value pairs for a udev match, see `udev Matching`_

Used by:
- `SamsungUSBDriver`_

SunxiUSBLoader
~~~~~~~~~~~~~~
A :any:`SunxiUSBLoader` resource describes a USB device in the *Allwinner
loader state*.

.. code-block:: yaml

SunxiUSBLoader:
## hub a12
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems specific to your lab and isn't very useful in the docs.

match:
'ID_PATH': 'pci-0000:00:14.0-usb-0:10.4.4:1.0'

Arguments:
- match (dict): key and value pairs for a udev match, see `udev Matching`_

Used by:
- `SunxiUSBDriver`_

TegraUSBLoader
~~~~~~~~~~~~~~
A :any:`TegraUSBLoader` resource describes a USB device in the *Tegra
loader state*.

.. code-block:: yaml

TegraUSBLoader:
match:
'ID_PATH': 'pci-0000:03:00.2-usb-0:3.4.1'

Arguments:
- match (dict): key and value pairs for a udev match, see `udev Matching`_

Used by:
- `TegraUSBDriver`_

NetworkMXSUSBLoader
~~~~~~~~~~~~~~~~~~~
A :any:`NetworkMXSUSBLoader` describes an `MXSUSBLoader`_ available on a remote
Expand All @@ -730,6 +782,21 @@ NetworkRKUSBLoader
A :any:`NetworkRKUSBLoader` describes an `RKUSBLoader`_ available on a remote
computer.

NetworkSamsungUSBLoader
~~~~~~~~~~~~~~~~~~~~~~~
A :any:`NetworkSamsungUSBLoader` describes a `SamsungUSBLoader`_ available on a
remote computer.

NetworkSunxiUSBLoader
~~~~~~~~~~~~~~~~~~~~~
A :any:`NetworkSunxiUSBLoader` describes a `SunxiUSBLoader`_ available on a
remote computer.

NetworkTegraUSBLoader
~~~~~~~~~~~~~~~~~~~~~
A :any:`NetworkTegraUSBLoader` describes a `TegraUSBLoader`_ available on a
remote computer.

AndroidUSBFastboot
~~~~~~~~~~~~~~~~~~
An :any:`AndroidUSBFastboot` resource describes a USB device in the *Fastboot
Expand Down Expand Up @@ -2478,6 +2545,128 @@ Arguments:
- usb_loader (str): optional, key in :ref:`images <labgrid-device-config-images>` containing the path
of a first-stage bootloader image to write

SunxiUSBDriver
~~~~~~~~~~~~~~
A :any:`SunxiUSBDriver` is used to upload an image into a device in the
*Allwinner loader state*. This is useful to bootstrap a bootloader onto a
device.

Note that sunxi is the common name for Allwinner SoCs, since they have product
codes like sun50i, sun7i, etc.

The load happens in two stages, first SPL and then U-Boot proper.

Binds to:
loader:
- `SunxiUSBLoader`_
- `NetworkSunxiUSBLoader`_

Implements:
- :any:`BootstrapProtocol`

.. code-block:: yaml

targets:
main:
drivers:
SunxiUSBDriver:
loadaddr: 0x4a000000
tools:
sunxi-fel: '/home/dev/bin/sunxi-fel'

Arguments:
- loadaddr (int): address to use when loading U-Boot. This depends on the
SoC being used. The easiest way to find this value is to check the
*CONFIG_TEXT_BASE* value in U-Boot
- image (str): Optional image filename
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should refer to a key in the images: dict of the target config in the environment and is implemented that way already.


Tools:
- sunxi-fel: Path to the 'sunxi-fel' tool (default is 'sunxi-fel')

SamsungUSBDriver
~~~~~~~~~~~~~~~~
A :any:`SamsungUSBDriver` is used to upload an image into a device in the
*Samsung loader state*. This is useful to bootstrap a bootloader onto a device.

The load happens in three stages: BL1, SPL and U-Boot proper.

Binds to:
loader:
- `SamsungUSBLoader`_
- `NetworkSamsungUSBLoader`_

Implements:
- :any:`BootstrapProtocol`

.. code-block:: yaml

targets:
main:
drivers:
SamsungUSBDriver:
bl1: '/home/dev/exynos/snow/u-boot.bl1.bin'
bl1_loadaddr: 0x02021400
spl_loadaddr: 0x02023400
loadaddr: 0x43e00000
tools:
smdk-usbdl: '/home/dev/bin/smdk-usbdl'

Arguments:
- bl1 (str): Filename of the BL1 file which sets up the SoC
- bl1_loadaddr (int): Load address of the BL1 file. This depends on the SoC
spl_load_addr (int): Load address of SPL. The easiest way to find this value
is to check the *CONFIG_SPL_TEXT_BASE* value in U-Boot
- loadaddr (int): address to use when loading U-Boot. This depends on the
SoC being used. The easiest way to find this value is to check the
*CONFIG_TEXT_BASE* value in U-Boot
- image (str): Optional image filename

Tools:
- smdk-usbdl: Path to the 'smdk-usbdl' tool (default is 'smdk-usbdl')

TegraUSBDriver
~~~~~~~~~~~~~~
A :any:`TegraUSBDriver` is used to upload an image into a device in the
*Nvidia Tegra loader state*. This is useful to bootstrap a bootloader onto a
device.

The load happens in a single stage, with U-Boot proper sent along with a
*BCT* (Binary Control Tool) configuration file which contains memory timings,
etc.
sjg20 marked this conversation as resolved.
Show resolved Hide resolved

Binds to:
loader:
- `TegraUSBLoader`_
- `NetworkTegraUSBLoader`_

Implements:
- :any:`BootstrapProtocol`

.. code-block:: yaml

targets:
main:
drivers:
TegraUSBDriver:
loadaddr: 0x80108000
bct: '/home/dev/tegra124/nvidia/norrin/PM370_Hynix_2GB_H5TC4G63AFR_PBA_924MHz_01212014.bct'
usb_path: 1-3.4.1
tools:
tegrarcm: '/home/dev/bin/tegrarcm'

Arguments:
- loadaddr (int): address to use when loading the firmware. This depends on
the SoC being used. For U-Boot the easiest way to find this value is to
check the *CONFIG_TEXT_BASE* value
- bct (str): path to the BCT (configuration file)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the image argument, this should refer to a key in the images: part of the target config in the environment. See IMXUSBDriver, RKUSBDriver or UUUDriver.

This also applies to the actual image key here (where it's actually supported in the code).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually different for each board, so we cannot have a single bct file.

- usb_path (str): USB device to program. This can be obtained using udevadm
with the USB bus and device number. For example
`udevadm info /dev/bus/usb/003/042` then look at DEVPATH.
- image (str): Optional image filename

Tools:
- tegrarcm: Path to the 'tegrarcm' tool (default is 'tegrarcm')

UUUDriver
~~~~~~~~~
A :any:`UUUDriver` is used to upload an image into a device in the *NXP USB
Expand Down
3 changes: 2 additions & 1 deletion labgrid/driver/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
DigitalOutputPowerDriver, YKUSHPowerDriver, \
USBPowerDriver, SiSPMPowerDriver, NetworkPowerDriver, \
PDUDaemonDriver
from .usbloader import MXSUSBDriver, IMXUSBDriver, BDIMXUSBDriver, RKUSBDriver, UUUDriver
from .usbloader import MXSUSBDriver, IMXUSBDriver, BDIMXUSBDriver, \
RKUSBDriver, SunxiUSBDriver, UUUDriver
from .usbsdmuxdriver import USBSDMuxDriver
from .usbsdwiredriver import USBSDWireDriver
from .common import Driver
Expand Down
Loading
Loading