[U-Boot] [PATCH 3/3] marvell: armada385: Add the Turris Omnia board

Andreas Färber afaerber at suse.de
Sat May 13 09:54:13 UTC 2017


Hi Marek,

Thanks for working on this.

Am 12.05.2017 um 16:10 schrieb Marek Behún:
> The Turris Omnia is a open-source router created by CZ.NIC.
> 
> The code is based on the Marvell/db-88f6820-gp by Stefan Roese
> with modifications from Tomas Hlavacek in the CZ.NIC turris-omnia-uboot
> repository, which can be found at
> https://gitlab.labs.nic.cz/turris/turris-omnia-uboot
> 
> The code does not yet support reading the ATSHA204 cryptochip, which
> stores the serial number of the device, as well as the base MAC
> address.
> 
> Also, the device does by default use btrfs as the main filesystem, on
> which kernel and device tree is stored. U-Boot does not yes support

"not yet"

> btrfs, thus the configuration header defaults to ext4.
> 

Given the above history remarks, shouldn't there also be a Signed-off-by
from Tomas before yours?

> Signed-off-by: Marek Behun <marek.behun at nic.cz>
> ---
>  arch/arm/dts/armada-385-turris-omnia.dts | 428 +++++++++++++++++++++++++++++++

Please indicate in the commit message where exactly this file comes from
- tree and tag/commit. Were any changes done compared to mainline Linux?

>  arch/arm/mach-mvebu/Kconfig              |   7 +
>  board/CZ.NIC/turris_omnia/Makefile       |   7 +
>  board/CZ.NIC/turris_omnia/kwbimage.cfg   |  12 +
>  board/CZ.NIC/turris_omnia/turris_omnia.c | 364 ++++++++++++++++++++++++++
>  configs/turris_omnia_defconfig           |  59 +++++
>  include/configs/turris_omnia.h           | 181 +++++++++++++
>  7 files changed, 1058 insertions(+)
>  create mode 100644 arch/arm/dts/armada-385-turris-omnia.dts
>  create mode 100644 board/CZ.NIC/turris_omnia/Makefile
>  create mode 100644 board/CZ.NIC/turris_omnia/kwbimage.cfg
>  create mode 100644 board/CZ.NIC/turris_omnia/turris_omnia.c
>  create mode 100644 configs/turris_omnia_defconfig
>  create mode 100644 include/configs/turris_omnia.h
> 
> diff --git a/arch/arm/dts/armada-385-turris-omnia.dts b/arch/arm/dts/armada-385-turris-omnia.dts
> new file mode 100644
> index 0000000..369b69a
> --- /dev/null
> +++ b/arch/arm/dts/armada-385-turris-omnia.dts
> @@ -0,0 +1,428 @@
> +/*
> + * Device Tree file for the Turris Omnia
> + *
> + * Copyright (C) 2014 Marvell
> + *
> + * Marek Behun <marek.behun at nic.cz)

Typo in upstream kernel?

> + * Gregory CLEMENT <gregory.clement at free-electrons.com>
[...]
> diff --git a/include/configs/turris_omnia.h b/include/configs/turris_omnia.h
> new file mode 100644
> index 0000000..0c7960d
> --- /dev/null
> +++ b/include/configs/turris_omnia.h
> @@ -0,0 +1,181 @@
> +/*
> + * Copyright (C) 2017 Marek Behun <marek.behun at nic.cz>
> + * Copyright (C) 2016 Tomas Hlavacek <tomas.hlavacek at nic.cz>
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> + */
> +
> +#ifndef _CONFIG_TURRIS_OMNIA_H
> +#define _CONFIG_TURRIS_OMNIA_H
> +
> +/*
> + * High Level Configuration Options (easy to change)
> + */
> +
> +#define CONFIG_DISPLAY_BOARDINFO_LATE
> +#define CONFIG_LIB_RAND
> +#define CONFIG_NET_RANDOM_ETHADDR
> +#define CONFIG_CMD_EXT4
> +
> +/*
> + * TEXT_BASE needs to be below 16MiB, since this area is scrubbed
> + * for DDR ECC byte filling in the SPL before loading the main
> + * U-Boot into it.
> + */
> +#define	CONFIG_SYS_TEXT_BASE	0x00800000
> +#define CONFIG_SYS_TCLK		250000000	/* 250MHz */
> +
> +/*
> + * Commands configuration
> + */
> +#define CONFIG_CMD_ENV
> +#define CONFIG_CMD_PCI
> +#define CONFIG_SCSI
> +
> +/* RAW initrd support */
> +#define CONFIG_SUPPORT_RAW_INITRD
> +
> +/*#define CONFIG_ATSHA204
> +#define CONFIG_ATSHA204_ADDR	0x64*/

