This is an old revision of the document!



Warning: Declaration of syntax_plugin_pagebox::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /home/customer/www/wiki.solid-run.com/public_html/lib/plugins/pagebox/syntax.php on line 0

Warning: Declaration of syntax_plugin_pagebox::render($mode, &$renderer, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /home/customer/www/wiki.solid-run.com/public_html/lib/plugins/pagebox/syntax.php on line 0

A38X U-Boot

Installing automatically (SPI, eMMC)

This section assumes that you already have a version of U-Boot >= 2018.01 running on your device!

First prepare an sdcard or usb-drive with the u-boot binary that you want to install: - Filesystem should be one of ext2,3,4 and fat, on partition 1 - copy the u-boot binary to the top level directory of your sdcard or usb drive - Eject the drive and plug it into your clearfog board

Now drop to the U-Boot console and run one of these update commands (you might have to substitute the file names *.kwb by the actual names on your drive):

# To install u-boot-spl-spi.kwb from sdcard to spi:
bubt u-boot-spl-spi.kwb spi mmc
# To install u-boot-spl-spi.kwb from usb to spi
bubt u-boot-spl-spi.kwb spi usb
# To install u-boot-spl-mmc.kwb from usb to emmc (see below)
bubt u-boot-spl-mmc.kwb mmc usb
Select eMMC boot partition

Depending on how the eMMC is configured, the BootROM will look for U-Boot either on the main partition, or boot0, or boot1. To find out about the current configuration, run

mmc partconf 0

on the u-boot console. It will print a block similar to:

=> mmc partconf 0
EXT_CSD[179], PARTITION_CONFIG:
BOOT_ACK: 0x0
BOOT_PARTITION_ENABLE: 0x0
PARTITION_ACCESS: 0x0

The magic data field is BOOT_PARTITION_ENABLE:

value description
0x0 boot from main partition
0x1 boot from boot0
0x2 boot from boot1

To select a different partition, run mmc partconf again, but this time with 4 arguments:

# Syntax: mmc partconf dev [boot_ack boot_partition partition_access]
# boot_partition is the field we want to change, 
# for boot_ack and partition_access, please use the existing values as reference.

# Example for booting from the main partition:
mmc partconf 0 0 0 0

# Example for booting from boot0:
mmc partconf 0 0 1 0

# Example for booting from boot1:
mmc partconf 0 0 2 0

Installing manually

microSD

The BootROM searches for U-Boot after the first 512 bytes, so use the dd command to write u-boot to this location on your microSD card. Substitute sdX by the device node of your sdcard.

dd if=u-boot-spl-sdhc.kwb of=/dev/sdX bs=512 seek=1 conv=sync
Note - Take your time while identifying where your designated SD-Card is mapped on your linux system. Failure to do so can result in overwriting an arbitrary disk on your system!
SPI

This section assumes that you already have a version of U-Boot >= 2018.01 running on your device!

The BootROM loads U-boot from the start of SPI flash, offset=0. U-Boot expects to have the first 1M for itself, the environment lives at 0x0fe000-0x100000.

Drop to the U-Boot console, and execute these command for loading the u-boot binary to memory, and then writing it to the spi flash. This sample only covers eMMC/sdcard partition 1 as source, but network or usb are also usable.

ext4load mmc 0:1 0x200000 /u-boot-spl-spi.kwb
sf probe
# you may want to erase the first 1M, or just the environment:
# sf erase 0 0x100000
sf write 0x200000 0 $filesize
eMMC

This section assumes that you already have linux running on your board! First remove write protection from boot0 partition:

echo 0 | sudo tee /sys/block/mmcblk0boot0/force_ro

Now write U-Boot to the start of boot0:

sudo dd if=u-boot-spl-mmc.kwb of=/dev/mmcblk0boot0 conv=sync

Booting from UART

This section assumes that you have downloaded and compiled the U-Boot sources so that the binary tools/kwboot exists!

TODO: This section is not finished yet, some patches to U-Boot are still missing

Make sure to configure the Boot DIPs for UART (Bootdevice). However this is not strictly necessary because the BootROM will fall back to UART, if it does not find a bootloader elsewhere.

After connecting the serial uart to your PC using a micro-USB-cable, run this command to send U-Boot to the board for execution:

# This does not yet work! Some patches are still missing :(
./tools/kwboot -t -b u-boot-spl-uart.kwb -B 115200 /dev/ttyUSB1

Now turn on, or reset the board.

Compiling from source

This section assumes that you have git, make and a cross-compiler targeting 32-bit arm available on your system!

These are the instructions to fetch the code, and build a binary:

git clone --branch v2018.01-solidrun-a38x https://github.com/SolidRun/u-boot.git u-boot-clearfog
cd u-boot-clearfog
export CROSS_COMPILE=<Set toolchain prefix to your toolchain>
# optionally add options to configs/clearfog_defconfig
make clearfog_defconfig
# optionally configure u-boot graphically
# make menuconfig
make

This will generate u-boot-spl-sdhc.kwb to be used on the Clearfog Pro when booting from an sdcard. To target the Clearfog Base and/or other boot media, set the following options in configs/clearfog_defconfig or through menuconfig:

  • Clearfog Pro (default)
CONFIG_TARGET_CLEARFOG=y
  • Clearfog Base
CONFIG_TARGET_CLEARFOG_BASE=y
  • SD-Card (default)
CONFIG_MVEBU_SPL_BOOT_DEVICE_SDHC=y
  • SPI
CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI=y
  • eMMC
CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC=y
  • UART
CONFIG_MVEBU_SPL_BOOT_DEVICE_UART=y

Note: The resulting binaries will carry the respective -sdhc/-spi/-emmc/-uart suffixes in the name.

Verified Boot

Verified Boot is a way to ensure that only authenticated code will be executed on a machine. This page provides instructions on setting this up for the startup phase from u-boot to Linux.

Read more here: Verified Boot

Setup Mac-Address

The A38x MicroSoms haven't got any fixed or prefused Mac-Addresses. On each power-on a random Mac Address is generated:

U-Boot 2018.01 (Mar 19 2018 - 15:48:44 +0000)

SoC:   MV88F6828-A0 at 1600 MHz
DRAM:  1 GiB (800 MHz, 32-bit, ECC not enabled)
MMC:   mv_sdh: 0
SF: Detected w25q32bv with page size 256 Bytes, erase size 4 KiB, total 4 MiB
*** Warning - bad CRC, using default environment

Model: SolidRun Clearfog A1
Board: SolidRun ClearFog
SCSI:  MVEBU SATA INIT
Target spinup took 0 ms.
AHCI 0001.0000 32 slots 2 ports 6 Gbps 0x3 impl SATA mode
flags: 64bit ncq led only pmp fbss pio slum part sxs 
Net:   
Warning: [email protected] (eth1) using random MAC address - d2:63:b4:96:1c:cb
eth1: [email protected]
Warning: [email protected] (eth2) using incremented MAC address - d2:63:b4:96:1c:cc
, eth2: [email protected]
Warning: [email protected] (eth3) using incremented MAC address - d2:63:b4:96:1c:cd
, eth3: [email protected]
Hit any key to stop autoboot:  0

The easiest way to avoid this is by saving the U-Boot environment once from the U-Boot console:

saveenv

If you instead want to use specific MAC addresses, they can be set per interface using these U-Boot commands:

setenv eth1addr c2:d8:c5:2d:92:0e
setenv eth2addr 2e:d7:af:12:e1:96
setenv eth3addr 92:67:67:88:6d:13
saveenv
reset

The next bootlog should show up like this:

Model: SolidRun Clearfog A1
Board: SolidRun ClearFog
SCSI:  MVEBU SATA INIT
Target spinup took 0 ms.
AHCI 0001.0000 32 slots 2 ports 6 Gbps 0x3 impl SATA mode
flags: 64bit ncq led only pmp fbss pio slum part sxs 
Net:   eth1: [email protected], eth2: [email protected], eth3: [email protected]
Hit any key to stop autoboot:  0
By removing the RTC-Battery the U-Boot environment, and with it the mac addresses are reset!

Legacy U-Boot (2013.01)

Description

Build Instructions

Following are instructions on how to build u-boot for ClearFog board -

git clone https://github.com/SolidRun/u-boot-armada38x.git
cd u-boot-armada38x
export CROSS_COMPILE=<Set toolchain prefix to your toolchain>
make armada_38x_clearfog_config
make u-boot.mmc

This will generate u-boot.mmc and u-boot-uart.mmc where the first one is the image that is normally booted from and the second is a uart version (look below how to use it).

eMMC Flashing Instructions

Short Summary:

  • Booting the device in UART
  • Getting up Uboot
  • Copy the operationsystem onto a USB-Drive (get it from images.solid-build.xyz)
  • Using Uboot to write the operation-files onto the emmc. (emmc write)
  • (depends on which board you use - just update the dtb file)

A useful blogpost can be found here: http://wtarreau.blogspot.de/2016/09/installing-linux-on-solidrun.html

Following are instructions on how to flash u-boot on an on MicroSOM eMMC (requires to order MicroSOM with eMMC from SolidRun).

The main different between booting u-boot on eMMC and MicroSD is that in MicroSD u-boot resides in second sector of the SD card, where in eMMC it must reside in first block in either the main eMMC storage or it's first or second boot partitions.

So if the main phyiscal partition of eMMC is used then it will override the partition table. So it's recommended to use the boot partitions for that purpose -

  • Boot u-boot via UART
  • Load the built u-boot.mmc described above to memory; assuming address 0x02000000. It can be loaded from TFTP (sadly USB does not work at this point)
  • Set working partition to be the boot partition #1 by running 'mmc dev 0 1'. You can run 'help mmc' to see different u-boot commands
  • Flash u-boot into the FIRST block 'mmc write 0x02000000 0 0x800'. Notice that you can modify 0x800 to the actual u-boot size in 512bytes blocks

TFTP sample:

dhcp
tftpboot 0x02000000 192.168.178.68:u-boot.mmc
mmc write 0x02000000 0 ${filesize}

Alternatively you can boot Linux and run

  • dd if=u-boot.mmc of=/dev/mmcblk0boot0

Booting the uart version of u-boot

When not using secure boot the Armada 38x processor can be stopped from booting through it's reset strap boot vector and redirected to boot from uart.

This is mostly used for system manufacturing, unbricking etc…

The u-boot-uart.mmc version that is built above is a ready to use xmodem protocol transferable image to Armada 38x processor. But first the processor needs to be redirected from it's default boot vector.

This can be achieved by running the 'download-serial.sh' script that is part of SolidRun u-boot -

https://github.com/SolidRun/u-boot-armada38x/commit/1e88e63a25ce68d8c1295179c04455ca2ffdfc8a https://github.com/SolidRun/u-boot-armada38x/blob/u-boot-2013.01-15t1-clearfog/download-serial.sh

An example is as follows -

./download-serial.sh /dev/ttyUSB0 u-boot-uart.mmc

Embedded in download-serial.sh a small C program that gets built every time the script runs and requires curses libraries.

Booting directly from M.2 SSD

Armada 38x supports booting directly from a SATA device. You can do that too on ClearFog base and pro.

Booting from CleraFog pro M.2 SSD instructions

  1. Hardware modification first - remove RN5 (resistor array number 5) from the board. RN5 can be found near the M.2 connector on the bottom side of the board.
  2. RN5 is there first place in order to force pull-up B2B_MPP57 (SPI Clock) on a pin on Mikrobus since one of it's pins is also used as boot select reset strap. If Mikrobus is not used then this can be removed without worry. If Mikrobus is used then make sure that B2B_MPP57 is not pulled up or down.
  3. Follow the above build instructions but run 'make u-boot.sata. This will generate u-boot.sata target that can be flashed on the second sector of the M.2 SSD
  4. For flashing the the image run 'dd if=/dev/u-boot.sata of=/dev/sdX bs=512 seek=1' on your PC.
  5. Alternatively you can boot the -uart version as described above and use 'tftp' and 'scsi' commands in u-boot to tftp the u-boot.sata file and then write it to the SSD via 'scsi write' command.

Notice that with this support the environment variables are still assumed to be on the SD or eMMC device since environment on SCSI is still not supported.

EMMC Boot issues

This issue has been resolved in our 2018.01 U-Boot fork, and only needed for older versions.

When using the micro SD there is the card detect signal which tells if the card is inserted or not. In eMMC case this doesn't exist; but still the card detect is being pulled since it's using the same device tree.

The card detect on the carrier board will be used and then the kernel should recognize the kernel.

The fix would be as follows -

diff --git a/arch/arm/boot/dts/armada-388-clearfog.dts b/arch/arm/boot/dts/armada-388-clearfog.dts
index 8fa7b27..b8b05ad 100644
--- a/arch/arm/boot/dts/armada-388-clearfog.dts
+++ b/arch/arm/boot/dts/armada-388-clearfog.dts
@@ -308,7 +308,7 @@
 
                        [email protected] {
                                bus-width = <4>;
-                               cd-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
+//                             cd-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
                                no-1-8-v;
                                pinctrl-0 = <&clearfog_sdhci_pins
                                             &clearfog_sdhci_cd_pins>;

Following is a link to a dtb that has that fixed - https://dl.dropboxusercontent.com/u/72661517/tbr/armada-388-clearfog.dtb

Switching PCIe to MSATA

HW Clock Issues

Boot the board, stop it when it gets to “Hit any key to stop autoboot”, and then type 'date reset' enter twice.

Note that the u-boot that is released on SolidRun github account this is not needed anymore.

Customizing u-boot for a custom board

The easiest method to customize u-boot for a custom board using the A38x MicroSOM is to start with the clearfog board configuration and modifying it to the custom board.

The following are high level instructions how to do that -

Modifying a 32bit DDR bus A388 MicroSOM to utilize only 16bit DDR

A developer that wants to evaluate the performance when using 16bit DDR bus width (like in the base MicroSOM) then the following patch on u-boot can accomplish that.

With this patch only one DDR device is being used as x16 instead of two DDR devices being used as x32 -

diff --git a/tools/marvell/bin_hdr/inc/ddr3_soc/a38x/ddr3_a38x_topology.h b/tools/marvell/bin_hdr/inc/ddr3_soc/a38x/ddr3_a38x_topology.h
index c0fa1e7..f71f3f8 100755
--- a/tools/marvell/bin_hdr/inc/ddr3_soc/a38x/ddr3_a38x_topology.h
+++ b/tools/marvell/bin_hdr/inc/ddr3_soc/a38x/ddr3_a38x_topology.h
@@ -117,7 +117,7 @@ MV_HWS_TOPOLOGY_MAP TopologyMap[] =
     0x1, /* active interfaces */
     /*cs_mask, mirror, dqs_swap, ck_swap X PUPs                                     speed_bin             memory_device_width  mem_size     frequency  casL casWL      temperature */
 	{{{{0x1,0,0,0}, {0x1,0,0,0}, {0x1,0,0,0}, {0x1,0,0,0}, {0x1,0,0,0}}, SPEED_BIN_DDR_CUST_BOARD_2, BUS_WIDTH_CUST_BOARD_2 , MEM_4G, DDR_FREQ_800, 0 ,   0 , MV_HWS_TEMP_LOW}},
-    INTERFACE_BUS_MASK_32BIT  /* Buses mask */
+    INTERFACE_BUS_MASK_16BIT  /* Buses mask */
     }
 };
 

