Jianchao Wang | 8782122 | 2019-07-19 00:30:01 +0300 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 |
Vladimir Oltean | 66fd01f | 2021-09-17 14:27:13 +0300 | [diff] [blame] | 2 | * Copyright 2016-2019 NXP |
Jianchao Wang | 8782122 | 2019-07-19 00:30:01 +0300 | [diff] [blame] | 3 | * Copyright 2019 Vladimir Oltean <olteanv@gmail.com> |
| 4 | */ |
| 5 | |
| 6 | #ifndef __CONFIG_H |
| 7 | #define __CONFIG_H |
| 8 | |
| 9 | #define CONFIG_ARMV7_SECURE_BASE OCRAM_BASE_S_ADDR |
| 10 | |
Jianchao Wang | 8782122 | 2019-07-19 00:30:01 +0300 | [diff] [blame] | 11 | #define CONFIG_DEEP_SLEEP |
| 12 | |
Jianchao Wang | 8782122 | 2019-07-19 00:30:01 +0300 | [diff] [blame] | 13 | #define CONFIG_SYS_INIT_RAM_ADDR OCRAM_BASE_ADDR |
| 14 | #define CONFIG_SYS_INIT_RAM_SIZE OCRAM_SIZE |
| 15 | |
| 16 | /* XHCI Support - enabled by default */ |
| 17 | #define CONFIG_USB_MAX_CONTROLLER_COUNT 1 |
| 18 | |
Jianchao Wang | 8782122 | 2019-07-19 00:30:01 +0300 | [diff] [blame] | 19 | #define DDR_SDRAM_CFG 0x470c0008 |
| 20 | #define DDR_CS0_BNDS 0x008000bf |
| 21 | #define DDR_CS0_CONFIG 0x80014302 |
| 22 | #define DDR_TIMING_CFG_0 0x50550004 |
| 23 | #define DDR_TIMING_CFG_1 0xbcb38c56 |
| 24 | #define DDR_TIMING_CFG_2 0x0040d120 |
| 25 | #define DDR_TIMING_CFG_3 0x010e1000 |
| 26 | #define DDR_TIMING_CFG_4 0x00000001 |
| 27 | #define DDR_TIMING_CFG_5 0x03401400 |
| 28 | #define DDR_SDRAM_CFG_2 0x00401010 |
| 29 | #define DDR_SDRAM_MODE 0x00061c60 |
| 30 | #define DDR_SDRAM_MODE_2 0x00180000 |
| 31 | #define DDR_SDRAM_INTERVAL 0x18600618 |
| 32 | #define DDR_DDR_WRLVL_CNTL 0x8655f605 |
| 33 | #define DDR_DDR_WRLVL_CNTL_2 0x05060607 |
| 34 | #define DDR_DDR_WRLVL_CNTL_3 0x05050505 |
| 35 | #define DDR_DDR_CDR1 0x80040000 |
| 36 | #define DDR_DDR_CDR2 0x00000001 |
| 37 | #define DDR_SDRAM_CLK_CNTL 0x02000000 |
| 38 | #define DDR_DDR_ZQ_CNTL 0x89080600 |
| 39 | #define DDR_CS0_CONFIG_2 0 |
| 40 | #define DDR_SDRAM_CFG_MEM_EN 0x80000000 |
| 41 | #define SDRAM_CFG2_D_INIT 0x00000010 |
| 42 | #define DDR_CDR2_VREF_TRAIN_EN 0x00000080 |
| 43 | #define SDRAM_CFG2_FRC_SR 0x80000000 |
| 44 | #define SDRAM_CFG_BI 0x00000001 |
| 45 | |
Jianchao Wang | 8782122 | 2019-07-19 00:30:01 +0300 | [diff] [blame] | 46 | #ifdef CONFIG_SD_BOOT |
Tom Rini | bba4c7f | 2020-06-16 19:06:25 -0400 | [diff] [blame] | 47 | #ifdef CONFIG_NXP_ESBC |
Jianchao Wang | 8782122 | 2019-07-19 00:30:01 +0300 | [diff] [blame] | 48 | #define CONFIG_U_BOOT_HDR_SIZE (16 << 10) |
Tom Rini | bba4c7f | 2020-06-16 19:06:25 -0400 | [diff] [blame] | 49 | #endif /* ifdef CONFIG_NXP_ESBC */ |
Jianchao Wang | 8782122 | 2019-07-19 00:30:01 +0300 | [diff] [blame] | 50 | |
| 51 | #define CONFIG_SPL_MAX_SIZE 0x1a000 |
| 52 | #define CONFIG_SPL_STACK 0x1001d000 |
| 53 | #define CONFIG_SPL_PAD_TO 0x1c000 |
| 54 | |
| 55 | #define CONFIG_SYS_SPL_MALLOC_START (CONFIG_SYS_TEXT_BASE + \ |
| 56 | CONFIG_SYS_MONITOR_LEN) |
| 57 | #define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000 |
| 58 | #define CONFIG_SPL_BSS_START_ADDR 0x80100000 |
| 59 | #define CONFIG_SPL_BSS_MAX_SIZE 0x80000 |
| 60 | |
| 61 | #ifdef CONFIG_U_BOOT_HDR_SIZE |
| 62 | /* |
| 63 | * HDR would be appended at end of image and copied to DDR along |
| 64 | * with U-Boot image. Here u-boot max. size is 512K. So if binary |
| 65 | * size increases then increase this size in case of secure boot as |
| 66 | * it uses raw U-Boot image instead of FIT image. |
| 67 | */ |
| 68 | #define CONFIG_SYS_MONITOR_LEN (0x100000 + CONFIG_U_BOOT_HDR_SIZE) |
| 69 | #else |
| 70 | #define CONFIG_SYS_MONITOR_LEN 0x100000 |
| 71 | #endif /* ifdef CONFIG_U_BOOT_HDR_SIZE */ |
| 72 | #endif |
| 73 | |
Jianchao Wang | 8782122 | 2019-07-19 00:30:01 +0300 | [diff] [blame] | 74 | #define PHYS_SDRAM 0x80000000 |
| 75 | #define PHYS_SDRAM_SIZE (1u * 1024 * 1024 * 1024) |
| 76 | |
| 77 | #define CONFIG_SYS_DDR_SDRAM_BASE 0x80000000UL |
| 78 | #define CONFIG_SYS_SDRAM_BASE CONFIG_SYS_DDR_SDRAM_BASE |
| 79 | |
Jianchao Wang | 8782122 | 2019-07-19 00:30:01 +0300 | [diff] [blame] | 80 | /* Serial Port */ |
Jianchao Wang | 8782122 | 2019-07-19 00:30:01 +0300 | [diff] [blame] | 81 | #define CONFIG_SYS_NS16550_SERIAL |
| 82 | #ifndef CONFIG_DM_SERIAL |
| 83 | #define CONFIG_SYS_NS16550_REG_SIZE 1 |
| 84 | #endif |
| 85 | #define CONFIG_SYS_NS16550_CLK get_serial_clock() |
| 86 | |
Jianchao Wang | 8782122 | 2019-07-19 00:30:01 +0300 | [diff] [blame] | 87 | /* I2C */ |
Jianchao Wang | 8782122 | 2019-07-19 00:30:01 +0300 | [diff] [blame] | 88 | |
| 89 | /* EEPROM */ |
Jianchao Wang | 8782122 | 2019-07-19 00:30:01 +0300 | [diff] [blame] | 90 | #define CONFIG_SYS_I2C_EEPROM_NXID |
| 91 | #define CONFIG_SYS_EEPROM_BUS_NUM 0 |
Jianchao Wang | 8782122 | 2019-07-19 00:30:01 +0300 | [diff] [blame] | 92 | |
| 93 | /* QSPI */ |
| 94 | #define FSL_QSPI_FLASH_SIZE (1 << 24) |
| 95 | #define FSL_QSPI_FLASH_NUM 2 |
| 96 | |
| 97 | /* PCIe */ |
| 98 | #define CONFIG_PCIE1 /* PCIE controller 1 */ |
| 99 | #define CONFIG_PCIE2 /* PCIE controller 2 */ |
| 100 | #define FSL_PCIE_COMPAT "fsl,ls1021a-pcie" |
| 101 | #ifdef CONFIG_PCI |
| 102 | #define CONFIG_PCI_SCAN_SHOW |
| 103 | #endif |
| 104 | |
| 105 | #define CONFIG_LAYERSCAPE_NS_ACCESS |
| 106 | #define COUNTER_FREQUENCY 12500000 |
| 107 | |
| 108 | #define CONFIG_HWCONFIG |
| 109 | #define HWCONFIG_BUFFER_SIZE 256 |
| 110 | |
| 111 | #define CONFIG_FSL_DEVICE_DISABLE |
| 112 | |
| 113 | #define BOOT_TARGET_DEVICES(func) \ |
| 114 | func(MMC, mmc, 0) \ |
| 115 | func(USB, usb, 0) \ |
| 116 | func(DHCP, dhcp, na) |
| 117 | #include <config_distro_bootcmd.h> |
| 118 | |
| 119 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
| 120 | "bootargs=root=/dev/ram0 rw console=ttyS0,115200\0" \ |
| 121 | "initrd_high=0xffffffff\0" \ |
Jianchao Wang | 8782122 | 2019-07-19 00:30:01 +0300 | [diff] [blame] | 122 | "fdt_addr=0x64f00000\0" \ |
| 123 | "kernel_addr=0x61000000\0" \ |
| 124 | "kernelheader_addr=0x60800000\0" \ |
| 125 | "scriptaddr=0x80000000\0" \ |
| 126 | "scripthdraddr=0x80080000\0" \ |
| 127 | "fdtheader_addr_r=0x80100000\0" \ |
| 128 | "kernelheader_addr_r=0x80200000\0" \ |
| 129 | "kernel_addr_r=0x80008000\0" \ |
| 130 | "kernelheader_size=0x40000\0" \ |
| 131 | "fdt_addr_r=0x8f000000\0" \ |
| 132 | "ramdisk_addr_r=0xa0000000\0" \ |
| 133 | "load_addr=0x80008000\0" \ |
| 134 | "kernel_size=0x2800000\0" \ |
| 135 | "kernel_addr_sd=0x8000\0" \ |
| 136 | "kernel_size_sd=0x14000\0" \ |
| 137 | "kernelhdr_addr_sd=0x4000\0" \ |
| 138 | "kernelhdr_size_sd=0x10\0" \ |
| 139 | BOOTENV \ |
| 140 | "boot_scripts=ls1021atsn_boot.scr\0" \ |
| 141 | "boot_script_hdr=hdr_ls1021atsn_bs.out\0" \ |
| 142 | "scan_dev_for_boot_part=" \ |
| 143 | "part list ${devtype} ${devnum} devplist; " \ |
| 144 | "env exists devplist || setenv devplist 1; " \ |
| 145 | "for distro_bootpart in ${devplist}; do " \ |
| 146 | "if fstype ${devtype} " \ |
| 147 | "${devnum}:${distro_bootpart} " \ |
| 148 | "bootfstype; then " \ |
| 149 | "run scan_dev_for_boot; " \ |
| 150 | "fi; " \ |
| 151 | "done\0" \ |
| 152 | "scan_dev_for_boot=" \ |
| 153 | "echo Scanning ${devtype} " \ |
| 154 | "${devnum}:${distro_bootpart}...; " \ |
| 155 | "for prefix in ${boot_prefixes}; do " \ |
| 156 | "run scan_dev_for_scripts; " \ |
| 157 | "run scan_dev_for_extlinux; " \ |
| 158 | "done;" \ |
| 159 | "\0" \ |
| 160 | "boot_a_script=" \ |
| 161 | "load ${devtype} ${devnum}:${distro_bootpart} " \ |
| 162 | "${scriptaddr} ${prefix}${script}; " \ |
| 163 | "env exists secureboot && load ${devtype} " \ |
| 164 | "${devnum}:${distro_bootpart} " \ |
| 165 | "${scripthdraddr} ${prefix}${boot_script_hdr} " \ |
| 166 | "&& esbc_validate ${scripthdraddr};" \ |
| 167 | "source ${scriptaddr}\0" \ |
| 168 | "qspi_bootcmd=echo Trying load from qspi..;" \ |
| 169 | "sf probe && sf read $load_addr " \ |
| 170 | "$kernel_addr $kernel_size; env exists secureboot " \ |
| 171 | "&& sf read $kernelheader_addr_r $kernelheader_addr " \ |
| 172 | "$kernelheader_size && esbc_validate ${kernelheader_addr_r}; " \ |
| 173 | "bootm $load_addr#$board\0" \ |
| 174 | "sd_bootcmd=echo Trying load from SD ..;" \ |
| 175 | "mmcinfo && mmc read $load_addr " \ |
| 176 | "$kernel_addr_sd $kernel_size_sd && " \ |
| 177 | "env exists secureboot && mmc read $kernelheader_addr_r " \ |
| 178 | "$kernelhdr_addr_sd $kernelhdr_size_sd " \ |
| 179 | " && esbc_validate ${kernelheader_addr_r};" \ |
| 180 | "bootm $load_addr#$board\0" |
| 181 | |
| 182 | /* Miscellaneous configurable options */ |
Alison Wang | c463eeb | 2020-02-03 15:25:19 +0800 | [diff] [blame] | 183 | #define CONFIG_SYS_BOOTMAPSZ (256 << 20) |
| 184 | |
Jianchao Wang | 8782122 | 2019-07-19 00:30:01 +0300 | [diff] [blame] | 185 | #define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ |
| 186 | #define CONFIG_SYS_PBSIZE \ |
| 187 | (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) |
| 188 | #define CONFIG_SYS_MAXARGS 16 /* max number of command args */ |
| 189 | #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE |
| 190 | |
Jianchao Wang | 8782122 | 2019-07-19 00:30:01 +0300 | [diff] [blame] | 191 | #define CONFIG_LS102XA_STREAM_ID |
| 192 | |
| 193 | #define CONFIG_SYS_INIT_SP_OFFSET \ |
| 194 | (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) |
| 195 | #define CONFIG_SYS_INIT_SP_ADDR \ |
| 196 | (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) |
| 197 | |
| 198 | #ifdef CONFIG_SPL_BUILD |
| 199 | #define CONFIG_SYS_MONITOR_BASE CONFIG_SPL_TEXT_BASE |
| 200 | #else |
| 201 | #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE /* start of monitor */ |
| 202 | #endif |
| 203 | |
| 204 | /* Environment */ |
Jianchao Wang | 8782122 | 2019-07-19 00:30:01 +0300 | [diff] [blame] | 205 | |
Jianchao Wang | 8782122 | 2019-07-19 00:30:01 +0300 | [diff] [blame] | 206 | #define CONFIG_SYS_BOOTM_LEN 0x8000000 /* 128 MB */ |
| 207 | |
| 208 | #endif |