The address shouldn't hurt to define, but please drop the commented-out
not-yet-upstream define. Chances are, as a new driver, it should go into
the Kconfig.

> +
> +/* I2C */
> +#define CONFIG_DM_I2C
> +#define CONFIG_SYS_I2C_MVTWSI
> +
> +/* Watchdog */
> +#ifndef CONFIG_SPL_BUILD
> +#define CONFIG_HW_WATCHDOG
> +#define CONFIG_ORION_WATCHDOG
> +#endif
> +
> +/* SPI NOR flash default params, used by sf commands */
> +#define CONFIG_SF_DEFAULT_SPEED		1000000
> +#define CONFIG_SF_DEFAULT_MODE		SPI_MODE_3
> +#define CONFIG_SPI_FLASH_SPANSION
> +
> +/*
> + * SDIO/MMC Card Configuration
> + */
> +#define CONFIG_SYS_MMC_BASE		MVEBU_SDIO_BASE
> +
> +/*
> + * SATA/SCSI/AHCI configuration
> + */
> +#define CONFIG_LIBATA
> +#define CONFIG_SCSI_AHCI
> +#define CONFIG_SCSI_AHCI_PLAT
> +#define CONFIG_SYS_SCSI_MAX_SCSI_ID	2
> +#define CONFIG_SYS_SCSI_MAX_LUN		1
> +#define CONFIG_SYS_SCSI_MAX_DEVICE	(CONFIG_SYS_SCSI_MAX_SCSI_ID * \
> +					 CONFIG_SYS_SCSI_MAX_LUN)
> +
> +/* Partition support */
> +
> +/* Additional FS support/configuration */
> +#define CONFIG_SUPPORT_VFAT
> +
> +/* USB/EHCI configuration */
> +#define CONFIG_EHCI_IS_TDI
> +
> +/* Environment in SPI NOR flash */
> +#define CONFIG_ENV_IS_IN_SPI_FLASH
> +#define CONFIG_ENV_OFFSET		(3*(1 << 18)) /* 768KiB in */
> +#define CONFIG_ENV_SIZE			(64 << 10) /* 64KiB */
> +#define CONFIG_ENV_SECT_SIZE		(256 << 10) /* 256KiB sectors */
> +
> +#define CONFIG_PHY_MARVELL		/* there is a marvell phy */
> +#define PHY_ANEG_TIMEOUT	8000	/* PHY needs a longer aneg time */
> +
> +/* PCIe support */
> +#ifndef CONFIG_SPL_BUILD
> +#define CONFIG_PCI_MVEBU
> +#define CONFIG_PCI_SCAN_SHOW
> +#endif
> +
> +#define CONFIG_SYS_ALT_MEMTEST
> +
> +/* Default boot environment. */
> +#define CONFIG_BOOTCOMMAND			\
> +	"i2c dev 1; "				\
> +	"i2c read 0x2a 0x9 1 0x00FFFFF0; "	\
> +	"setexpr.b rescue *0x00FFFFF0; "	\
> +	"if test $rescue -ge 1; then "		\
> +		"echo BOOT RESCUE; "		\
> +		"run rescueboot; "		\
> +	"else "					\
> +		"echo BOOT eMMC FS; "		\
> +		"run mmcboot; "			\
> +	"fi"
> +
> +/* Keep device tree and initrd in lower memory so the kernel can access them */
> +#define CONFIG_EXTRA_ENV_SETTINGS	\
> +	"fdt_high=0x10000000\0"		\
> +	"initrd_high=0x10000000\0"	\
> +	"ethact=neta2\0"		\
> +	"mmcboot=setenv bootargs \"$bootargs cfg80211.freg=$regdomain\"; " \
> +		"ext4load mmc 0 0x01000000 boot/zImage; " \
> +		"ext4load mmc 0 0x02000000 boot/dtb; " \
> +		"bootz 0x01000000 - 0x02000000\0" \
> +	"rescueboot=i2c mw 0x2a.1 0x3 0x1c 1; " \
> +		"i2c mw 0x2a.1 0x4 0x1c 1; " \
> +		"mw.l 0x01000000 0x00ff000c; " \
> +		"i2c write 0x01000000 0x2a.1 0x5 4 -s; " \
> +		"setenv bootargs \"$bootargs omniarescue=$rescue\"; " \
> +		"sf probe; " \
> +		"sf read 0x1000000 0x100000 0x700000; " \
> +		"bootz 0x1000000\0" \
> +	"bootargs=earlyprintk console=ttyS0,115200 rootfstype=ext4 " \
> +		"rootdelay=2 root=b301 rootflags=subvol=@,commit=5 rw\0"