Supporting 2GByte memory configuration

It is possible to order from SolidRun 2GByte memory configuration where the support is using twin die memory configuration.

Twin die is a configuration of DDR components where there are two DDR dies in the same package and each gets it's own chip-select control.

diff --git a/tools/marvell/bin_hdr/inc/ddr3_soc/a38x/ddr3_a38x_topology.h b/tools/marvell/bin_hdr/inc/ddr3_soc/a38x/ddr3_a38x_topology.h
index c0fa1e7..715ec45 100755
--- a/tools/marvell/bin_hdr/inc/ddr3_soc/a38x/ddr3_a38x_topology.h
+++ b/tools/marvell/bin_hdr/inc/ddr3_soc/a38x/ddr3_a38x_topology.h
@@ -116,7 +116,7 @@ MV_HWS_TOPOLOGY_MAP TopologyMap[] =
     {
     0x1, /* active interfaces */
     /*cs_mask, mirror, dqs_swap, ck_swap X PUPs                                     speed_bin             memory_device_width  mem_size     frequency  casL casWL      temperature */
-	{{{{0x1,0,0,0}, {0x1,0,0,0}, {0x1,0,0,0}, {0x1,0,0,0}, {0x1,0,0,0}}, SPEED_BIN_DDR_CUST_BOARD_2, BUS_WIDTH_CUST_BOARD_2 , MEM_4G, DDR_FREQ_800, 0 ,   0 , MV_HWS_TEMP_LOW}},
+	{{{{0x3,0,0,0}, {0x3,0,0,0}, {0x3,0,0,0}, {0x3,0,0,0}, {0x3,0,0,0}}, SPEED_BIN_DDR_CUST_BOARD_2, BUS_WIDTH_CUST_BOARD_2 , MEM_4G, DDR_FREQ_800, 0 ,   0 , MV_HWS_TEMP_LOW}},
     INTERFACE_BUS_MASK_32BIT  /* Buses mask */
     }
 };

