Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| u-boot_porting_board [2019/12/27 07:25] – [Files/directories] rpjday | u-boot_porting_board [2019/12/27 08:55] (current) – [Existing usable content] rpjday | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ===== Overview ===== | ===== Overview ===== | ||
| - | Quick run-through of the supporting content and files for a specific board; in this case, the hypothetical ZynqMP-based " | + | Quick run-through of the supporting content and files for a specific board; in this case, the hypothetical ZynqMP-based " |
| Based on: | Based on: | ||
| Line 9: | Line 9: | ||
| CONFIG_SYS_CPU=" | CONFIG_SYS_CPU=" | ||
| CONFIG_SYS_SOC=" | CONFIG_SYS_SOC=" | ||
| - | CONFIG_SYS_VENDOR=" | + | CONFIG_SYS_VENDOR=" |
| CONFIG_SYS_BOARD=" | CONFIG_SYS_BOARD=" | ||
| CONFIG_SYS_CONFIG_NAME=" | CONFIG_SYS_CONFIG_NAME=" | ||
| Line 18: | Line 18: | ||
| ===== Files/ | ===== Files/ | ||
| - | Some of the following will already exist for generic ZynqMP content; use existing files as the starting point for new Coyote-related content: | + | Some of the following will already exist for generic ZynqMP content; use existing files from some other ZynqMP-based board as the starting point for new Coyote-related content. |
| + | |||
| + | ==== Existing usable content ==== | ||
| - | * '' | ||
| - | * '' | ||
| * '' | * '' | ||
| * '' | * '' | ||
| * '' | * '' | ||
| + | |||
| + | |||
| * '' | * '' | ||
| * '' | * '' | ||
| Line 30: | Line 32: | ||
| * '' | * '' | ||
| * '' | * '' | ||
| - | * board/ | ||
| - | * xilinx/ | ||
| - | * zynq/ | ||
| - | * Kconfig | ||
| - | * Makefile | ||
| - | * board.c | ||
| - | * cmds.c | ||
| - | * zynq-zed/ | ||
| - | * common/ | ||
| - | * board.c | ||
| - | ===== configs/ | + | ==== New Coyote board content |
| - | Board-specific config settings. | + | * '' |
| + | * '' | ||
| - | ===== include/ | ||
| - | ==== zynq-common.h ==== | + | * '' |
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| - | < | ||
| - | * Common configuration options for all Zynq boards. | ||
| - | */ | ||
| - | |||
| - | #ifndef __CONFIG_ZYNQ_COMMON_H | ||
| - | #define __CONFIG_ZYNQ_COMMON_H | ||
| - | |||
| - | /* CPU clock */ | ||
| - | #ifndef CONFIG_CPU_FREQ_HZ | ||
| - | # define CONFIG_CPU_FREQ_HZ | ||
| - | #endif | ||
| - | |||
| - | #define CONFIG_REMAKE_ELF | ||
| - | |||
| - | /* Cache options */ | ||
| - | #define CONFIG_SYS_L2CACHE_OFF | ||
| - | #ifndef CONFIG_SYS_L2CACHE_OFF | ||
| - | # define CONFIG_SYS_L2_PL310 | ||
| - | # define CONFIG_SYS_PL310_BASE | ||
| - | #endif | ||
| - | |||
| - | #define ZYNQ_SCUTIMER_BASEADDR | ||
| - | #define CONFIG_SYS_TIMERBASE | ||
| - | #define CONFIG_SYS_TIMER_COUNTS_DOWN | ||
| - | #define CONFIG_SYS_TIMER_COUNTER | ||
| - | |||
| - | ... etc etc ... | ||
| - | </ | ||
| - | |||
| - | ===== arch/arm/ ===== | ||
| - | |||
| - | Things you should find under here: | ||
| - | |||
| - | * DTS config | ||
| - | * CPU initialization | ||
| - | * pinmux controller | ||
| - | * DRAM | ||
| - | * clocks | ||
| - | |||
| - | ==== Kconfig ==== | ||
| - | |||
| - | < | ||
| - | config ARCH_ZYNQ | ||
| - | bool " | ||
| - | select BOARD_EARLY_INIT_F if WDT | ||
| - | select CLK | ||
| - | select CLK_ZYNQ | ||
| - | select CPU_V7A | ||
| - | select DM | ||
| - | select DM_ETH if NET | ||
| - | select DM_MMC if MMC | ||
| - | select DM_SERIAL | ||
| - | select DM_SPI | ||
| - | select DM_SPI_FLASH | ||
| - | select DM_USB if USB | ||
| - | select OF_CONTROL | ||
| - | select SPI | ||
| - | select SPL_BOARD_INIT if SPL | ||
| - | select SPL_CLK if SPL | ||
| - | select SPL_DM if SPL | ||
| - | select SPL_OF_CONTROL if SPL | ||
| - | select SPL_SEPARATE_BSS if SPL | ||
| - | select SUPPORT_SPL | ||
| - | imply ARCH_EARLY_INIT_R | ||
| - | imply BOARD_LATE_INIT | ||
| - | imply CMD_CLK | ||
| - | imply CMD_DM | ||
| - | imply CMD_SPL | ||
| - | imply FAT_WRITE | ||
| - | </ | ||
| - | |||
| - | ==== Makefile === | ||
| - | |||
| - | < | ||
| - | machine-$(CONFIG_ARCH_ZYNQ) | ||
| - | machine-$(CONFIG_ARCH_ZYNQMP) | ||
| - | </ | ||
| - | |||
| - | ==== mach-zynq/ ==== | ||
| - | |||
| - | < | ||
| - | clk.c | ||
| - | cpu.c | ||
| - | ddrc.c | ||
| - | include | ||
| - | Kconfig | ||
| - | lowlevel_init.S | ||
| - | Makefile | ||
| - | ps7_spl_init.c | ||
| - | slcr.c | ||
| - | spl.c | ||
| - | timer.c | ||
| - | u-boot.lds | ||
| - | u-boot-spl.lds | ||
| - | </ | ||
| - | |||
| - | ===== board/ | ||
| - | |||
| - | ==== Kconfig ==== | ||
| - | |||
| - | < | ||
| - | if ARCH_ZYNQ | ||
| - | |||
| - | config CMD_ZYNQ | ||
| - | bool " | ||
| - | default y | ||
| - | help | ||
| - | Enables Zynq specific commands. | ||
| - | |||
| - | config CMD_ZYNQ_AES | ||
| - | bool " | ||
| - | depends on CMD_ZYNQ | ||
| - | depends on FPGA_ZYNQPL | ||
| - | help | ||
| - | Decrypts the encrypted image present in source address | ||
| - | and places the decrypted image at destination address. | ||
| - | |||
| - | config CMD_ZYNQ_RSA | ||
| - | bool " | ||
| - | default y | ||
| - | depends on CMD_ZYNQ | ||
| - | depends on CMD_ZYNQ_AES | ||
| - | help | ||
| - | Enabling this will support zynq secure image verification. | ||
| - | The secure image is a xilinx specific BOOT.BIN with | ||
| - | either authentication or encryption or both encryption | ||
| - | and authentication feature enabled while generating | ||
| - | BOOT.BIN using Xilinx bootgen tool. | ||
| - | |||
| - | endif | ||
| - | </ | ||
| - | |||
| - | ==== Makefile ==== | ||
| - | |||
| - | < | ||
| - | obj-y := board.o | ||
| - | obj-y += ../ | ||
| - | |||
| - | ifneq ($(CONFIG_XILINX_PS_INIT_FILE),"" | ||
| - | PS_INIT_FILE := $(shell cd $(srctree); readlink -f $(CONFIG_XILINX_PS_INIT_FILE)) | ||
| - | init-objs := ps_init_gpl.o | ||
| - | spl/ | ||
| - | $(CC) $(c_flags) -I $(srctree)/ | ||
| - | endif | ||
| - | |||
| - | ifeq ($(init-objs), | ||
| - | hw-platform-y :=$(shell echo $(CONFIG_DEFAULT_DEVICE_TREE)) | ||
| - | init-objs := $(if $(wildcard $(srctree)/ | ||
| - | $(hw-platform-y)/ | ||
| - | endif | ||
| - | |||
| - | ifeq ($(init-objs), | ||
| - | ifneq ($(wildcard $(srctree)/ | ||
| - | init-objs := ps7_init_gpl.o | ||
| - | $(if $(CONFIG_SPL_BUILD), | ||
| - | $(warning Put custom ps7_init_gpl.c/ | ||
| - | endif | ||
| - | endif | ||
| - | |||
| - | ifndef CONFIG_SPL_BUILD | ||
| - | obj-$(CONFIG_CMD_ZYNQ) += cmds.o | ||
| - | obj-$(CONFIG_CMD_ZYNQ_RSA) += bootimg.o | ||
| - | endif | ||
| - | |||
| - | obj-$(CONFIG_SPL_BUILD) += $(init-objs) | ||
| - | |||
| - | # Suppress " | ||
| - | CFLAGS_REMOVE_ps7_init_gpl.o := -Wstrict-prototypes | ||
| - | |||
| - | # To include xil_io.h | ||
| - | CFLAGS_ps7_init_gpl.o := -I$(srctree)/ | ||
| - | </ | ||
| - | |||
| - | ==== board.c ==== | ||
| - | |||
| - | Probably need access to global data '' | ||
| - | |||
| - | < | ||
| - | DECLARE_GLOBAL_DATA_PTR; | ||
| - | </ | ||
| - | |||
| - | < | ||
| - | int board_init(void) | ||
| - | { | ||
| - | #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT) | ||
| - | if (uclass_get_device_by_seq(UCLASS_WDT, | ||
| - | debug(" | ||
| - | if (uclass_get_device(UCLASS_WDT, | ||
| - | puts(" | ||
| - | return 0; | ||
| - | } | ||
| - | } | ||
| - | |||
| - | wdt_start(watchdog_dev, | ||
| - | puts(" | ||
| - | # endif | ||
| - | |||
| - | return 0; | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | < | ||
| - | int board_late_init(void) | ||
| - | { | ||
| - | ... | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | < | ||
| - | #if !defined(CONFIG_SYS_SDRAM_BASE) && !defined(CONFIG_SYS_SDRAM_SIZE) | ||
| - | int dram_init_banksize(void) | ||
| - | { | ||
| - | return fdtdec_setup_memory_banksize(); | ||
| - | } | ||
| - | |||
| - | int dram_init(void) | ||
| - | { | ||
| - | if (fdtdec_setup_mem_size_base() != 0) | ||
| - | return -EINVAL; | ||
| - | |||
| - | zynq_ddrc_init(); | ||
| - | |||
| - | return 0; | ||
| - | } | ||
| - | #else | ||
| - | int dram_init(void) | ||
| - | { | ||
| - | gd-> | ||
| - | CONFIG_SYS_SDRAM_SIZE); | ||
| - | |||
| - | zynq_ddrc_init(); | ||
| - | |||
| - | return 0; | ||
| - | } | ||
| - | #endif | ||
| - | </ | ||
| - | |||
| - | < | ||
| - | #if defined(CONFIG_WATCHDOG) | ||
| - | /* Called by macro WATCHDOG_RESET */ | ||
| - | void watchdog_reset(void) | ||
| - | { | ||
| - | # if !defined(CONFIG_SPL_BUILD) | ||
| - | static ulong next_reset; | ||
| - | ulong now; | ||
| - | |||
| - | if (!watchdog_dev) | ||
| - | return; | ||
| - | |||
| - | now = timer_get_us(); | ||
| - | |||
| - | /* Do not reset the watchdog too often */ | ||
| - | if (now > next_reset) { | ||
| - | wdt_reset(watchdog_dev); | ||
| - | next_reset = now + 1000; | ||
| - | } | ||
| - | # endif | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | ==== cmds.c ==== | ||
| - | |||
| - | < | ||
| - | static cmd_tbl_t zynq_commands[] = { | ||
| - | #ifdef CONFIG_CMD_ZYNQ_RSA | ||
| - | U_BOOT_CMD_MKENT(rsa, | ||
| - | #endif | ||
| - | #ifdef CONFIG_CMD_ZYNQ_AES | ||
| - | U_BOOT_CMD_MKENT(aes, | ||
| - | #endif | ||
| - | }; | ||
| - | |||
| - | static int do_zynq(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | ||
| - | { | ||
| - | cmd_tbl_t *zynq_cmd; | ||
| - | int ret; | ||
| - | |||
| - | if (!ARRAY_SIZE(zynq_commands)) { | ||
| - | puts(" | ||
| - | return CMD_RET_USAGE; | ||
| - | } | ||
| - | |||
| - | if (argc < 2) | ||
| - | return CMD_RET_USAGE; | ||
| - | zynq_cmd = find_cmd_tbl(argv[1], | ||
| - | ARRAY_SIZE(zynq_commands)); | ||
| - | if (!zynq_cmd || argc != zynq_cmd-> | ||
| - | return CMD_RET_USAGE; | ||
| - | |||
| - | ret = zynq_cmd-> | ||
| - | |||
| - | return cmd_process_error(zynq_cmd, | ||
| - | } | ||
| - | |||
| - | #ifdef CONFIG_SYS_LONGHELP | ||
| - | static char zynq_help_text[] = | ||
| - | "" | ||
| - | #ifdef CONFIG_CMD_ZYNQ_RSA | ||
| - | "rsa < | ||
| - | " | ||
| - | " | ||
| - | #endif | ||
| - | #ifdef CONFIG_CMD_ZYNQ_AES | ||
| - | "aes < | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | #endif | ||
| - | ; | ||
| - | #endif | ||
| - | |||
| - | U_BOOT_CMD(zynq, | ||
| - | " | ||
| - | ); | ||
| - | </ | ||
| - | ===== board/ | ||
| - | ==== board.c ==== | ||