diff options
author | Tom Rini <trini@konsulko.com> | 2023-10-27 09:38:58 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-10-27 09:38:58 -0400 |
commit | 753eba3f68d87b90a99136eba6403a7e3640e707 (patch) | |
tree | 669b791a21bee03e61afd948728aac81c56fc510 | |
parent | fb428b61819444b9337075f49c72f326f5d12085 (diff) | |
parent | b6014f209f15bd49dd4ceb987d3a52e99b0305d4 (diff) | |
download | u-boot-753eba3f68d87b90a99136eba6403a7e3640e707.zip u-boot-753eba3f68d87b90a99136eba6403a7e3640e707.tar.gz u-boot-753eba3f68d87b90a99136eba6403a7e3640e707.tar.bz2 |
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell
- kirkwood: Enable bootstd on some boards (Tony)
- mvebu: turris_mox: Extend to support RIPE Atlas Probe (Marek)
- mvebu/bubt: Support eMMC data partition booting (Josua)
-rw-r--r-- | arch/arm/dts/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/dts/armada-3720-ripe-atlas.dts | 91 | ||||
-rw-r--r-- | arch/arm/mach-mvebu/Kconfig | 6 | ||||
-rw-r--r-- | arch/arm/mach-mvebu/spl.c | 5 | ||||
-rw-r--r-- | board/CZ.NIC/turris_mox/mox_sp.c | 12 | ||||
-rw-r--r-- | board/CZ.NIC/turris_mox/mox_sp.h | 8 | ||||
-rw-r--r-- | board/CZ.NIC/turris_mox/turris_mox.c | 72 | ||||
-rw-r--r-- | cmd/mvebu/bubt.c | 11 | ||||
-rw-r--r-- | configs/nsa310s_defconfig | 3 | ||||
-rw-r--r-- | configs/pogo_v4_defconfig | 3 | ||||
-rw-r--r-- | configs/turris_mox_defconfig | 3 | ||||
-rw-r--r-- | include/configs/nsa310s.h | 17 | ||||
-rw-r--r-- | include/configs/pogo_v4.h | 35 |
13 files changed, 200 insertions, 67 deletions
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 7007997..55aceb5 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -322,6 +322,7 @@ else dtb-$(CONFIG_ARCH_MVEBU) += \ armada-3720-db.dtb \ armada-3720-espressobin.dtb \ + armada-3720-ripe-atlas.dtb \ armada-3720-turris-mox.dtb \ armada-3720-eDPU.dtb \ armada-3720-uDPU.dtb \ diff --git a/arch/arm/dts/armada-3720-ripe-atlas.dts b/arch/arm/dts/armada-3720-ripe-atlas.dts new file mode 100644 index 0000000..4457845 --- /dev/null +++ b/arch/arm/dts/armada-3720-ripe-atlas.dts @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: GPL-2.0+ or X11 +/* + * Device Tree file for CZ.NIC' RIPE Atlas Probe + * 2021 by Marek BehĂșn <marek.behun@nic.cz> + */ + +/dts-v1/; + +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/leds/common.h> +#include "armada-372x.dtsi" + +/ { + model = "CZ.NIC's RIPE Atlas Probe"; + compatible = "cznic,ripe-atlas", "marvell,armada3720", + "marvell,armada3710"; + + aliases { + ethernet0 = ð0; + mmc0 = &sdhci0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory { + device_type = "memory"; + reg = <0x00000000 0x00000000 0x00000000 0x20000000>; + }; + + leds { + compatible = "gpio-leds"; + + led { + gpios = <&gpiosb 21 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_RED>; + function = LED_FUNCTION_ACTIVITY; + }; + }; + + vsdc_reg: vsdc-reg { + compatible = "regulator-gpio"; + regulator-name = "vsdc"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + + gpios = <&gpiosb 23 GPIO_ACTIVE_HIGH>; + gpios-states = <0>; + states = <1800000 0x1 + 3300000 0x0>; + enable-active-high; + }; +}; + +&comphy { + status = "disabled"; +}; + +&mdio { + pinctrl-names = "default"; + pinctrl-0 = <&smi_pins>; + status = "okay"; + + phy1: ethernet-phy@1 { + reg = <1>; + }; +}; + +ð0 { + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>; + phy-mode = "rgmii"; + phy-handle = <&phy1>; + status = "okay"; +}; + +&sdhci0 { + bus-width = <8>; + non-removable; + vqmmc-supply = <&vsdc_reg>; + marvell,pad-type = "sd"; + status = "okay"; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1_pins>; + status = "okay"; +}; diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index 5c7f4bf..c80d858 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -144,8 +144,12 @@ config TARGET_TURRIS_OMNIA select ATSHA204A config TARGET_TURRIS_MOX - bool "Support Turris Mox" + bool "Support CZ.NIC's Turris Mox / RIPE Atlas Probe" select ARMADA_3700 + select BOARD_TYPES + select ENV_IS_IN_MMC + select ENV_IS_IN_SPI_FLASH + select MULTI_DTB_FIT config TARGET_MVEBU_ARMADA_8K bool "Support Armada 7k/8k platforms" diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index eaaa68a..79f8877 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -71,8 +71,9 @@ #error CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR must be set to 0 #endif #if !defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET) || \ - CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET != 0 -#error CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET must be set to 0 + (CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET != 0 && \ + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET != 4096) +#error CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET must be set to either 0 or 4096 #endif #endif diff --git a/board/CZ.NIC/turris_mox/mox_sp.c b/board/CZ.NIC/turris_mox/mox_sp.c index 87f6751..11d8756 100644 --- a/board/CZ.NIC/turris_mox/mox_sp.c +++ b/board/CZ.NIC/turris_mox/mox_sp.c @@ -10,6 +10,8 @@ #include <linux/delay.h> #include <mach/mbox.h> +#include "mox_sp.h" + const char *mox_sp_get_ecdsa_public_key(void) { static char public_key[135]; @@ -42,12 +44,13 @@ static inline void res_to_mac(u8 *mac, u32 t1, u32 t2) mac[5] = t2; } -int mbox_sp_get_board_info(u64 *sn, u8 *mac1, u8 *mac2, int *bv, int *ram) +int mbox_sp_get_board_info(u64 *sn, u8 *mac1, u8 *mac2, int *bv, int *ram, + enum cznic_a3720_board *board) { - u32 out[8]; + u32 out[9]; int res; - res = mbox_do_cmd(MBOX_CMD_BOARD_INFO, NULL, 0, out, 8); + res = mbox_do_cmd(MBOX_CMD_BOARD_INFO, NULL, 0, out, 9); if (res < 0) return res; @@ -69,5 +72,8 @@ int mbox_sp_get_board_info(u64 *sn, u8 *mac1, u8 *mac2, int *bv, int *ram) if (mac2) res_to_mac(mac2, out[6], out[7]); + if (board) + *board = out[8] + 1; + return 0; } diff --git a/board/CZ.NIC/turris_mox/mox_sp.h b/board/CZ.NIC/turris_mox/mox_sp.h index 83b6037..720880d 100644 --- a/board/CZ.NIC/turris_mox/mox_sp.h +++ b/board/CZ.NIC/turris_mox/mox_sp.h @@ -8,8 +8,14 @@ #include <common.h> +enum cznic_a3720_board { + BOARD_UNDEFINED = 0x0, + BOARD_TURRIS_MOX = 0x1, + BOARD_RIPE_ATLAS = 0x3, +}; + const char *mox_sp_get_ecdsa_public_key(void); int mbox_sp_get_board_info(u64 *sn, u8 *mac1, u8 *mac2, int *bv, - int *ram); + int *ram, enum cznic_a3720_board *board); #endif /* _BOARD_CZNIC_TURRIS_MOX_MOX_SP_H_ */ diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c index 370c266..63b8699 100644 --- a/board/CZ.NIC/turris_mox/turris_mox.c +++ b/board/CZ.NIC/turris_mox/turris_mox.c @@ -15,6 +15,7 @@ #include <dm.h> #include <dm/of_extra.h> #include <env.h> +#include <env_internal.h> #include <event.h> #include <fdt_support.h> #include <init.h> @@ -45,6 +46,26 @@ DECLARE_GLOBAL_DATA_PTR; +int board_fit_config_name_match(const char *name) +{ + if (!gd->board_type) { + enum cznic_a3720_board board; + + if (mbox_sp_get_board_info(NULL, NULL, NULL, NULL, NULL, + &board) < 0) { + printf("Cannot determine board, defaulting to Turris MOX!\n"); + board = BOARD_TURRIS_MOX; + } + + gd->board_type = board; + } + + return !((gd->board_type == BOARD_TURRIS_MOX && + !strcmp(name, "armada-3720-turris-mox")) || + (gd->board_type == BOARD_RIPE_ATLAS && + !strcmp(name, "armada-3720-ripe-atlas"))); +} + #if defined(CONFIG_OF_BOARD_FIXUP) int board_fix_fdt(void *blob) { @@ -53,6 +74,9 @@ int board_fix_fdt(void *blob) int i, size, ret; bool eth1_sgmii; + if (gd->board_type != BOARD_TURRIS_MOX) + return 0; + /* * SPI driver is not loaded in driver model yet, but we have to find out * if pcie should be enabled in U-Boot's device tree. Therefore we have @@ -388,16 +412,23 @@ static void load_spi_dtb(void) int misc_init_r(void) { + int i, ret, addrcnt; u8 mac[2][6]; - int i, ret; - ret = mbox_sp_get_board_info(NULL, mac[0], mac[1], NULL, NULL); + ret = mbox_sp_get_board_info(NULL, mac[0], mac[1], NULL, NULL, NULL); if (ret < 0) { printf("Cannot read data from OTP!\n"); return 0; } - for (i = 0; i < 2; ++i) { + if (gd->board_type == BOARD_TURRIS_MOX) + addrcnt = 2; + else if (gd->board_type == BOARD_RIPE_ATLAS) + addrcnt = 1; + else + addrcnt = 0; + + for (i = 0; i < addrcnt; ++i) { u8 oldmac[6]; if (is_valid_ethaddr(mac[i]) && @@ -405,7 +436,13 @@ int misc_init_r(void) eth_env_set_enetaddr_by_index("eth", i, mac[i]); } - load_spi_dtb(); + if (gd->board_type == BOARD_RIPE_ATLAS) { + env_set("board", "ripe_atlas"); + env_set("board_name", "ripe_atlas"); + env_set("fdtfile", "marvell/armada-3720-ripe-atlas.dtb"); + } else { + load_spi_dtb(); + } return 0; } @@ -528,14 +565,15 @@ static void handle_reset_button(void) int show_board_info(void) { int i, ret, board_version, ram_size, is_sd; - const char *pub_key; + const char *pub_key, *model; const u8 *topology; u64 serial_number; - printf("Model: CZ.NIC Turris Mox Board\n"); + model = fdt_getprop(gd->fdt_blob, 0, "model", NULL); + printf("Model: %s\n", model); ret = mbox_sp_get_board_info(&serial_number, NULL, NULL, &board_version, - &ram_size); + &ram_size, NULL); if (ret < 0) { printf(" Cannot read board info: %i\n", ret); } else { @@ -550,6 +588,9 @@ int show_board_info(void) else printf(" Cannot read ECDSA Public Key\n"); + if (gd->board_type != BOARD_TURRIS_MOX) + return 0; + ret = mox_get_topology(&topology, &module_count, &is_sd); if (ret) printf("Cannot read module topology!\n"); @@ -668,10 +709,24 @@ err: return NULL; } +enum env_location env_get_location(enum env_operation op, int prio) +{ + if (prio > 0) + return ENVL_UNKNOWN; + + if (gd->board_type == BOARD_RIPE_ATLAS) + return ENVL_MMC; + + return ENVL_SPI_FLASH; +} + static int last_stage_init(void) { struct gpio_desc reset_gpio = {}; + if (gd->board_type != BOARD_TURRIS_MOX) + return 0; + /* configure modules */ if (get_reset_gpio(&reset_gpio) < 0) goto handle_reset_btn; @@ -801,6 +856,9 @@ int ft_board_setup(void *blob, struct bd_info *bd) { int res; + if (gd->board_type != BOARD_TURRIS_MOX) + return 0; + /* * If MOX B (PCI), MOX F (USB) or MOX G (Passthrough PCI) modules are * connected, enable the PCIe node. diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index ca24a5c..744b1c2 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -240,9 +240,16 @@ static int mmc_burn_image(size_t image_size) #endif /* SD reserves LBA-0 for MBR and boots from LBA-1, - * MMC/eMMC boots from LBA-0 + * MMC/eMMC boots from LBA-0 and LBA-4096 */ - start_lba = IS_SD(mmc) ? 1 : 0; + if (IS_SD(mmc)) + start_lba = 1; +#ifdef CONFIG_SUPPORT_EMMC_BOOT + else if (part) + start_lba = 0; +#endif + else + start_lba = 4096; #ifdef CONFIG_BLK blk_count = image_size / mmc->write_bl_len; if (image_size % mmc->write_bl_len) diff --git a/configs/nsa310s_defconfig b/configs/nsa310s_defconfig index ff489562..038ef42 100644 --- a/configs/nsa310s_defconfig +++ b/configs/nsa310s_defconfig @@ -19,7 +19,8 @@ CONFIG_DEBUG_UART_CLOCK=166666667 CONFIG_IDENT_STRING="\nZyXEL NSA310S/320S 1/2-Bay Power Media Server" CONFIG_SYS_LOAD_ADDR=0x800000 CONFIG_DEBUG_UART=y -CONFIG_DISTRO_DEFAULTS=y +CONFIG_BOOTSTD_FULL=y +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_BOOTDELAY=3 CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_BOARDINFO is not set diff --git a/configs/pogo_v4_defconfig b/configs/pogo_v4_defconfig index 2747c3c..ff6411d 100644 --- a/configs/pogo_v4_defconfig +++ b/configs/pogo_v4_defconfig @@ -17,7 +17,8 @@ CONFIG_IDENT_STRING="\nPogoplug V4" CONFIG_SYS_LOAD_ADDR=0x800000 CONFIG_PCI=y CONFIG_LTO=y -CONFIG_DISTRO_DEFAULTS=y +CONFIG_BOOTSTD_FULL=y +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_BOOTSTAGE=y CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_BOOTDELAY=10 diff --git a/configs/turris_mox_defconfig b/configs/turris_mox_defconfig index e0ca633..c9815b6 100644 --- a/configs/turris_mox_defconfig +++ b/configs/turris_mox_defconfig @@ -52,9 +52,10 @@ CONFIG_CMD_HASH=y CONFIG_CMD_BTRFS=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y +CONFIG_OF_LIST="armada-3720-turris-mox armada-3720-ripe-atlas" CONFIG_ENV_OVERWRITE=y -CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_SYS_MMC_ENV_PART=2 CONFIG_ARP_TIMEOUT=200 CONFIG_NET_RETRY_COUNT=50 CONFIG_NETCONSOLE=y diff --git a/include/configs/nsa310s.h b/include/configs/nsa310s.h index fa029a1..8c4d035 100644 --- a/include/configs/nsa310s.h +++ b/include/configs/nsa310s.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /* - * Copyright (C) 2015, 2021-2022 Tony Dinh <mibodhi@gmail.com> + * Copyright (C) 2015, 2021-2023 Tony Dinh <mibodhi@gmail.com> * Copyright (C) 2015 * Gerald Kerma <dreagle@doukki.net> * Luka Perkov <luka.perkov@sartura.hr> @@ -15,14 +15,6 @@ */ #include "mv-common.h" -/* Include the common distro boot environment */ -#ifndef CONFIG_SPL_BUILD - -#define BOOT_TARGET_DEVICES(func) \ - func(USB, usb, 0) \ - func(SATA, sata, 0) \ - func(DHCP, dhcp, na) - #define KERNEL_ADDR_R __stringify(0x800000) #define FDT_ADDR_R __stringify(0x2c00000) #define RAMDISK_ADDR_R __stringify(0x01100000) @@ -34,16 +26,11 @@ "ramdisk_addr_r=" RAMDISK_ADDR_R "\0" \ "scriptaddr=" SCRIPT_ADDR_R "\0" -#include <config_distro_bootcmd.h> - #define CFG_EXTRA_ENV_SETTINGS \ "console=console=ttyS0,115200\0" \ "kernel=/boot/zImage\0" \ "fdt=/boot/nsa310s.dtb\0" \ "bootargs_root=ubi.mtd=3 root=ubi0:rootfs rootfstype=ubifs rw\0" \ - LOAD_ADDRESS_ENV_SETTINGS \ - BOOTENV - -#endif /* CONFIG_SPL_BUILD */ + LOAD_ADDRESS_ENV_SETTINGS #endif /* _CONFIG_NSA310S_H */ diff --git a/include/configs/pogo_v4.h b/include/configs/pogo_v4.h index 3371579..d500353 100644 --- a/include/configs/pogo_v4.h +++ b/include/configs/pogo_v4.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /* - * Copyright (C) 2014-2022 Tony Dinh <mibodhi@gmail.com> + * Copyright (C) 2014-2023 Tony Dinh <mibodhi@gmail.com> * * Based on * Copyright (C) 2012 @@ -21,33 +21,6 @@ */ #include "mv-common.h" -/* Include the common distro boot environment */ -#ifndef CONFIG_SPL_BUILD - -#ifdef CONFIG_MMC -#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) -#else -#define BOOT_TARGET_DEVICES_MMC(func) -#endif - -#ifdef CONFIG_SATA -#define BOOT_TARGET_DEVICES_SATA(func) func(SATA, sata, 0) -#else -#define BOOT_TARGET_DEVICES_SATA(func) -#endif - -#ifdef CONFIG_USB_STORAGE -#define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) -#else -#define BOOT_TARGET_DEVICES_USB(func) -#endif - -#define BOOT_TARGET_DEVICES(func) \ - BOOT_TARGET_DEVICES_MMC(func) \ - BOOT_TARGET_DEVICES_USB(func) \ - BOOT_TARGET_DEVICES_SATA(func) \ - func(DHCP, dhcp, na) - #define KERNEL_ADDR_R __stringify(0x800000) #define FDT_ADDR_R __stringify(0x2c00000) #define RAMDISK_ADDR_R __stringify(0x01100000) @@ -59,14 +32,10 @@ "ramdisk_addr_r=" RAMDISK_ADDR_R "\0" \ "scriptaddr=" SCRIPT_ADDR_R "\0" -#include <config_distro_bootcmd.h> - #define CFG_EXTRA_ENV_SETTINGS \ LOAD_ADDRESS_ENV_SETTINGS \ "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \ "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \ - "console=ttyS0,115200\0" \ - BOOTENV -#endif /* CONFIG_SPL_BUILD */ + "console=ttyS0,115200\0" #endif /* _CONFIG_POGO_V4_H */ |