Setup Mac-Address

The A38x MicroSoms havent got any fixed or prefused Mac-Addresses. On each boot a random Mac Address is setup:

U-Boot 2017.03 (Apr 23 2017 - 18:30:33 +0000)

SoC:   MV88F6828-A0 at 1600 MHz
I2C:   ready
DRAM:  1 GiB (800 MHz, ECC not enabled)
MMC:   mv_sdh: 0
PCI:
  00:01.0     - 168c:003c - Network controller
Model: SolidRun Clearfog A1
Board: SolidRun ClearFog
Net:
Warning: [email protected] (eth2) using random MAC address - 92:67:67:88:6d:13
eth2: [email protected]
Warning: [email protected] (eth3) using random MAC address - 2e:d7:af:12:e1:96
, eth3: [email protected]
Warning: [email protected] (eth1) using random MAC address - c2:d8:c5:2d:92:0e
, eth1: [email protected]
Hit any key to stop autoboot:  0

To avoid this, you can manually setup a Mac-Address by hit a key during uboot loads, and then enter following commands:

setenv eth1addr c2:d8:c5:2d:92:0e
setenv eth2addr 2e:d7:af:12:e1:96
setenv eth3addr 92:67:67:88:6d:13
saveenv
reset

The next bootlog should showed up like this:

Model: SolidRun Clearfog A1
Board: SolidRun ClearFog
Net:   eth2: [email protected], eth3: [email protected], eth1: [email protected]
Hit any key to stop autoboot:  0
By removing the RTC-Battery the mac addresses are gone