diff options
Diffstat (limited to 'board')
49 files changed, 505 insertions, 179 deletions
diff --git a/board/armltd/integrator/integrator.c b/board/armltd/integrator/integrator.c index 19871bee14..21bea62e9b 100644 --- a/board/armltd/integrator/integrator.c +++ b/board/armltd/integrator/integrator.c @@ -32,7 +32,7 @@ DECLARE_GLOBAL_DATA_PTR; -static const struct pl01x_serial_platdata serial_platdata = { +static const struct pl01x_serial_plat serial_plat = { .base = 0x16000000, #ifdef CONFIG_ARCH_CINTEGRATOR .type = TYPE_PL011, @@ -45,7 +45,7 @@ static const struct pl01x_serial_platdata serial_platdata = { U_BOOT_DEVICE(integrator_serials) = { .name = "serial_pl01x", - .platdata = &serial_platdata, + .plat = &serial_plat, }; void peripheral_power_enable (void); diff --git a/board/armltd/total_compute/total_compute.c b/board/armltd/total_compute/total_compute.c index 0be6435fe3..6263d0c361 100644 --- a/board/armltd/total_compute/total_compute.c +++ b/board/armltd/total_compute/total_compute.c @@ -9,7 +9,7 @@ #include <dm/platform_data/serial_pl01x.h> #include <asm/armv8/mmu.h> -static const struct pl01x_serial_platdata serial_platdata = { +static const struct pl01x_serial_plat serial_plat = { .base = UART0_BASE, .type = TYPE_PL011, .clock = CONFIG_PL011_CLOCK, @@ -17,7 +17,7 @@ static const struct pl01x_serial_platdata serial_platdata = { U_BOOT_DEVICE(total_compute_serials) = { .name = "serial_pl01x", - .platdata = &serial_platdata, + .plat = &serial_plat, }; static struct mm_region total_compute_mem_map[] = { diff --git a/board/armltd/vexpress64/vexpress64.c b/board/armltd/vexpress64/vexpress64.c index 52ada0f6bc..6df6bcd3cf 100644 --- a/board/armltd/vexpress64/vexpress64.c +++ b/board/armltd/vexpress64/vexpress64.c @@ -20,7 +20,7 @@ DECLARE_GLOBAL_DATA_PTR; -static const struct pl01x_serial_platdata serial_platdata = { +static const struct pl01x_serial_plat serial_plat = { .base = V2M_UART0, .type = TYPE_PL011, .clock = CONFIG_PL011_CLOCK, @@ -28,7 +28,7 @@ static const struct pl01x_serial_platdata serial_platdata = { U_BOOT_DEVICE(vexpress_serials) = { .name = "serial_pl01x", - .platdata = &serial_platdata, + .plat = &serial_plat, }; static struct mm_region vexpress64_mem_map[] = { diff --git a/board/bluewater/gurnard/gurnard.c b/board/bluewater/gurnard/gurnard.c index dc9871d446..a71b4eb733 100644 --- a/board/bluewater/gurnard/gurnard.c +++ b/board/bluewater/gurnard/gurnard.c @@ -348,7 +348,7 @@ int board_init(void) uclass_find_first_device(UCLASS_VIDEO, &dev); if (dev) { - struct atmel_lcd_platdata *plat = dev_get_platdata(dev); + struct atmel_lcd_plat *plat = dev_get_plat(dev); plat->timing_index = 1; } @@ -416,11 +416,11 @@ void reset_phy(void) { } -static struct atmel_serial_platdata at91sam9260_serial_plat = { +static struct atmel_serial_plat at91sam9260_serial_plat = { .base_addr = ATMEL_BASE_DBGU, }; U_BOOT_DEVICE(at91sam9260_serial) = { .name = "serial_atmel", - .platdata = &at91sam9260_serial_plat, + .plat = &at91sam9260_serial_plat, }; diff --git a/board/bluewater/snapper9260/snapper9260.c b/board/bluewater/snapper9260/snapper9260.c index 9b0a75ac5d..9e41a42263 100644 --- a/board/bluewater/snapper9260/snapper9260.c +++ b/board/bluewater/snapper9260/snapper9260.c @@ -143,11 +143,11 @@ void reset_phy(void) { } -static struct atmel_serial_platdata at91sam9260_serial_plat = { +static struct atmel_serial_plat at91sam9260_serial_plat = { .base_addr = ATMEL_BASE_DBGU, }; U_BOOT_DEVICE(at91sam9260_serial) = { .name = "serial_atmel", - .platdata = &at91sam9260_serial_plat, + .plat = &at91sam9260_serial_plat, }; diff --git a/board/cadence/xtfpga/xtfpga.c b/board/cadence/xtfpga/xtfpga.c index 5811c43142..29db51b026 100644 --- a/board/cadence/xtfpga/xtfpga.c +++ b/board/cadence/xtfpga/xtfpga.c @@ -106,5 +106,5 @@ static struct ethoc_eth_pdata ethoc_pdata = { U_BOOT_DEVICE(ethoc) = { .name = "ethoc", - .platdata = ðoc_pdata, + .plat = ðoc_pdata, }; diff --git a/board/cavium/thunderx/thunderx.c b/board/cavium/thunderx/thunderx.c index f8c2913eac..22c4c72361 100644 --- a/board/cavium/thunderx/thunderx.c +++ b/board/cavium/thunderx/thunderx.c @@ -18,7 +18,7 @@ #if !CONFIG_IS_ENABLED(OF_CONTROL) #include <dm/platform_data/serial_pl01x.h> -static const struct pl01x_serial_platdata serial0 = { +static const struct pl01x_serial_plat serial0 = { .base = CONFIG_SYS_SERIAL0, .type = TYPE_PL011, .clock = 0, @@ -27,10 +27,10 @@ static const struct pl01x_serial_platdata serial0 = { U_BOOT_DEVICE(thunderx_serial0) = { .name = "serial_pl01x", - .platdata = &serial0, + .plat = &serial0, }; -static const struct pl01x_serial_platdata serial1 = { +static const struct pl01x_serial_plat serial1 = { .base = CONFIG_SYS_SERIAL1, .type = TYPE_PL011, .clock = 0, @@ -39,7 +39,7 @@ static const struct pl01x_serial_platdata serial1 = { U_BOOT_DEVICE(thunderx_serial1) = { .name = "serial_pl01x", - .platdata = &serial1, + .plat = &serial1, }; #endif diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c index e2712680f9..bc3ce4d16c 100644 --- a/board/compulab/cm_fx6/cm_fx6.c +++ b/board/compulab/cm_fx6/cm_fx6.c @@ -724,13 +724,13 @@ u32 get_board_rev(void) return cl_eeprom_get_board_rev(CONFIG_SYS_I2C_EEPROM_BUS); } -static struct mxc_serial_platdata cm_fx6_mxc_serial_plat = { +static struct mxc_serial_plat cm_fx6_mxc_serial_plat = { .reg = (struct mxc_uart *)UART4_BASE, }; U_BOOT_DEVICE(cm_fx6_serial) = { .name = "serial_mxc", - .platdata = &cm_fx6_mxc_serial_plat, + .plat = &cm_fx6_mxc_serial_plat, }; #if CONFIG_IS_ENABLED(AHCI) diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c b/board/davinci/da8xxevm/omapl138_lcdk.c index 6bab7b18d4..a8ece170ce 100644 --- a/board/davinci/da8xxevm/omapl138_lcdk.c +++ b/board/davinci/da8xxevm/omapl138_lcdk.c @@ -356,7 +356,7 @@ int board_mmc_init(struct bd_info *bis) #endif #ifdef CONFIG_SPL_BUILD -static const struct ns16550_platdata serial_pdata = { +static const struct ns16550_plat serial_pdata = { .base = DAVINCI_UART2_BASE, .reg_shift = 2, .clock = 228000000, @@ -365,10 +365,10 @@ static const struct ns16550_platdata serial_pdata = { U_BOOT_DEVICE(omapl138_uart) = { .name = "ns16550_serial", - .platdata = &serial_pdata, + .plat = &serial_pdata, }; -static const struct davinci_mmc_plat mmc_platdata = { +static const struct davinci_mmc_plat mmc_plat = { .reg_base = (struct davinci_mmc_regs *)DAVINCI_MMC_SD0_BASE, .cfg = { .f_min = 200000, @@ -381,7 +381,7 @@ static const struct davinci_mmc_plat mmc_platdata = { }; U_BOOT_DEVICE(omapl138_mmc) = { .name = "ti_da830_mmc", - .platdata = &mmc_platdata, + .plat = &mmc_plat, }; void spl_board_init(void) diff --git a/board/emulation/common/Kconfig b/board/emulation/common/Kconfig new file mode 100644 index 0000000000..4c15c8bcb8 --- /dev/null +++ b/board/emulation/common/Kconfig @@ -0,0 +1,15 @@ +config MTDPARTS_NOR0 + string "mtd boot partition for nor0" + default "64m(u-boot)" if TARGET_QEMU_ARM_64BIT && !TFABOOT + depends on SYS_MTDPARTS_RUNTIME + help + This define the partition of nor0 used to build mtparts dynamically + for boot from nor0. + +config MTDPARTS_NOR1 + string "mtd u-boot env partition for nor1" + default "64m(u-boot-env)" if TARGET_QEMU_ARM_64BIT && !TFABOOT + depends on SYS_MTDPARTS_RUNTIME + help + This define the partition of nor1 used to build mtparts dynamically + for the u-boot env stored on nor1. diff --git a/board/emulation/common/Makefile b/board/emulation/common/Makefile new file mode 100644 index 0000000000..7ed447a69d --- /dev/null +++ b/board/emulation/common/Makefile @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ + +obj-$(CONFIG_SYS_MTDPARTS_RUNTIME) += qemu_mtdparts.o +obj-$(CONFIG_SET_DFU_ALT_INFO) += qemu_dfu.o +obj-$(CONFIG_EFI_CAPSULE_FIRMWARE_MANAGEMENT) += qemu_capsule.o diff --git a/board/emulation/common/qemu_capsule.c b/board/emulation/common/qemu_capsule.c new file mode 100644 index 0000000000..f1d403501a --- /dev/null +++ b/board/emulation/common/qemu_capsule.c @@ -0,0 +1,48 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2020 Linaro Limited + */ + +#include <common.h> +#include <efi_api.h> +#include <efi_loader.h> +#include <env.h> +#include <fdtdec.h> + +DECLARE_GLOBAL_DATA_PTR; + +int efi_get_public_key_data(void **pkey, efi_uintn_t *pkey_len) +{ + const void *fdt_blob = gd->fdt_blob; + const void *blob; + const char *cnode_name = "capsule-key"; + const char *snode_name = "signature"; + int sig_node; + int len; + + sig_node = fdt_subnode_offset(fdt_blob, 0, snode_name); + if (sig_node < 0) { + EFI_PRINT("Unable to get signature node offset\n"); + return -FDT_ERR_NOTFOUND; + } + + blob = fdt_getprop(fdt_blob, sig_node, cnode_name, &len); + + if (!blob || len < 0) { + EFI_PRINT("Unable to get capsule-key value\n"); + *pkey = NULL; + *pkey_len = 0; + return -FDT_ERR_NOTFOUND; + } + + *pkey = (void *)blob; + *pkey_len = len; + + return 0; +} + +bool efi_capsule_auth_enabled(void) +{ + return env_get("capsule_authentication_enabled") != NULL ? + true : false; +} diff --git a/board/emulation/common/qemu_dfu.c b/board/emulation/common/qemu_dfu.c new file mode 100644 index 0000000000..62234a7647 --- /dev/null +++ b/board/emulation/common/qemu_dfu.c @@ -0,0 +1,68 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2020 Linaro Limited + */ + +#include <common.h> +#include <dfu.h> +#include <env.h> +#include <memalign.h> +#include <mtd.h> + +#define DFU_ALT_BUF_LEN SZ_1K + +static void board_get_alt_info(struct mtd_info *mtd, char *buf) +{ + struct mtd_info *part; + bool first = true; + const char *name; + int len, partnum = 0; + + name = mtd->name; + len = strlen(buf); + + if (buf[0] != '\0') + len += snprintf(buf + len, DFU_ALT_BUF_LEN - len, "&"); + len += snprintf(buf + len, DFU_ALT_BUF_LEN - len, + "mtd %s=", name); + + list_for_each_entry(part, &mtd->partitions, node) { + partnum++; + if (!first) + len += snprintf(buf + len, DFU_ALT_BUF_LEN - len, ";"); + first = false; + + len += snprintf(buf + len, DFU_ALT_BUF_LEN - len, + "%s part %d", + part->name, partnum); + } +} + +void set_dfu_alt_info(char *interface, char *devstr) +{ + struct mtd_info *mtd; + + ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN); + + if (env_get("dfu_alt_info")) + return; + + memset(buf, 0, sizeof(buf)); + + /* + * Currently dfu_alt_info is needed on Qemu ARM64 for + * capsule updates + */ + if (IS_ENABLED(CONFIG_EFI_CAPSULE_FIRMWARE_MANAGEMENT) && + IS_ENABLED(CONFIG_TARGET_QEMU_ARM_64BIT)) { + /* probe all MTD devices */ + mtd_probe_devices(); + + mtd = get_mtd_device_nm("nor0"); + if (!IS_ERR_OR_NULL(mtd)) + board_get_alt_info(mtd, buf); + } + + env_set("dfu_alt_info", buf); + printf("dfu_alt_info set\n"); +} diff --git a/board/emulation/common/qemu_mtdparts.c b/board/emulation/common/qemu_mtdparts.c new file mode 100644 index 0000000000..60212e97ac --- /dev/null +++ b/board/emulation/common/qemu_mtdparts.c @@ -0,0 +1,82 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2020 Linaro Limited + */ + +#include <common.h> +#include <dm.h> +#include <mtd.h> + +#include <linux/string.h> + +#define MTDPARTS_LEN 256 +#define MTDIDS_LEN 128 + +static void board_get_mtdparts(const char *dev, const char *partition, + char *mtdids, char *mtdparts) +{ + /* mtdids: "<dev>=<dev>, ...." */ + if (mtdids[0] != '\0') + strcat(mtdids, ","); + strcat(mtdids, dev); + strcat(mtdids, "="); + strcat(mtdids, dev); + + /* mtdparts: "mtdparts=<dev>:<mtdparts_<dev>>;..." */ + if (mtdparts[0] != '\0') + strncat(mtdparts, ";", MTDPARTS_LEN); + else + strcat(mtdparts, "mtdparts="); + + strncat(mtdparts, dev, MTDPARTS_LEN); + strncat(mtdparts, ":", MTDPARTS_LEN); + strncat(mtdparts, partition, MTDPARTS_LEN); +} + +void board_mtdparts_default(const char **mtdids, const char **mtdparts) +{ + struct mtd_info *mtd; + struct udevice *dev; + const char *mtd_partition; + static char parts[3 * MTDPARTS_LEN + 1]; + static char ids[MTDIDS_LEN + 1]; + static bool mtd_initialized; + + if (mtd_initialized) { + *mtdids = ids; + *mtdparts = parts; + return; + } + + memset(parts, 0, sizeof(parts)); + memset(ids, 0, sizeof(ids)); + + /* Currently mtdparts is needed on Qemu ARM64 for capsule updates */ + if (IS_ENABLED(CONFIG_EFI_CAPSULE_FIRMWARE_MANAGEMENT) && + IS_ENABLED(CONFIG_TARGET_QEMU_ARM_64BIT)) { + /* probe all MTD devices */ + for (uclass_first_device(UCLASS_MTD, &dev); dev; + uclass_next_device(&dev)) { + debug("mtd device = %s\n", dev->name); + } + + mtd = get_mtd_device_nm("nor0"); + if (!IS_ERR_OR_NULL(mtd)) { + mtd_partition = CONFIG_MTDPARTS_NOR0; + board_get_mtdparts("nor0", mtd_partition, ids, parts); + put_mtd_device(mtd); + } + + mtd = get_mtd_device_nm("nor1"); + if (!IS_ERR_OR_NULL(mtd)) { + mtd_partition = CONFIG_MTDPARTS_NOR1; + board_get_mtdparts("nor1", mtd_partition, ids, parts); + put_mtd_device(mtd); + } + } + + mtd_initialized = true; + *mtdids = ids; + *mtdparts = parts; + debug("%s:mtdids=%s & mtdparts=%s\n", __func__, ids, parts); +} diff --git a/board/emulation/qemu-arm/Kconfig b/board/emulation/qemu-arm/Kconfig index 02ae4d9884..fb8d38f5b8 100644 --- a/board/emulation/qemu-arm/Kconfig +++ b/board/emulation/qemu-arm/Kconfig @@ -11,3 +11,11 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply VIRTIO_BLK endif + +if TARGET_QEMU_ARM_64BIT && !TFABOOT +config BOARD_SPECIFIC_OPTIONS + imply SYS_MTDPARTS_RUNTIME + imply SET_DFU_ALT_INFO + +source "board/emulation/common/Kconfig" +endif diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c index f18f2ed7da..aa68bef469 100644 --- a/board/emulation/qemu-arm/qemu-arm.c +++ b/board/emulation/qemu-arm/qemu-arm.c @@ -65,6 +65,11 @@ struct mm_region *mem_map = qemu_arm64_mem_map; int board_init(void) { + return 0; +} + +int board_late_init(void) +{ /* * Make sure virtio bus is enumerated so that peripherals * on the virtio bus can be discovered by their drivers diff --git a/board/freescale/ls1012afrdm/eth.c b/board/freescale/ls1012afrdm/eth.c index eaea1c46e4..85104ab22c 100644 --- a/board/freescale/ls1012afrdm/eth.c +++ b/board/freescale/ls1012afrdm/eth.c @@ -116,10 +116,10 @@ static struct pfe_eth_pdata pfe_pdata1 = { U_BOOT_DEVICE(ls1012a_pfe0) = { .name = "pfe_eth", - .platdata = &pfe_pdata0, + .plat = &pfe_pdata0, }; U_BOOT_DEVICE(ls1012a_pfe1) = { .name = "pfe_eth", - .platdata = &pfe_pdata1, + .plat = &pfe_pdata1, }; diff --git a/board/freescale/ls1012aqds/eth.c b/board/freescale/ls1012aqds/eth.c index b4ef60738e..f6f43d2b13 100644 --- a/board/freescale/ls1012aqds/eth.c +++ b/board/freescale/ls1012aqds/eth.c @@ -300,10 +300,10 @@ static struct pfe_eth_pdata pfe_pdata1 = { U_BOOT_DEVICE(ls1012a_pfe0) = { .name = "pfe_eth", - .platdata = &pfe_pdata0, + .plat = &pfe_pdata0, }; U_BOOT_DEVICE(ls1012a_pfe1) = { .name = "pfe_eth", - .platdata = &pfe_pdata1, + .plat = &pfe_pdata1, }; diff --git a/board/freescale/ls1012ardb/eth.c b/board/freescale/ls1012ardb/eth.c index a65ff4dc9c..5e923e5252 100644 --- a/board/freescale/ls1012ardb/eth.c +++ b/board/freescale/ls1012ardb/eth.c @@ -162,10 +162,10 @@ static struct pfe_eth_pdata pfe_pdata1 = { U_BOOT_DEVICE(ls1012a_pfe0) = { .name = "pfe_eth", - .platdata = &pfe_pdata0, + .plat = &pfe_pdata0, }; U_BOOT_DEVICE(ls1012a_pfe1) = { .name = "pfe_eth", - .platdata = &pfe_pdata1, + .plat = &pfe_pdata1, }; diff --git a/board/freescale/lx2160a/lx2160a.c b/board/freescale/lx2160a/lx2160a.c index 222906fdff..99417aa40d 100644 --- a/board/freescale/lx2160a/lx2160a.c +++ b/board/freescale/lx2160a/lx2160a.c @@ -52,7 +52,7 @@ DECLARE_GLOBAL_DATA_PTR; -static struct pl01x_serial_platdata serial0 = { +static struct pl01x_serial_plat serial0 = { #if CONFIG_CONS_INDEX == 0 .base = CONFIG_SYS_SERIAL0, #elif CONFIG_CONS_INDEX == 1 @@ -65,17 +65,17 @@ static struct pl01x_serial_platdata serial0 = { U_BOOT_DEVICE(nxp_serial0) = { .name = "serial_pl01x", - .platdata = &serial0, + .plat = &serial0, }; -static struct pl01x_serial_platdata serial1 = { +static struct pl01x_serial_plat serial1 = { .base = CONFIG_SYS_SERIAL1, .type = TYPE_PL011, }; U_BOOT_DEVICE(nxp_serial1) = { .name = "serial_pl01x", - .platdata = &serial1, + .plat = &serial1, }; int select_i2c_ch_pca9547(u8 ch) diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c index 9f043d815a..c7224d1efe 100644 --- a/board/gateworks/gw_ventana/gw_ventana.c +++ b/board/gateworks/gw_ventana/gw_ventana.c @@ -1371,11 +1371,11 @@ int ft_board_setup(void *blob, struct bd_info *bd) } #endif /* CONFIG_OF_BOARD_SETUP */ -static struct mxc_serial_platdata ventana_mxc_serial_plat = { +static struct mxc_serial_plat ventana_mxc_serial_plat = { .reg = (struct mxc_uart *)UART2_BASE, }; U_BOOT_DEVICE(ventana_serial) = { .name = "serial_mxc", - .platdata = &ventana_mxc_serial_plat, + .plat = &ventana_mxc_serial_plat, }; diff --git a/board/hisilicon/hikey/hikey.c b/board/hisilicon/hikey/hikey.c index e89ff1a43d..0ac88306d0 100644 --- a/board/hisilicon/hikey/hikey.c +++ b/board/hisilicon/hikey/hikey.c @@ -26,7 +26,7 @@ #include <asm/armv8/mmu.h> /*TODO drop this table in favour of device tree */ -static const struct hikey_gpio_platdata hi6220_gpio[] = { +static const struct hikey_gpio_plat hi6220_gpio[] = { { 0, HI6220_GPIO_BASE(0)}, { 1, HI6220_GPIO_BASE(1)}, { 2, HI6220_GPIO_BASE(2)}, @@ -77,7 +77,7 @@ DECLARE_GLOBAL_DATA_PTR; #if !CONFIG_IS_ENABLED(OF_CONTROL) -static const struct pl01x_serial_platdata serial_platdata = { +static const struct pl01x_serial_plat serial_plat = { #if CONFIG_CONS_INDEX == 1 .base = HI6220_UART0_BASE, #elif CONFIG_CONS_INDEX == 4 @@ -91,7 +91,7 @@ static const struct pl01x_serial_platdata serial_platdata = { U_BOOT_DEVICE(hikey_seriala) = { .name = "serial_pl01x", - .platdata = &serial_platdata, + .plat = &serial_plat, }; #endif diff --git a/board/hisilicon/hikey960/hikey960.c b/board/hisilicon/hikey960/hikey960.c index db485db10a..04b8cde136 100644 --- a/board/hisilicon/hikey960/hikey960.c +++ b/board/hisilicon/hikey960/hikey960.c @@ -26,7 +26,7 @@ DECLARE_GLOBAL_DATA_PTR; #if !CONFIG_IS_ENABLED(OF_CONTROL) #include <dm/platform_data/serial_pl01x.h> -static const struct pl01x_serial_platdata serial_platdata = { +static const struct pl01x_serial_plat serial_plat = { .base = HI3660_UART6_BASE, .type = TYPE_PL011, .clock = 19200000 @@ -34,7 +34,7 @@ static const struct pl01x_serial_platdata serial_platdata = { U_BOOT_DEVICE(hikey960_serial0) = { .name = "serial_pl01x", - .platdata = &serial_platdata, + .plat = &serial_plat, }; #endif diff --git a/board/hisilicon/poplar/poplar.c b/board/hisilicon/poplar/poplar.c index 371c3c33fc..b8be4ce45a 100644 --- a/board/hisilicon/poplar/poplar.c +++ b/board/hisilicon/poplar/poplar.c @@ -40,7 +40,7 @@ static struct mm_region poplar_mem_map[] = { struct mm_region *mem_map = poplar_mem_map; #if !CONFIG_IS_ENABLED(OF_CONTROL) -static const struct pl01x_serial_platdata serial_platdata = { +static const struct pl01x_serial_plat serial_plat = { .base = REG_BASE_UART0, .type = TYPE_PL010, .clock = 75000000, @@ -48,7 +48,7 @@ static const struct pl01x_serial_platdata serial_platdata = { U_BOOT_DEVICE(poplar_serial) = { .name = "serial_pl01x", - .platdata = &serial_platdata, + .plat = &serial_plat, }; #endif diff --git a/board/intel/galileo/galileo.c b/board/intel/galileo/galileo.c index 720350d0f7..341b627a65 100644 --- a/board/intel/galileo/galileo.c +++ b/board/intel/galileo/galileo.c @@ -12,7 +12,7 @@ * Intel Galileo gen2 board uses GPIO Resume Well bank pin0 as the PERST# pin. * * We cannot use any public GPIO APIs in <asm-generic/gpio.h> to control this - * pin, as these APIs will eventually call into gpio_ich6_ofdata_to_platdata() + * pin, as these APIs will eventually call into gpio_ich6_of_to_plat() * in the Intel ICH6 GPIO driver where it calls PCI configuration space access * APIs which will trigger PCI enumeration process. * diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c index e0ca3c2588..6a7da502dd 100644 --- a/board/isee/igep00x0/igep00x0.c +++ b/board/isee/igep00x0/igep00x0.c @@ -29,7 +29,7 @@ #include <fdt_support.h> #include "igep00x0.h" -static const struct ns16550_platdata igep_serial = { +static const struct ns16550_plat igep_serial = { .base = OMAP34XX_UART3, .reg_shift = 2, .clock = V_NS16550_CLK, diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index 03c7ce9da7..df507e2790 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -56,7 +56,7 @@ int set_km_env(void) /* try to read rootfssize (ram image) from environment */ p = env_get("rootfssize"); - if (p != NULL) + if (p) strict_strtoul(p, 16, &rootfssize); pram = (rootfssize + CONFIG_KM_RESERVED_PRAM + CONFIG_KM_PHRAM + CONFIG_KM_PNVRAM) / 0x400; @@ -165,7 +165,7 @@ static int do_setboardid(struct cmd_tbl *cmdtp, int flag, int argc, char *p; p = get_local_var("IVM_BoardId"); - if (p == NULL) { + if (!p) { printf("can't get the IVM_Boardid\n"); return 1; } @@ -174,7 +174,7 @@ static int do_setboardid(struct cmd_tbl *cmdtp, int flag, int argc, printf("set boardid=%s\n", buf); p = get_local_var("IVM_HWKey"); - if (p == NULL) { + if (!p) { printf("can't get the IVM_HWKey\n"); return 1; } @@ -186,8 +186,8 @@ static int do_setboardid(struct cmd_tbl *cmdtp, int flag, int argc, return 0; } -U_BOOT_CMD(km_setboardid, 1, 0, do_setboardid, "setboardid", "read out bid and " - "hwkey from IVM and set in environment"); +U_BOOT_CMD(km_setboardid, 1, 0, do_setboardid, "setboardid", + "read out bid and hwkey from IVM and set in environment"); /* * command km_checkbidhwk @@ -218,14 +218,14 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int flag, int argc, * already stored in the local hush variables */ p = get_local_var("IVM_BoardId"); - if (p == NULL) { + if (!p) { printf("can't get the IVM_Boardid\n"); return 1; } rc = strict_strtoul(p, 16, &ivmbid); p = get_local_var("IVM_HWKey"); - if (p == NULL) { + if (!p) { printf("can't get the IVM_HWKey\n"); return 1; } @@ -238,10 +238,10 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int flag, int argc, /* now try to read values from environment if available */ p = env_get("boardid"); - if (p != NULL) + if (p) rc = strict_strtoul(p, 16, &envbid); p = env_get("hwkey"); - if (p != NULL) + if (p) rc = strict_strtoul(p, 16, &envhwkey); if (rc != 0) { @@ -263,9 +263,8 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int flag, int argc, if (verbose) { printf("IVM_BoardId: %ld, IVM_HWKey=%ld\n", - ivmbid, ivmhwkey); - printf("boardIdHwKeyList: %s\n", - bidhwklist); + ivmbid, ivmhwkey); + printf("boardIdHwKeyList: %s\n", bidhwklist); } while (!found) { /* loop over each bid/hwkey pair in the list */ @@ -291,13 +290,13 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int flag, int argc, while (*rest && !isxdigit(*rest)) rest++; } - if ((!bid) || (!hwkey)) { + if (!bid || !hwkey) { /* end of list */ break; } if (verbose) { printf("trying bid=0x%lX, hwkey=%ld\n", - bid, hwkey); + bid, hwkey); } /* * Compare the values of the found entry in the @@ -305,7 +304,7 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int flag, int argc, * in the inventory eeprom. If they are equal * set the values in environment variables. */ - if ((bid == ivmbid) && (hwkey == ivmhwkey)) { + if (bid == ivmbid && hwkey == ivmhwkey) { char buf[10]; found = 1; @@ -321,12 +320,12 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int flag, int argc, } /* compare now the values */ - if ((ivmbid == envbid) && (ivmhwkey == envhwkey)) { + if (ivmbid == envbid && ivmhwkey == envhwkey) { printf("boardid=0x%3lX, hwkey=%ld\n", envbid, envhwkey); rc = 0; /* match */ } else { printf("Error: env boardid=0x%3lX, hwkey=%ld\n", envbid, - envhwkey); + envhwkey); printf(" IVM bId=0x%3lX, hwKey=%ld\n", ivmbid, ivmhwkey); rc = 1; /* don't match */ } @@ -334,10 +333,8 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int flag, int argc, } U_BOOT_CMD(km_checkbidhwk, 2, 0, do_checkboardidhwk, - "check boardid and hwkey", - "[v]\n - check environment parameter "\ - "\"boardIdListHex\" against stored boardid and hwkey "\ - "from the IVM\n v: verbose output" + "check boardid and hwkey", + "[v]\n - check environment parameter \"boardIdListHex\" against stored boardid and hwkey from the IVM\n v: verbose output" ); /* @@ -356,6 +353,7 @@ static int do_checktestboot(struct cmd_tbl *cmdtp, int flag, int argc, #if defined(CONFIG_POST) testpin = post_hotkeys_pressed(); #endif + s = env_get("test_bank"); /* when test_bank is not set, act as if testpin is not asserted */ testboot = (testpin != 0) && (s); @@ -370,6 +368,6 @@ static int do_checktestboot(struct cmd_tbl *cmdtp, int flag, int argc, } U_BOOT_CMD(km_checktestboot, 2, 0, do_checktestboot, - "check if testpin is asserted", - "[v]\n v - verbose output" + "check if testpin is asserted", + "[v]\n v - verbose output" ); diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c index 60b89fe348..e989bf609f 100644 --- a/board/keymile/common/ivm.c +++ b/board/keymile/common/ivm.c @@ -46,28 +46,27 @@ static int ivm_set_value(char *name, char *value) { char tempbuf[256]; - if (value != NULL) { + if (value) { sprintf(tempbuf, "%s=%s", name, value); return set_local_var(tempbuf, 0); - } else { - unset_local_var(name); } + unset_local_var(name); return 0; } static int ivm_get_value(unsigned char *buf, int len, char *name, int off, - int check) + int check) { unsigned short val; unsigned char valbuf[30]; - if ((buf[off + 0] != buf[off + 2]) && - (buf[off + 2] != buf[off + 4])) { + if (buf[off + 0] != buf[off + 2] && + buf[off + 2] != buf[off + 4]) { printf("%s Error corrupted %s\n", __func__, name); val = -1; } else { val = buf[off + 0] + (buf[off + 1] << 8); - if ((val == 0) && (check == 1)) + if (val == 0 && check == 1) val = -1; } sprintf((char *)valbuf, "%x", val); @@ -98,9 +97,9 @@ static char convert_char(char c) } static int ivm_findinventorystring(int type, - unsigned char *const string, - unsigned long maxlen, - unsigned char *buf) + unsigned char *const string, + unsigned long maxlen, + unsigned char *buf) { int xcode = 0; unsigned long cr = 0; @@ -133,12 +132,12 @@ static int ivm_findinventorystring(int type, */ if (addr < INVENTORYDATASIZE) { /* Copy the IVM string in the corresponding string */ - for (; (buf[addr] != '\r') && - ((buf[addr] != ';') || (!stop)) && - (size < (maxlen - 1) && - (addr < INVENTORYDATASIZE)); addr++) { + for (; (buf[addr] != '\r') && + ((buf[addr] != ';') || (!stop)) && + (size < (maxlen - 1) && + (addr < INVENTORYDATASIZE)); addr++) { size += sprintf((char *)string + size, "%c", - convert_char (buf[addr])); + convert_char (buf[addr])); } /* @@ -176,12 +175,12 @@ static int ivm_check_crc(unsigned char *buf, int block) unsigned long crceeprom; crc = ivm_calc_crc(buf, CONFIG_SYS_IVM_EEPROM_PAGE_LEN - 2); - crceeprom = (buf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN - 1] + \ + crceeprom = (buf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN - 1] + buf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN - 2] * 256); if (crc != crceeprom) { if (block == 0) - printf("Error CRC Block: %d EEprom: calculated: \ - %lx EEprom: %lx\n", block, crc, crceeprom); + printf("Error CRC Block: %d EEprom: calculated: %lx EEprom: %lx\n", + block, crc, crceeprom); return -1; } return 0; @@ -189,7 +188,7 @@ static int ivm_check_crc(unsigned char *buf, int block) /* take care of the possible MAC address offset and the IVM content offset */ static int process_mac(unsigned char *valbuf, unsigned char *buf, - int offset, bool unique) + int offset, bool unique) { unsigned char mac[6]; unsigned long val = (buf[4] << 16) + (buf[5] << 8) + buf[6]; @@ -197,9 +196,9 @@ static int process_mac(unsigned char *valbuf, unsigned char *buf, /* use an intermediate buffer, to not change IVM content * MAC address is at offset 1 */ - memcpy(mac, buf+1, 6); + memcpy(mac, buf + 1, 6); - /* MAC adress can be set to locally administred, this is only allowed + /* MAC address can be set to locally administred, this is only allowed * for interfaces which have now connection to the outside. For these * addresses we need to set the second bit in the first byte. */ @@ -222,7 +221,7 @@ static int ivm_analyze_block2(unsigned char *buf, int len) unsigned char valbuf[MAC_STR_SZ]; unsigned long count; - /* IVM_MAC Adress begins at offset 1 */ + /* IVM_MAC Address begins at offset 1 */ sprintf((char *)valbuf, "%pM", buf + 1); ivm_set_value("IVM_MacAddress", (char *)valbuf); /* IVM_MacCount */ @@ -247,9 +246,9 @@ int ivm_analyze_eeprom(unsigned char *buf, int len) return -1; ivm_get_value(buf, CONFIG_SYS_IVM_EEPROM_PAGE_LEN, - "IVM_BoardId", 0, 1); + "IVM_BoardId", 0, 1); val = ivm_get_value(buf, CONFIG_SYS_IVM_EEPROM_PAGE_LEN, - "IVM_HWKey", 6, 1); + "IVM_HWKey", 6, 1); if (val != 0xffff) { sprintf((char *)valbuf, "%x", ((val / 100) % 10)); ivm_set_value("IVM_HWVariant", (char *)valbuf); @@ -257,7 +256,7 @@ int ivm_analyze_eeprom(unsigned char *buf, int len) ivm_set_value("IVM_HWVersion", (char *)valbuf); } ivm_get_value(buf, CONFIG_SYS_IVM_EEPROM_PAGE_LEN, - "IVM_Functions", 12, 0); + "IVM_Functions", 12, 0); GET_STRING("IVM_Symbol", IVM_POS_SYMBOL_ONLY, 8) GET_STRING("IVM_DeviceName", IVM_POS_SHORT_TEXT, 64) @@ -269,7 +268,7 @@ int ivm_analyze_eeprom(unsigned char *buf, int len) while (i < len) { if (tmp[i] == ';') { ivm_set_value("IVM_ShortText", - (char *)&tmp[i + 1]); + (char *)&tmp[i + 1]); break; } i++; @@ -292,7 +291,7 @@ int ivm_analyze_eeprom(unsigned char *buf, int len) if (ivm_check_crc(&buf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN * 2], 2) != 0) return 0; ivm_analyze_block2(&buf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN * 2], - CONFIG_SYS_IVM_EEPROM_PAGE_LEN); + CONFIG_SYS_IVM_EEPROM_PAGE_LEN); return 0; } @@ -305,22 +304,23 @@ static int ivm_populate_env(unsigned char *buf, int len, int mac_address_offset) /* do we have the page 2 filled ? if not return */ if (ivm_check_crc(buf, 2)) return 0; - page2 = &buf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN*2]; + page2 = &buf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN * 2]; -#ifndef CONFIG_KMTEGR1 - /* if an offset is defined, add it */ - process_mac(valbuf, page2, mac_address_offset, true); - env_set((char *)"ethaddr", (char *)valbuf); -#else -/* KMTEGR1 has a special setup. eth0 has no connection to the outside and - * gets an locally administred MAC address, eth1 is the debug interface and - * gets the official MAC address from the IVM - */ - process_mac(valbuf, page2, mac_address_offset, false); - env_set((char *)"ethaddr", (char *)valbuf); - process_mac(valbuf, page2, mac_address_offset, true); - env_set((char *)"eth1addr", (char *)valbuf); -#endif + if (!IS_ENABLED(CONFIG_KMTEGR1)) { + /* if an offset is defined, add it */ + process_mac(valbuf, page2, mac_address_offset, true); + env_set((char *)"ethaddr", (char *)valbuf); + } else { + /* KMTEGR1 has a special setup. eth0 has no connection to the + * outside and gets an locally administred MAC address, eth1 is + * the debug interface and gets the official MAC address from + * the IVM + */ + process_mac(valbuf, page2, mac_address_offset, false); + env_set((char *)"ethaddr", (char *)valbuf); + process_mac(valbuf, page2, mac_address_offset, true); + env_set((char *)"eth1addr", (char *)valbuf); + } return 0; } diff --git a/board/keymile/km_arm/fpga_config.c b/board/keymile/km_arm/fpga_config.c index abb5b7d60d..839b162eea 100644 --- a/board/keymile/km_arm/fpga_config.c +++ b/board/keymile/km_arm/fpga_config.c @@ -40,14 +40,14 @@ static int boco_clear_bits(u8 reg, u8 flags) ret = i2c_read(BOCO_ADDR, reg, 1, ®val, 1); if (ret) { printf("%s: error reading the BOCO @%#x !!\n", - __func__, reg); + __func__, reg); return ret; } regval &= ~flags; ret = i2c_write(BOCO_ADDR, reg, 1, ®val, 1); if (ret) { printf("%s: error writing the BOCO @%#x !!\n", - __func__, reg); + __func__, reg); return ret; } @@ -63,14 +63,14 @@ static int boco_set_bits(u8 reg, u8 flags) ret = i2c_read(BOCO_ADDR, reg, 1, ®val, 1); if (ret) { printf("%s: error reading the BOCO @%#x !!\n", - __func__, reg); + __func__, reg); return ret; } regval |= flags; ret = i2c_write(BOCO_ADDR, reg, 1, ®val, 1); if (ret) { printf("%s: error writing the BOCO @%#x !!\n", - __func__, reg); + __func__, reg); return ret; } @@ -113,7 +113,8 @@ int trigger_fpga_config(void) skip = 0; #ifndef CONFIG_KM_FPGA_FORCE_CONFIG /* if the FPGA is already configured, we do not want to - * reconfigure it */ + * reconfigure it + */ skip = 0; if (fpga_done()) { printf("PCIe FPGA config: skipped\n"); @@ -179,7 +180,7 @@ int wait_for_fpga_config(void) ret = i2c_read(BOCO_ADDR, SPI_REG, 1, &spictrl, 1); if (ret) { printf("%s: error reading the BOCO spictrl !!\n", - __func__); + __func__); return ret; } if (timeout-- == 0) { @@ -235,7 +236,8 @@ int fpga_reset(void) #endif /* the FPGA was configured, we configure the BOCO2 so that the EEPROM - * is available from the Bobcat SPI bus */ + * is available from the Bobcat SPI bus + */ int toggle_eeprom_spi_bus(void) { int ret = 0; diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c index 7d191ab860..60187bd8d2 100644 --- a/board/keymile/km_arm/km_arm.c +++ b/board/keymile/km_arm/km_arm.c @@ -53,9 +53,9 @@ DECLARE_GLOBAL_DATA_PTR; #define PHY_MARVELL_88E1118R_LED_CTRL_REG 0x0010 #define PHY_MARVELL_88E1118R_LED_CTRL_RESERVED 0x1000 -#define PHY_MARVELL_88E1118R_LED_CTRL_LED0_1000MB (0x7<<0) -#define PHY_MARVELL_88E1118R_LED_CTRL_LED1_ACT (0x3<<4) -#define PHY_MARVELL_88E1118R_LED_CTRL_LED2_LINK (0x0<<8) +#define PHY_MARVELL_88E1118R_LED_CTRL_LED0_1000MB (0x7 << 0) +#define PHY_MARVELL_88E1118R_LED_CTRL_LED1_ACT (0x3 << 4) +#define PHY_MARVELL_88E1118R_LED_CTRL_LED2_LINK (0x0 << 8) /* I/O pin to erase flash RGPP09 = MPP43 */ #define KM_FLASH_ERASE_ENABLE 43 @@ -169,6 +169,7 @@ static void set_bootcount_addr(void) { uchar buf[32]; unsigned int bootcountaddr; + bootcountaddr = gd->ram_size - BOOTCOUNT_ADDR; sprintf((char *)buf, "0x%x", bootcountaddr); env_set("bootcountaddr", (char *)buf); @@ -192,7 +193,7 @@ int board_early_init_f(void) /* set the 2 bitbang i2c pins as output gpios */ tmp = readl(MVEBU_GPIO0_BASE + 4); - writel(tmp & (~KM_KIRKWOOD_SOFT_I2C_GPIOS) , MVEBU_GPIO0_BASE + 4); + writel(tmp & (~KM_KIRKWOOD_SOFT_I2C_GPIOS), MVEBU_GPIO0_BASE + 4); #endif /* adjust SDRAM size for bank 0 */ mvebu_sdram_size_adjust(0); @@ -292,11 +293,11 @@ int mvebu_board_spi_release_bus(struct udevice *dev) #define PHY_LED_SEL_REG 0x18 #define PHY_LED0_LINK (0x5) -#define PHY_LED1_ACT (0x8<<4) -#define PHY_LED2_INT (0xe<<8) +#define PHY_LED1_ACT (0x8 << 4) +#define PHY_LED2_INT (0xe << 8) #define PHY_SPEC_CTRL_REG 0x1c -#define PHY_RGMII_CLK_STABLE (0x1<<10) -#define PHY_CLSA (0x1<<1) +#define PHY_RGMII_CLK_STABLE (0x1 << 10) +#define PHY_CLSA (0x1 << 1) /* Configure and enable MV88E3018 PHY */ void reset_phy(void) @@ -407,8 +408,8 @@ void reset_phy(void) return; /* check for Marvell 88E1118R Gigabit PHY (PIGGY3) */ - if ((oui == PHY_MARVELL_OUI) && - (model == PHY_MARVELL_88E1118R_MODEL)) { + if (oui == PHY_MARVELL_OUI && + model == PHY_MARVELL_88E1118R_MODEL) { /* set page register to 3 */ if (miiphy_write(name, CONFIG_PHY_BASE_ADR, PHY_MARVELL_PAGE_REG, @@ -438,7 +439,6 @@ void reset_phy(void) } #endif - #if defined(CONFIG_HUSH_INIT_VAR) int hush_init_var(void) { @@ -478,22 +478,23 @@ int get_scl(void) int post_hotkeys_pressed(void) { -#if defined(CONFIG_KM_COGE5UN) - return kw_gpio_get_value(KM_POST_EN_L); -#else - return !kw_gpio_get_value(KM_POST_EN_L); -#endif + if (IS_ENABLED(CONFIG_KM_COGE5UN)) + return kw_gpio_get_value(KM_POST_EN_L); + else + return !kw_gpio_get_value(KM_POST_EN_L); } ulong post_word_load(void) { - void* addr = (void *) (gd->ram_size - BOOTCOUNT_ADDR + POST_WORD_OFF); + void *addr = (void *)(gd->ram_size - BOOTCOUNT_ADDR + POST_WORD_OFF); + return in_le32(addr); } void post_word_store(ulong value) { - void* addr = (void *) (gd->ram_size - BOOTCOUNT_ADDR + POST_WORD_OFF); + void *addr = (void *)(gd->ram_size - BOOTCOUNT_ADDR + POST_WORD_OFF); + out_le32(addr, value); } @@ -502,14 +503,14 @@ int arch_memory_test_prepare(u32 *vstart, u32 *size, phys_addr_t *phys_offset) *vstart = CONFIG_SYS_SDRAM_BASE; /* we go up to relocation plus a 1 MB margin */ - *size = CONFIG_SYS_TEXT_BASE - (1<<20); + *size = CONFIG_SYS_TEXT_BASE - (1 << 20); return 0; } #endif #if defined(CONFIG_SYS_EEPROM_WREN) -int eeprom_write_enable(unsigned dev_addr, int state) +int eeprom_write_enable(unsigned int dev_addr, int state) { kw_gpio_set_value(KM_KIRKWOOD_ENV_WP, !state); diff --git a/board/kontron/sl28/Kconfig b/board/kontron/sl28/Kconfig index cdec39be01..4078ef186b 100644 --- a/board/kontron/sl28/Kconfig +++ b/board/kontron/sl28/Kconfig @@ -15,4 +15,37 @@ config SYS_CONFIG_NAME config SYS_TEXT_BASE default 0x96000000 +config SL28_SPL_LOADS_ATF_BL31 + bool "SPL loads BL31 of the ARM Trusted Firmware" + select SPL_ATF + select SPL_ATF_LOAD_IMAGE_V2 + select ARMV8_SEC_FIRMWARE_SUPPORT + select SEC_FIRMWARE_ARMV8_PSCI + help + Enable this to load a BL31 image by the SPL. You have to + provde a bl31.bin in u-boot's root directory. + +if SL28_SPL_LOADS_ATF_BL31 + +config SL28_BL31_ENTRY_ADDR + hex "Entry point of the BL31 image" + default 0xfbe00000 + +endif + +config SL28_SPL_LOADS_OPTEE_BL32 + bool "SPL loads OP-TEE Trusted OS as BL32" + depends on SL28_SPL_LOADS_ATF_BL31 + help + Enable this to load a BL32 image by the SPL. You have to + provde a tee.bin in u-boot's root directory. + +if SL28_SPL_LOADS_OPTEE_BL32 + +config SL28_BL32_ENTRY_ADDR + hex "Entry point of the BL32 image" + default 0xfc000000 + +endif + endif diff --git a/board/kontron/sl28/Makefile b/board/kontron/sl28/Makefile index 74d8012f0f..5d220f0744 100644 --- a/board/kontron/sl28/Makefile +++ b/board/kontron/sl28/Makefile @@ -5,4 +5,8 @@ obj-y += sl28.o cmds.o endif obj-y += common.o ddr.o -obj-$(CONFIG_SPL_BUILD) += spl.o + +ifdef CONFIG_SPL_BUILD +obj-y += spl.o +obj-$(CONFIG_SPL_ATF) += spl_atf.o +endif diff --git a/board/kontron/sl28/sl28.c b/board/kontron/sl28/sl28.c index b18127c4d1..34f17b486b 100644 --- a/board/kontron/sl28/sl28.c +++ b/board/kontron/sl28/sl28.c @@ -50,6 +50,7 @@ int ft_board_setup(void *blob, struct bd_info *bd) u64 base[CONFIG_NR_DRAM_BANKS]; u64 size[CONFIG_NR_DRAM_BANKS]; int nbanks = CONFIG_NR_DRAM_BANKS; + int node; int i; ft_cpu_setup(blob, bd); @@ -64,5 +65,11 @@ int ft_board_setup(void *blob, struct bd_info *bd) fdt_fixup_icid(blob); + if (CONFIG_IS_ENABLED(SL28_SPL_LOADS_OPTEE_BL32)) { + node = fdt_node_offset_by_compatible(blob, -1, "linaro,optee-tz"); + if (node) + fdt_set_node_status(blob, node, FDT_STATUS_OKAY, 0); + } + return 0; } diff --git a/board/kontron/sl28/spl_atf.c b/board/kontron/sl28/spl_atf.c new file mode 100644 index 0000000000..5438b5239c --- /dev/null +++ b/board/kontron/sl28/spl_atf.c @@ -0,0 +1,54 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * LS1028A TF-A calling support + * + * Copyright (c) 2020 Michael Walle <michael@walle.cc> + */ + +#include <common.h> +#include <asm/io.h> +#include <atf_common.h> +#include <spl.h> + +DECLARE_GLOBAL_DATA_PTR; + +struct region_info { + u64 addr; + u64 size; +}; + +struct dram_regions_info { + u64 num_dram_regions; + u64 total_dram_size; + struct region_info region[CONFIG_NR_DRAM_BANKS]; +}; + +struct bl_params *bl2_plat_get_bl31_params_v2(uintptr_t bl32_entry, + uintptr_t bl33_entry, + uintptr_t fdt_addr) +{ + static struct dram_regions_info dram_regions_info = { 0 }; + struct bl_params *bl_params; + struct bl_params_node *node; + void *dcfg_ccsr = (void *)DCFG_BASE; + int i; + + dram_regions_info.num_dram_regions = CONFIG_NR_DRAM_BANKS; + for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { + dram_regions_info.region[i].addr = gd->bd->bi_dram[i].start; + dram_regions_info.region[i].size = gd->bd->bi_dram[i].size; + dram_regions_info.total_dram_size += gd->bd->bi_dram[i].size; + } + + bl_params = bl2_plat_get_bl31_params_v2_default(bl32_entry, bl33_entry, + fdt_addr); + + for_each_bl_params_node(bl_params, node) { + if (node->image_id == ATF_BL31_IMAGE_ID) { + node->ep_info->args.arg3 = (uintptr_t)&dram_regions_info; + node->ep_info->args.arg4 = in_le32(dcfg_ccsr + DCFG_PORSR1); + } + } + + return bl_params; +} diff --git a/board/lg/sniper/sniper.c b/board/lg/sniper/sniper.c index dff159025b..d11630b954 100644 --- a/board/lg/sniper/sniper.c +++ b/board/lg/sniper/sniper.c @@ -30,7 +30,7 @@ const omap3_sysinfo sysinfo = { .nand_string = "MMC" }; -static const struct ns16550_platdata serial_omap_platdata = { +static const struct ns16550_plat serial_omap_plat = { .base = OMAP34XX_UART3, .reg_shift = 2, .clock = V_NS16550_CLK, @@ -39,7 +39,7 @@ static const struct ns16550_platdata serial_omap_platdata = { U_BOOT_DEVICE(sniper_serial) = { .name = "ns16550_serial", - .platdata = &serial_omap_platdata + .plat = &serial_omap_plat }; static struct musb_hdrc_config musb_config = { diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c index 3d62b5d9ad..bafb6205bd 100644 --- a/board/nokia/rx51/rx51.c +++ b/board/nokia/rx51/rx51.c @@ -703,7 +703,7 @@ void board_mmc_power_init(void) twl4030_power_mmc_init(1); } -static const struct omap_i2c_platdata rx51_i2c[] = { +static const struct omap_i2c_plat rx51_i2c[] = { { I2C_BASE1, 2200000, OMAP_I2C_REV_V1 }, { I2C_BASE2, 100000, OMAP_I2C_REV_V1 }, { I2C_BASE3, 400000, OMAP_I2C_REV_V1 }, diff --git a/board/renesas/ulcb/cpld.c b/board/renesas/ulcb/cpld.c index a20a34a92a..e3fa3526b7 100644 --- a/board/renesas/ulcb/cpld.c +++ b/board/renesas/ulcb/cpld.c @@ -188,5 +188,5 @@ U_BOOT_DRIVER(sysreset_renesas_ulcb) = { .ops = &renesas_ulcb_sysreset, .probe = renesas_ulcb_sysreset_probe, .of_match = renesas_ulcb_sysreset_ids, - .priv_auto_alloc_size = sizeof(struct renesas_ulcb_sysreset_priv), + .priv_auto = sizeof(struct renesas_ulcb_sysreset_priv), }; diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c index 18a605de02..3235541a7d 100644 --- a/board/sandbox/sandbox.c +++ b/board/sandbox/sandbox.c @@ -28,10 +28,6 @@ U_BOOT_DEVICE(gpio_sandbox) = { }; #endif -void flush_cache(unsigned long start, unsigned long size) -{ -} - #ifndef CONFIG_TIMER /* system timer offset in ms */ static unsigned long sandbox_timer_offset; diff --git a/board/siemens/corvus/board.c b/board/siemens/corvus/board.c index eed055aedb..1613c44929 100644 --- a/board/siemens/corvus/board.c +++ b/board/siemens/corvus/board.c @@ -314,11 +314,11 @@ void spi_cs_deactivate(struct spi_slave *slave) } } -static struct atmel_serial_platdata at91sam9260_serial_plat = { +static struct atmel_serial_plat at91sam9260_serial_plat = { .base_addr = ATMEL_BASE_DBGU, }; U_BOOT_DEVICE(at91sam9260_serial) = { .name = "serial_atmel", - .platdata = &at91sam9260_serial_plat, + .plat = &at91sam9260_serial_plat, }; diff --git a/board/st/stv0991/stv0991.c b/board/st/stv0991/stv0991.c index 8c827adc2e..3371973600 100644 --- a/board/st/stv0991/stv0991.c +++ b/board/st/stv0991/stv0991.c @@ -24,7 +24,7 @@ struct gpio_regs *const gpioa_regs = (struct gpio_regs *) GPIOA_BASE_ADDR; #ifndef CONFIG_OF_CONTROL -static const struct pl01x_serial_platdata serial_platdata = { +static const struct pl01x_serial_plat serial_plat = { .base = 0x80406000, .type = TYPE_PL011, .clock = 2700 * 1000, @@ -32,7 +32,7 @@ static const struct pl01x_serial_platdata serial_platdata = { U_BOOT_DEVICE(stv09911_serials) = { .name = "serial_pl01x", - .platdata = &serial_platdata, + .plat = &serial_plat, }; #endif diff --git a/board/sysam/amcore/amcore.c b/board/sysam/amcore/amcore.c index 4502005941..42e1a80ec5 100644 --- a/board/sysam/amcore/amcore.c +++ b/board/sysam/amcore/amcore.c @@ -107,7 +107,7 @@ int dram_init(void) return 0; } -static struct coldfire_serial_platdata mcf5307_serial_plat = { +static struct coldfire_serial_plat mcf5307_serial_plat = { .base = CONFIG_SYS_UART_BASE, .port = 0, .baudrate = CONFIG_BAUDRATE, @@ -115,5 +115,5 @@ static struct coldfire_serial_platdata mcf5307_serial_plat = { U_BOOT_DEVICE(coldfire_serial) = { .name = "serial_coldfire", - .platdata = &mcf5307_serial_plat, + .plat = &mcf5307_serial_plat, }; diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index 984cc5e3ba..2aa385a937 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -885,7 +885,7 @@ int board_late_init(void) } #endif -/* CPSW platdata */ +/* CPSW plat */ #if !CONFIG_IS_ENABLED(OF_CONTROL) struct cpsw_slave_data slave_data[] = { { @@ -929,7 +929,7 @@ struct eth_pdata cpsw_pdata = { U_BOOT_DEVICE(am335x_eth) = { .name = "eth_cpsw", - .platdata = &cpsw_pdata, + .plat = &cpsw_pdata, }; #endif @@ -963,7 +963,7 @@ void board_fit_image_post_process(void **p_image, size_t *p_size) #endif #if !CONFIG_IS_ENABLED(OF_CONTROL) -static const struct omap_hsmmc_plat am335x_mmc0_platdata = { +static const struct omap_hsmmc_plat am335x_mmc0_plat = { .base_addr = (struct hsmmc *)OMAP_HSMMC1_BASE, .cfg.host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS | MMC_MODE_4BIT, .cfg.f_min = 400000, @@ -974,10 +974,10 @@ static const struct omap_hsmmc_plat am335x_mmc0_platdata = { U_BOOT_DEVICE(am335x_mmc0) = { .name = "omap_hsmmc", - .platdata = &am335x_mmc0_platdata, + .plat = &am335x_mmc0_plat, }; -static const struct omap_hsmmc_plat am335x_mmc1_platdata = { +static const struct omap_hsmmc_plat am335x_mmc1_plat = { .base_addr = (struct hsmmc *)OMAP_HSMMC2_BASE, .cfg.host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS | MMC_MODE_8BIT, .cfg.f_min = 400000, @@ -988,6 +988,6 @@ static const struct omap_hsmmc_plat am335x_mmc1_platdata = { U_BOOT_DEVICE(am335x_mmc1) = { .name = "omap_hsmmc", - .platdata = &am335x_mmc1_platdata, + .plat = &am335x_mmc1_plat, }; #endif diff --git a/board/timll/devkit8000/devkit8000.c b/board/timll/devkit8000/devkit8000.c index 2420c28974..875383625d 100644 --- a/board/timll/devkit8000/devkit8000.c +++ b/board/timll/devkit8000/devkit8000.c @@ -47,7 +47,7 @@ static u32 gpmc_net_config[GPMC_MAX_REG] = { 0 }; -static const struct ns16550_platdata devkit8000_serial = { +static const struct ns16550_plat devkit8000_serial = { .base = OMAP34XX_UART3, .reg_shift = 2, .clock = V_NS16550_CLK, diff --git a/board/toradex/apalis_imx6/apalis_imx6.c b/board/toradex/apalis_imx6/apalis_imx6.c index 3961c4df9e..362a750b19 100644 --- a/board/toradex/apalis_imx6/apalis_imx6.c +++ b/board/toradex/apalis_imx6/apalis_imx6.c @@ -1144,12 +1144,12 @@ void reset_cpu(ulong addr) #endif /* CONFIG_SPL_BUILD */ -static struct mxc_serial_platdata mxc_serial_plat = { +static struct mxc_serial_plat mxc_serial_plat = { .reg = (struct mxc_uart *)UART1_BASE, .use_dte = true, }; U_BOOT_DEVICE(mxc_serial) = { .name = "serial_mxc", - .platdata = &mxc_serial_plat, + .plat = &mxc_serial_plat, }; diff --git a/board/toradex/colibri-imx6ull/colibri-imx6ull.c b/board/toradex/colibri-imx6ull/colibri-imx6ull.c index 45f8da3c42..056064f6b9 100644 --- a/board/toradex/colibri-imx6ull/colibri-imx6ull.c +++ b/board/toradex/colibri-imx6ull/colibri-imx6ull.c @@ -203,12 +203,12 @@ int ft_board_setup(void *blob, struct bd_info *bd) } #endif -static struct mxc_serial_platdata mxc_serial_plat = { +static struct mxc_serial_plat mxc_serial_plat = { .reg = (struct mxc_uart *)UART1_BASE, .use_dte = 1, }; U_BOOT_DEVICE(mxc_serial) = { .name = "serial_mxc", - .platdata = &mxc_serial_plat, + .plat = &mxc_serial_plat, }; diff --git a/board/toradex/colibri_imx6/colibri_imx6.c b/board/toradex/colibri_imx6/colibri_imx6.c index a416b5e54b..a82daad739 100644 --- a/board/toradex/colibri_imx6/colibri_imx6.c +++ b/board/toradex/colibri_imx6/colibri_imx6.c @@ -1086,12 +1086,12 @@ void reset_cpu(ulong addr) #endif /* CONFIG_SPL_BUILD */ -static struct mxc_serial_platdata mxc_serial_plat = { +static struct mxc_serial_plat mxc_serial_plat = { .reg = (struct mxc_uart *)UART1_BASE, .use_dte = true, }; U_BOOT_DEVICE(mxc_serial) = { .name = "serial_mxc", - .platdata = &mxc_serial_plat, + .plat = &mxc_serial_plat, }; diff --git a/board/toradex/colibri_pxa270/colibri_pxa270.c b/board/toradex/colibri_pxa270/colibri_pxa270.c index 273a17f608..b9d0fb98af 100644 --- a/board/toradex/colibri_pxa270/colibri_pxa270.c +++ b/board/toradex/colibri_pxa270/colibri_pxa270.c @@ -129,18 +129,18 @@ int board_mmc_init(struct bd_info *bis) return 0; } #else /* !CONFIG_IS_ENABLED(DM_MMC) */ -static const struct pxa_mmc_plat mmc_platdata = { +static const struct pxa_mmc_plat mmc_plat = { .base = (struct pxa_mmc_regs *)MMC0_BASE, }; U_BOOT_DEVICE(pxa_mmcs) = { .name = "pxa_mmc", - .platdata = &mmc_platdata, + .plat = &mmc_plat, }; #endif /* !CONFIG_IS_ENABLED(DM_MMC) */ #endif -static const struct pxa_serial_platdata serial_platdata = { +static const struct pxa_serial_plat serial_plat = { .base = (struct pxa_uart_regs *)FFUART_BASE, .port = FFUART_INDEX, .baudrate = CONFIG_BAUDRATE, @@ -148,5 +148,5 @@ static const struct pxa_serial_platdata serial_platdata = { U_BOOT_DEVICE(pxa_serials) = { .name = "serial_pxa", - .platdata = &serial_platdata, + .plat = &serial_plat, }; diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c index 912c1143a8..2782a346f0 100644 --- a/board/xilinx/versal/board.c +++ b/board/xilinx/versal/board.c @@ -153,9 +153,9 @@ int board_late_init(void) puts("Boot from EMMC but without SD1 enabled!\n"); return -1; } - debug("mmc1 device found at %p, seq %d\n", dev, dev->seq); + debug("mmc1 device found at %p, seq %d\n", dev, dev_seq(dev)); mode = "mmc"; - bootseq = dev->seq; + bootseq = dev_seq(dev); break; case SD_MODE: puts("SD_MODE\n"); @@ -164,10 +164,10 @@ int board_late_init(void) puts("Boot from SD0 but without SD0 enabled!\n"); return -1; } - debug("mmc0 device found at %p, seq %d\n", dev, dev->seq); + debug("mmc0 device found at %p, seq %d\n", dev, dev_seq(dev)); mode = "mmc"; - bootseq = dev->seq; + bootseq = dev_seq(dev); break; case SD1_LSHFT_MODE: puts("LVL_SHFT_"); @@ -179,10 +179,10 @@ int board_late_init(void) puts("Boot from SD1 but without SD1 enabled!\n"); return -1; } - debug("mmc1 device found at %p, seq %d\n", dev, dev->seq); + debug("mmc1 device found at %p, seq %d\n", dev, dev_seq(dev)); mode = "mmc"; - bootseq = dev->seq; + bootseq = dev_seq(dev); break; default: mode = ""; diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 731285a736..047b070485 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -596,10 +596,10 @@ int board_late_init(void) puts("Boot from EMMC but without SD0 enabled!\n"); return -1; } - debug("mmc0 device found at %p, seq %d\n", dev, dev->seq); + debug("mmc0 device found at %p, seq %d\n", dev, dev_seq(dev)); mode = "mmc"; - bootseq = dev->seq; + bootseq = dev_seq(dev); break; case SD_MODE: puts("SD_MODE\n"); @@ -610,10 +610,10 @@ int board_late_init(void) puts("Boot from SD0 but without SD0 enabled!\n"); return -1; } - debug("mmc0 device found at %p, seq %d\n", dev, dev->seq); + debug("mmc0 device found at %p, seq %d\n", dev, dev_seq(dev)); mode = "mmc"; - bootseq = dev->seq; + bootseq = dev_seq(dev); env_set("modeboot", "sdboot"); break; case SD1_LSHFT_MODE: @@ -628,10 +628,10 @@ int board_late_init(void) puts("Boot from SD1 but without SD1 enabled!\n"); return -1; } - debug("mmc1 device found at %p, seq %d\n", dev, dev->seq); + debug("mmc1 device found at %p, seq %d\n", dev, dev_seq(dev)); mode = "mmc"; - bootseq = dev->seq; + bootseq = dev_seq(dev); env_set("modeboot", "sdboot"); break; case NAND_MODE: |