config TARGET_AXS103
bool "Support Synopsys Designware SDP board AXS103"
-config TARGET_EMDK
- bool "Synopsys EM Development kit"
+config TARGET_EMSDP
+ bool "Synopsys EM Software Development Platform"
select CPU_ARCEM6
config TARGET_HSDK
source "board/abilis/tb100/Kconfig"
source "board/synopsys/Kconfig"
source "board/synopsys/axs10x/Kconfig"
-source "board/synopsys/emdk/Kconfig"
+source "board/synopsys/emsdp/Kconfig"
source "board/synopsys/hsdk/Kconfig"
source "board/synopsys/iot_devkit/Kconfig"
dtb-$(CONFIG_TARGET_AXS103) += axs103.dtb
dtb-$(CONFIG_TARGET_NSIM) += nsim.dtb
dtb-$(CONFIG_TARGET_TB100) += abilis_tb100.dtb
-dtb-$(CONFIG_TARGET_EMDK) += emdk.dtb
+dtb-$(CONFIG_TARGET_EMSDP) += emsdp.dtb
dtb-$(CONFIG_TARGET_HSDK) += hsdk.dtb
dtb-$(CONFIG_TARGET_IOT_DEVKIT) += iot_devkit.dtb
#include "skeleton.dtsi"
/ {
- model = "snps,emdk";
+ model = "snps,emsdp";
#address-cells = <1>;
#size-cells = <1>;
Normally this is CKSEG0. If the MIPS system needs to move this block
to some SRAM or ScratchPad RAM, adapt this option accordingly.
+config MIPS_RELOCATION_TABLE_SIZE
+ hex "Relocation table size"
+ range 0x100 0x10000
+ default "0x8000"
+ ---help---
+ A table of relocation data will be appended to the U-Boot binary
+ and parsed in relocate_code() to fix up all offsets in the relocated
+ U-Boot.
+
+ This option allows the amount of space reserved for the table to be
+ adjusted in a range from 256 up to 64k. The default is 32k and should
+ be ok in most cases. Reduce this value to shrink the size of U-Boot
+ binary.
+
+ The build will fail and a valid size suggested if this is too small.
+
+ If unsure, leave at the default value.
+
endmenu
menu "OS boot interface"
# MODFLAGS += -mlong-calls
#
ifndef CONFIG_SPL_BUILD
-OBJCOPYFLAGS += -j .got -j .rel -j .padding -j .dtb.init.rodata
+OBJCOPYFLAGS += -j .data.reloc -j .dtb.init.rodata
LDFLAGS_FINAL += --emit-relocs
endif
__image_copy_end = .;
__init_end = .;
- /*
- * .rel must come last so that the mips-relocs tool can shrink
- * the section size & the PT_LOAD program header filesz.
- */
- .rel : {
+ .data.reloc : {
__rel_start = .;
- BYTE(0x0)
- . += (32 * 1024) - 1;
+ /*
+ * Space for relocation table
+ * This needs to be filled so that the
+ * mips-reloc tool can overwrite the content.
+ * An invalid value is left at the start of the
+ * section to abort relocation if the table
+ * has not been filled in.
+ */
+ LONG(0xFFFFFFFF);
+ FILL(0);
+ . += CONFIG_MIPS_RELOCATION_TABLE_SIZE - 4;
}
+ . = ALIGN(4);
_end = .;
.bss __rel_start (OVERLAY) : {
-if TARGET_EMDK
+if TARGET_EMSDP
config SYS_BOARD
- default "emdk"
+ default "emsdp"
config SYS_VENDOR
default "synopsys"
config SYS_CONFIG_NAME
- default "emdk"
+ default "emsdp"
endif
EM DEVELOPMENT KIT BOARD
M: Alexey Brodkin <abrodkin@synopsys.com>
S: Maintained
-F: board/synopsys/emdk/
-F: configs/emdk_defconfig
+F: arch/arc/dts/emsdp.dts
+F: board/synopsys/emsdp/
+F: configs/emsdp_defconfig
# SPDX-License-Identifier: GPL-2.0+
#
-obj-y += emdk.o
+obj-y += emsdp.o
================================================================================
-Useful notes on bulding and using of U-Boot on ARC EM Development Kit (AKA EMDK)
+Useful notes on bulding and using of U-Boot on
+ARC EM Software Development Platform (AKA EMSDP)
================================================================================
BOARD OVERVIEW
- The DesignWare ARC EM Development Kit is FPGA-bases platform for rapid
- software development on the ARC EM family of processors.
+ The DesignWare ARC EM Software Development Platform is FPGA-bases platform
+ for rapid software development on the ARC EM family of processors.
Since this board is based on FPGA it's possible to load and use different
versions of ARC EM CPUs. U-Boot is built to be run on the simplest
1. Configure U-Boot:
------------------------->8----------------------
- make emdk_defconfig
+ make emsdp_defconfig
------------------------->8----------------------
2. To build Elf file (for example to be used with host debugger via JTAG
EXECUTING U-BOOT
- 1. The EMDK board is supposed to auto-start U-Boot image stored in ROM on
+ 1. The EMSDP board is supposed to auto-start U-Boot image stored in ROM on
power-on. For that make sure VCCIO DIP-switches are all in "off" state.
2. Though it is possible to load U-Boot as a simple Elf file via JTAG right
; /* loop forever till reset */
}
-static int do_emdk_rom(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_emsdp_rom(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
{
u32 creg_boot = readl((u32 *)(CREG_BASE + CREG_BOOT_OFFSET));
return CMD_RET_SUCCESS;
}
-cmd_tbl_t cmd_emdk[] = {
- U_BOOT_CMD_MKENT(rom, 2, 0, do_emdk_rom, "", ""),
+cmd_tbl_t cmd_emsdp[] = {
+ U_BOOT_CMD_MKENT(rom, 2, 0, do_emsdp_rom, "", ""),
};
-static int do_emdk(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_emsdp(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
{
cmd_tbl_t *c;
- c = find_cmd_tbl(argv[1], cmd_emdk, ARRAY_SIZE(cmd_emdk));
+ c = find_cmd_tbl(argv[1], cmd_emsdp, ARRAY_SIZE(cmd_emsdp));
- /* Strip off leading 'emdk' command */
+ /* Strip off leading 'emsdp' command */
argc--;
argv++;
}
U_BOOT_CMD(
- emdk, CONFIG_SYS_MAXARGS, 0, do_emdk,
- "Synopsys EMDK specific commands",
+ emsdp, CONFIG_SYS_MAXARGS, 0, do_emsdp,
+ "Synopsys EMSDP specific commands",
"rom unlock - Unlock non-volatile memory for writing\n"
- "emdk rom lock - Lock non-volatile memory to prevent writing\n"
+ "emsdp rom lock - Lock non-volatile memory to prevent writing\n"
);
--- /dev/null
+================================================================================
+Useful notes on bulding and using of U-Boot on
+ARC IoT Development Kit (AKA IoTDK)
+================================================================================
+
+ BOARD OVERVIEW
+
+ The DesignWare ARC IoT Development Kit is a versatile platform that includes
+ the necessary hardware and software to accelerate software development and
+ debugging of sensor fusion, voice recognition and face detection designs.
+
+ The ARC IoT Development Kit includes a silicon implementation of the
+ ARC Data Fusion IP Subsystem running at 144 MHz on SMIC's
+ 55-nm ultra-low power process, and a rich set of peripherals commonly used
+ in IoT designs such as USB, UART, SPI, I2C, PWM, SDIO and ADCs.
+
+ The board is shipped with pre-installed U-Boot in non-volatile memory
+ (eFlash) so on power-on user sees U-Boot start header and command line
+ prompt which might be used for U-Boot environment fine-tuning, manual
+ loading and execution of user application binaries etc.
+
+ The board has the following features useful for U-Boot:
+ * On-board 2-channel FTDI TTL-to-USB converter
+ - The first channel is used for serial debug port (which makes it possible
+ to use a serial connection on pretty much any host machine be it
+ Windows, Linux or Mac).
+ On Linux machine typucally FTDI serial port would be /dev/ttyUSB0.
+ There's no HW flow-control and baud-rate is 115200.
+
+ - The second channel is used for built-in Digilent USB JTAG probe.
+ That means no extra hardware is required to access ARC core from a
+ debugger on development host. Both proprietary MetaWare debugger and
+ open source OpenOCD + GDB client are supported.
+
+ - Also with help of this FTDI chip it is possible to reset entire
+ board with help of a special `rff-ftdi-reset` utility, see:
+ https://github.com/foss-for-synopsys-dwc-arc-processors/rff-ftdi-reset
+
+ * Micro SD-card slot
+ - U-Boot expects to see the very first partition on the card formatted as
+ FAT file-system and uses it for keeping its environment in `uboot.env`
+ file. Note uboot.env is not just a text file but it is auto-generated
+ file created by U-Boot on invocation of `saveenv` command.
+ It contains a checksum which makes this saved environment invalid in
+ case of maual modification.
+
+ - There might be more useful files on that first FAT partition like
+ user applications, data files etc.
+
+ * USB OTG connector
+ - U-Boot may access USB mass-storage devices attached to this connector.
+ Note only FAT file-system is supported. It might be used for storing
+ user application binaries as well as micro SD-card mentioned above.
+
+ * The following memories are avaialble on the board:
+ - eFlash: 256 KiB @ 0x0000_0000
+ A non-volatile memory from which ARC core may execute code directly.
+ Still is is not direcly writable, thus this is not an ordinary RAM.
+
+ - ICCM: 256 KiB @ 0x2000_0000
+ Instruction Closely Coupled Memory - fast on-chip memory primary used
+ for code being executed, still data could be placed in this memory too.
+ In that sense it's just a general purpose RAM.
+
+ - SRAM: 128 KiB @ 0x3000_0000
+ On-chip SRAM. From user perspective is the same as ICCM above.
+
+ - DCCM: 128 KiB @ 0x8000_0000
+ Data Closely Coupled Memory is similar to ICCM with a major difference -
+ ARC core cannot execute code from DCCM. So this is very special RAM
+ only suitable for data.
+
+ BUILDING U-BOOT
+
+ 1. Configure U-Boot:
+ ------------------------->8----------------------
+ make iot_devkit_defconfig
+ ------------------------->8----------------------
+
+ 2. To build Elf file (for example to be used with host debugger via JTAG
+ connection to the target board):
+ ------------------------->8----------------------
+ make mdbtrick
+ ------------------------->8----------------------
+
+ This will produce `u-boot` Elf file.
+
+ 3. To build binary image to be put in "ROM":
+ ------------------------->8----------------------
+ make u-boot.bin
+ ------------------------->8----------------------
+
+
+ EXECUTING U-BOOT
+
+ 1. The IoTDK board is supposed to auto-start U-Boot image stored in eFlash on
+ power-on. Note it's possible to update that image - follow instructions in
+ user's manual.
+
+ 2. Though it is possible to load and start U-Boot as a simple Elf file
+ via JTAG right in ICCM. For that it's required to re-configure U-Boot
+ so it gets linked to ICCM address 0x2000_0000 (remember eFlash is not
+ direcly writable).
+ Run U-Boot's configuration utility with "make menuconfig", go to
+ "Boot images" and change "Text Base" from default 0x00000000 to
+ 0x20000000. Exit & save new configuration. Now run "make mdbtrick" to
+ build new Elf.
+
+ 2.1. In case of proprietary MetaWare debugger run:
+ ------------------------->8----------------------
+ mdb -digilent u-boot
+ ------------------------->8----------------------
+
+ USING U-BOOT
+
+ Note due to limited memory size it's supposed that user will run binary
+ images of their applications instead of loading Elf files.
+
+ 1. To load and start application binary from micro SD-card execute
+ the following commands in U-Boot's shell:
+ ------------------------->8----------------------
+ fatload mmc 0 0x20000000 yourapp.bin
+ go 0x20000000
+ ------------------------->8----------------------
+
+ 2. To load and start application binary from USB mass-storage device execute
+ the following commands in U-Boot's shell:
+ ------------------------->8----------------------
+ usb start
+ fatload usb 0x20000000 yourapp.bin
+ go 0x20000000
+ ------------------------->8----------------------
+
+ 3. To have a sequence of commands executed on U-Boot start put those
+ commands in "bootcmd" with semicolon between them.
+ For example to get (1) done automatically:
+ ------------------------->8----------------------
+ setenv bootcmd fatload mmc 0 0x20000000 yourapp.bin\; go 0x20000000
+ saveenv
+ ------------------------->8----------------------
+
+ 4. To reboot the board just run:
+ ------------------------->8----------------------
+ reset
+ ------------------------->8----------------------
obj-$(CONFIG_CMD_ADC) += adc.o
obj-$(CONFIG_CMD_ARMFLASH) += armflash.o
obj-y += blk_common.o
-obj-$(CONFIG_SOURCE) += source.o
obj-$(CONFIG_CMD_SOURCE) += source.o
obj-$(CONFIG_CMD_BDI) += bdinfo.o
obj-$(CONFIG_CMD_BEDBUG) += bedbug.o
if (argc != 4)
return CMD_RET_USAGE;
- id = (int)simple_strtoul(argv[1], NULL, 3);
+ id = (int)simple_strtoul(argv[1], NULL, 10);
addr = simple_strtoul(argv[2], NULL, 16);
size = simple_strtoul(argv[3], NULL, 16);
if (argc != 2)
return CMD_RET_USAGE;
- id = (int)simple_strtoul(argv[1], NULL, 3);
+ id = (int)simple_strtoul(argv[1], NULL, 10);
if (!rproc_is_initialized()) {
printf("\tRemote Processors are not initialized\n");
CONFIG_ARC=y
CONFIG_ISA_ARCV2=y
CONFIG_CPU_ARCEM6=y
-CONFIG_TARGET_EMDK=y
+CONFIG_TARGET_EMSDP=y
CONFIG_SYS_TEXT_BASE=0x00000000
CONFIG_SYS_CLK_FREQ=40000000
# CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
CONFIG_VERSION_VARIABLE=y
CONFIG_HUSH_PARSER=y
-CONFIG_SYS_PROMPT="emdk# "
+CONFIG_SYS_PROMPT="emsdp# "
# CONFIG_CMD_BOOTD is not set
# CONFIG_CMD_XIMG is not set
CONFIG_CMD_MMC=y
CONFIG_CMD_FAT=y
CONFIG_OF_CONTROL=y
CONFIG_OF_EMBED=y
-CONFIG_DEFAULT_DEVICE_TREE="emdk"
+CONFIG_DEFAULT_DEVICE_TREE="emsdp"
CONFIG_ENV_IS_IN_FAT=y
CONFIG_ENV_FAT_INTERFACE="mmc"
CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
CONFIG_CMD_FAT=y
CONFIG_OF_CONTROL=y
CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d2_ptc_ek"
-CONFIG_ENV_IS_IN_MMC=y
+CONFIG_ENV_IS_IN_FAT=y
CONFIG_DM=y
CONFIG_SPL_DM_SEQ_ALIAS=y
CONFIG_CLK=y
config DM_REGULATOR_GPIO
bool "Enable Driver Model for GPIO REGULATOR"
- depends on DM_REGULATOR
+ depends on DM_REGULATOR && DM_GPIO
---help---
This config enables implementation of driver-model regulator uclass
features for gpio regulators. The driver implements get/set for
voltage value.
+config SPL_DM_REGULATOR_GPIO
+ bool "Enable Driver Model for GPIO REGULATOR in SPL"
+ depends on DM_REGULATOR_GPIO && SPL_GPIO_SUPPORT
+ ---help---
+ This config enables implementation of driver-model regulator uclass
+ features for gpio regulators in SPL.
+
config REGULATOR_RK8XX
bool "Enable driver for RK8XX regulators"
depends on DM_REGULATOR && PMIC_RK8XX
{
struct w1_device *w1;
- w1 = dev_get_platdata(dev);
+ w1 = dev_get_parent_platdata(dev);
w1->id = 0;
return 0;
}
struct udevice *dev;
for (ret = uclass_first_device(UCLASS_W1, &dev);
- !ret;
- uclass_next_device(&dev), i++) {
- if (ret) {
- debug("Cannot find w1 bus %d\n", busnum);
- return ret;
- }
+ dev && !ret;
+ ret = uclass_next_device(&dev), i++) {
if (i == busnum) {
*busp = dev;
return 0;
}
}
+
+ if (!ret) {
+ debug("Cannot find w1 bus %d\n", busnum);
+ ret = -ENODEV;
+ }
+
return ret;
}
#define CONFIG_ENV_OFFSET_REDUND 0x100000
#define CONFIG_ENV_SIZE 0x20000 /* 1 sector = 128 kB */
#define CONFIG_BOOTCOMMAND "nand read " \
- "0x22000000 0x200000 0x300000; " \
- "bootm 0x22000000"
+ "0x22000000 0x200000 0x600000; " \
+ "nand read 0x21000000 0x180000 0x20000; " \
+ "bootz 0x22000000 - 0x21000000"
#elif defined(CONFIG_SPI_BOOT)
/* bootstrap + u-boot + env + linux in spi flash */
#define CONFIG_ENV_OFFSET 0x5000
* Copyright (C) 2018 Synopsys, Inc. All rights reserved.
*/
-#ifndef _CONFIG_EMDK_H_
-#define _CONFIG_EMDK_H_
+#ifndef _CONFIG_EMSDP_H_
+#define _CONFIG_EMSDP_H_
#include <linux/sizes.h>
#define CONFIG_EXTRA_ENV_SETTINGS \
"upgrade_image=u-boot.bin\0" \
- "upgrade=emdk rom unlock && " \
+ "upgrade=emsdp rom unlock && " \
"fatload mmc 0 ${loadaddr} ${upgrade_image} && " \
"cp.b ${loadaddr} 0 ${filesize} && " \
"dcache flush && " \
- "emdk rom lock\0"
+ "emsdp rom lock\0"
-#endif /* _CONFIG_EMDK_H_ */
+#endif /* _CONFIG_EMSDP_H_ */
AVB_VERIFY_CHECK \
"part start mmc ${mmcdev} boot boot_start; " \
"part size mmc ${mmcdev} boot boot_size; " \
- "mmc read ${fdtaddr} ${fdt_start} ${fdt_size}; " \
"mmc read ${loadaddr} ${boot_start} ${boot_size}; " \
"bootm ${loadaddr}#${fdtfile};\0 "
return vers->gen_caps & TEE_GEN_CAP_GP;
}
-static int dm_test_tee(struct unit_test_state *uts)
+struct test_tee_vars {
+ struct tee_shm *reg_shm;
+ struct tee_shm *alloc_shm;
+};
+
+static int test_tee(struct unit_test_state *uts, struct test_tee_vars *vars)
{
struct tee_version_data vers;
struct udevice *dev;
u32 session = 0;
int rc;
u8 data[128];
- struct tee_shm *reg_shm;
- struct tee_shm *alloc_shm;
dev = tee_find_device(NULL, match, NULL, &vers);
ut_assert(dev);
ut_assert(!state->session);
ut_assert(!state->num_shms);
- rc = tee_shm_register(dev, data, sizeof(data), 0, ®_shm);
+ rc = tee_shm_register(dev, data, sizeof(data), 0, &vars->reg_shm);
ut_assert(!rc);
ut_assert(state->num_shms == 1);
- rc = tee_shm_alloc(dev, 256, 0, &alloc_shm);
+ rc = tee_shm_alloc(dev, 256, 0, &vars->alloc_shm);
ut_assert(!rc);
ut_assert(state->num_shms == 2);
- ut_assert(tee_shm_is_registered(reg_shm, dev));
- ut_assert(tee_shm_is_registered(alloc_shm, dev));
+ ut_assert(tee_shm_is_registered(vars->reg_shm, dev));
+ ut_assert(tee_shm_is_registered(vars->alloc_shm, dev));
- tee_shm_free(reg_shm);
- tee_shm_free(alloc_shm);
+ tee_shm_free(vars->reg_shm);
+ vars->reg_shm = NULL;
+ tee_shm_free(vars->alloc_shm);
+ vars->alloc_shm = NULL;
ut_assert(!state->num_shms);
return 0;
}
+static int dm_test_tee(struct unit_test_state *uts)
+{
+ struct test_tee_vars vars = { NULL, NULL };
+ int rc = test_tee(uts, &vars);
+
+ /* In case test_tee() asserts these may still remain allocated */
+ tee_shm_free(vars.reg_shm);
+ tee_shm_free(vars.alloc_shm);
+
+ return rc;
+}
+
DM_TEST(dm_test_tee, DM_TESTF_SCAN_FDT);
int main(int argc, char *argv[])
{
unsigned int i, j, i_rel_shdr, sh_type, sh_entsize, sh_entries;
- size_t rel_size, rel_actual_size, load_sz;
+ size_t rel_size, rel_actual_size;
const char *shstrtab, *sh_name, *rel_pfx;
int (*parse_fn)(const void *rel);
uint8_t *buf_start, *buf;
const Elf32_Ehdr *ehdr32;
const Elf64_Ehdr *ehdr64;
uintptr_t sh_offset;
- Elf32_Phdr *phdr32;
- Elf64_Phdr *phdr64;
Elf32_Shdr *shdr32;
Elf64_Shdr *shdr64;
struct stat st;
goto out_free_relocs;
}
- phdr32 = elf + ehdr_field(e_phoff);
- phdr64 = elf + ehdr_field(e_phoff);
shdr32 = elf + ehdr_field(e_shoff);
shdr64 = elf + ehdr_field(e_shoff);
shstrtab = elf + shdr_field(ehdr_field(e_shstrndx), sh_offset);
for (i = 0; i < ehdr_field(e_shnum); i++) {
sh_name = shstr(shdr_field(i, sh_name));
- if (!strcmp(sh_name, ".rel")) {
+ if (!strcmp(sh_name, ".data.reloc")) {
i_rel_shdr = i;
continue;
}
rel_size = shdr_field(i_rel_shdr, sh_size);
rel_actual_size = buf - buf_start;
if (rel_actual_size > rel_size) {
- fprintf(stderr, "Relocs overflowed .rel section\n");
- return -ENOMEM;
- }
-
- /* Update the .rel section's size */
- set_shdr_field(i_rel_shdr, sh_size, rel_actual_size);
-
- /* Shrink the PT_LOAD program header filesz (ie. shrink u-boot.bin) */
- for (i = 0; i < ehdr_field(e_phnum); i++) {
- if (phdr_field(i, p_type) != PT_LOAD)
- continue;
-
- load_sz = phdr_field(i, p_filesz);
- load_sz -= rel_size - rel_actual_size;
- set_phdr_field(i, p_filesz, load_sz);
- break;
+ fprintf(stderr, "Relocations overflow available space of 0x%lx (required 0x%lx)!\n",
+ rel_size, rel_actual_size);
+ fprintf(stderr, "Please adjust CONFIG_MIPS_RELOCATION_TABLE_SIZE to at least 0x%lx\n",
+ (rel_actual_size + 0x100) & ~0xFF);
+ err = -ENOMEM;
+ goto out_free_relocs;
}
/* Make sure data is written back to the file */