blob: 0ccd38b7e692a071077dcb6396dafd5091895b19 [file] [log] [blame]
Michal Simek2e53eb22022-09-19 14:21:02 +02001/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Configuration for Xilinx Versal NET
4 * Copyright (C) 2016 - 2022, Xilinx, Inc.
5 * Copyright (C) 2022, Advanced Micro Devices, Inc.
6 *
7 * Michal Simek <michal.simek@amd.com>
8 *
9 * Based on Configuration for Xilinx ZynqMP
10 */
11
12#ifndef __XILINX_VERSAL_NET_H
13#define __XILINX_VERSAL_NET_H
14
Michal Simek2e53eb22022-09-19 14:21:02 +020015/* FIXME this is causing issue at least on IPP */
16/* #define CONFIG_ARMV8_SWITCH_TO_EL1 */
17
18/* Generic Interrupt Controller Definitions */
19#define GICD_BASE 0xF9000000
20#define GICR_BASE 0xF9060000
21
Michal Simek2e53eb22022-09-19 14:21:02 +020022/* Serial setup */
Michal Simek2e53eb22022-09-19 14:21:02 +020023#define CONFIG_SYS_BAUDRATE_TABLE \
24 { 4800, 9600, 19200, 38400, 57600, 115200 }
25
Michal Simek2e53eb22022-09-19 14:21:02 +020026#if defined(CONFIG_CMD_DFU)
27#define DFU_DEFAULT_POLL_TIMEOUT 300
28#define CONFIG_THOR_RESET_OFF
29#define DFU_ALT_INFO_RAM \
30 "dfu_ram_info=" \
31 "setenv dfu_alt_info " \
32 "Image ram 80000 $kernel_size_r\\\\;" \
33 "system.dtb ram $fdt_addr_r $fdt_size_r\0" \
34 "dfu_ram=run dfu_ram_info && dfu 0 ram 0\0" \
35 "thor_ram=run dfu_ram_info && thordown 0 ram 0\0"
36
37#define DFU_ALT_INFO \
38 DFU_ALT_INFO_RAM
39#endif
40
41#if !defined(DFU_ALT_INFO)
42# define DFU_ALT_INFO
43#endif
44
45/* Ethernet driver */
46#if defined(CONFIG_ZYNQ_GEM)
Michal Simek59e49c32022-09-19 14:21:09 +020047# define PHY_ANEG_TIMEOUT 20000
Michal Simek2e53eb22022-09-19 14:21:02 +020048#endif
49
Michal Simek2e53eb22022-09-19 14:21:02 +020050#define ENV_MEM_LAYOUT_SETTINGS \
51 "fdt_addr_r=0x40000000\0" \
52 "fdt_size_r=0x400000\0" \
53 "pxefile_addr_r=0x10000000\0" \
54 "kernel_addr_r=0x18000000\0" \
55 "kernel_size_r=0x10000000\0" \
Michal Simek59e49c32022-09-19 14:21:09 +020056 "kernel_comp_addr_r=0x30000000\0" \
57 "kernel_comp_size=0x3C00000\0" \
Michal Simek2e53eb22022-09-19 14:21:02 +020058 "scriptaddr=0x20000000\0" \
59 "ramdisk_addr_r=0x02100000\0" \
60 "script_size_f=0x80000\0"
61
62#if defined(CONFIG_MMC_SDHCI_ZYNQ)
63# define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1)
64#else
65# define BOOT_TARGET_DEVICES_MMC(func)
66#endif
67
68#if defined(CONFIG_CMD_PXE) && defined(CONFIG_CMD_DHCP)
69# define BOOT_TARGET_DEVICES_PXE(func) func(PXE, pxe, na)
70#else
71# define BOOT_TARGET_DEVICES_PXE(func)
72#endif
73
74#if defined(CONFIG_CMD_DHCP)
75# define BOOT_TARGET_DEVICES_DHCP(func) func(DHCP, dhcp, na)
76#else
77# define BOOT_TARGET_DEVICES_DHCP(func)
78#endif
79
80#if defined(CONFIG_ZYNQMP_GQSPI) || defined(CONFIG_CADENCE_OSPI_VERSAL_NET)
81# define BOOT_TARGET_DEVICES_XSPI(func) func(XSPI, xspi, 0)
82#else
83# define BOOT_TARGET_DEVICES_XSPI(func)
84#endif
85
86#define BOOTENV_DEV_XSPI(devtypeu, devtypel, instance) \
87 "bootcmd_xspi0=sf probe 0 0 0 && " \
88 "sf read $scriptaddr $script_offset_f $script_size_f && " \
89 "echo XSPI: Trying to boot script at ${scriptaddr} && " \
90 "source ${scriptaddr}; echo XSPI: SCRIPT FAILED: continuing...;\0"
91
92#define BOOTENV_DEV_NAME_XSPI(devtypeu, devtypel, instance) \
93 "xspi0 "
94
95#define BOOT_TARGET_DEVICES_JTAG(func) func(JTAG, jtag, na)
96
97#define BOOTENV_DEV_JTAG(devtypeu, devtypel, instance) \
98 "bootcmd_jtag=echo JTAG: Trying to boot script at ${scriptaddr} && " \
99 "source ${scriptaddr}; echo JTAG: SCRIPT FAILED: continuing...;\0"
100
101#define BOOTENV_DEV_NAME_JTAG(devtypeu, devtypel, instance) \
102 "jtag "
103
104#define BOOT_TARGET_DEVICES_DFU_USB(func) func(DFU_USB, dfu_usb, 0)
105
106#define BOOTENV_DEV_DFU_USB(devtypeu, devtypel, instance) \
107 "bootcmd_dfu_usb=setenv dfu_alt_info boot.scr ram $scriptaddr " \
108 "$script_size_f; dfu 0 ram 0 && " \
109 "echo DFU: Trying to boot script at ${scriptaddr} && " \
110 "source ${scriptaddr}; " \
111 "echo DFU: SCRIPT FAILED: continuing...;\0"
112
113#define BOOTENV_DEV_NAME_DFU_USB(devtypeu, devtypel, instance) \
114 ""
115
116#define BOOT_TARGET_DEVICES(func) \
117 BOOT_TARGET_DEVICES_JTAG(func) \
118 BOOT_TARGET_DEVICES_MMC(func) \
119 BOOT_TARGET_DEVICES_XSPI(func) \
120 BOOT_TARGET_DEVICES_DFU_USB(func) \
121 BOOT_TARGET_DEVICES_PXE(func) \
122 BOOT_TARGET_DEVICES_DHCP(func)
123
124#include <config_distro_bootcmd.h>
125
126/* Initial environment variables */
127#ifndef CONFIG_EXTRA_ENV_SETTINGS
128#define CONFIG_EXTRA_ENV_SETTINGS \
129 ENV_MEM_LAYOUT_SETTINGS \
130 BOOTENV \
131 DFU_ALT_INFO
132#endif
133
134#endif /* __XILINX_VERSAL_NET_H */