These env settings are very old-style. Please use the distro macros.
That means among others defining kernel_addr_r=0x01000000,
fdt_addr_r=0x02000000 and ramdisk_addr_r and use the standardized boot
commands instead of hardcoding mmcboot here. Then also USB, mSATA and
network boot should be supported, and it abstracts the filesystem, plus
it adds UEFI support.

Selecting the distro defaults from the defconfig should also obsolete
requiring ext4 in this config, among others.

> +
> +/* SPL */
> +/*
> + * Select the boot device here
> + *
> + * Currently supported are:
> + * SPL_BOOT_SPI_NOR_FLASH	- Booting via SPI NOR flash
> + * SPL_BOOT_SDIO_MMC_CARD	- Booting via SDIO/MMC card (partition 1)
> + */
> +#define SPL_BOOT_SPI_NOR_FLASH		1
> +#define SPL_BOOT_SDIO_MMC_CARD		2
> +#define CONFIG_SPL_BOOT_DEVICE		SPL_BOOT_SPI_NOR_FLASH

Sounds like something more suitable for Kconfig?

> +
> +/* Defines for SPL */
> +#define CONFIG_SPL_FRAMEWORK
> +#define CONFIG_SPL_SIZE			(140 << 10)
> +#define CONFIG_SPL_TEXT_BASE		0x40000030
> +#define CONFIG_SPL_MAX_SIZE		(CONFIG_SPL_SIZE - 0x0030)
> +
> +#define CONFIG_SPL_BSS_START_ADDR	(0x40000000 + CONFIG_SPL_SIZE)
> +#define CONFIG_SPL_BSS_MAX_SIZE		(16 << 10)
> +
> +#ifdef CONFIG_SPL_BUILD
> +#define CONFIG_SYS_MALLOC_SIMPLE
> +#endif
> +
> +#define CONFIG_SPL_STACK		(0x40000000 + ((192 - 16) << 10))
> +#define CONFIG_SPL_BOOTROM_SAVE		(CONFIG_SPL_STACK + 4)
> +#define CONFIG_SPL_DRIVERS_MISC_SUPPORT
> +
> +#if CONFIG_SPL_BOOT_DEVICE == SPL_BOOT_SPI_NOR_FLASH
> +/* SPL related SPI defines */
> +#define CONFIG_SPL_SPI_LOAD
> +#define CONFIG_SYS_SPI_U_BOOT_OFFS	0x24000
> +#define CONFIG_SYS_U_BOOT_OFFS		CONFIG_SYS_SPI_U_BOOT_OFFS
> +#endif
> +
> +#if CONFIG_SPL_BOOT_DEVICE == SPL_BOOT_SDIO_MMC_CARD
> +/* SPL related MMC defines */
> +#define CONFIG_SYS_MMC_U_BOOT_OFFS		(160 << 10)
> +#define CONFIG_SYS_U_BOOT_OFFS			CONFIG_SYS_MMC_U_BOOT_OFFS
> +#ifdef CONFIG_SPL_BUILD
> +#define CONFIG_FIXED_SDHCI_ALIGNED_BUFFER	0x00180000	/* in SDRAM */
> +#endif
> +#endif
> +
> +/*
> + * mv-common.h should be defined after CMD configs since it used them
> + * to enable certain macros
> + */
> +#include "mv-common.h"
> +
> +#endif /* _CONFIG_TURRIS_OMNIA_H */

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)


More information about the U-Boot mailing list