blob: 7bc4fc6a6652b929953bbc4cc864e2dda6128651 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Ashish Kumar227b4bc2017-08-31 16:12:54 +05302/*
Yangbo Lubb32e682021-06-03 10:51:19 +08003 * Copyright 2017, 2020-2021 NXP
Ashish Kumar227b4bc2017-08-31 16:12:54 +05304 */
5
6#ifndef __LS1088A_RDB_H
7#define __LS1088A_RDB_H
8
9#include "ls1088a_common.h"
10
Pankit Gargf5c2a832018-12-27 04:37:55 +000011#if defined(CONFIG_TFABOOT) || \
12 defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI)
Ashish Kumar227b4bc2017-08-31 16:12:54 +053013#define SYS_NO_FLASH
Ashish Kumar227b4bc2017-08-31 16:12:54 +053014#endif
15
Ashish Kumar227b4bc2017-08-31 16:12:54 +053016#define COUNTER_FREQUENCY_REAL 25000000 /* 25MHz */
Ashish Kumar227b4bc2017-08-31 16:12:54 +053017
Ashish Kumar227b4bc2017-08-31 16:12:54 +053018#define CONFIG_MEM_INIT_VALUE 0xdeadbeef
Ashish Kumar227b4bc2017-08-31 16:12:54 +053019#define SPD_EEPROM_ADDRESS 0x51
Ashish Kumar227b4bc2017-08-31 16:12:54 +053020
21
22#if !defined(CONFIG_QSPI_BOOT) && !defined(CONFIG_SD_BOOT_QSPI)
Tom Rini6a5dccc2022-11-16 13:10:41 -050023#define CFG_SYS_NOR0_CSPR_EXT (0x0)
Tom Rini7b577ba2022-11-16 13:10:25 -050024#define CFG_SYS_NOR_AMASK IFC_AMASK(128 * 1024 * 1024)
25#define CFG_SYS_NOR_AMASK_EARLY IFC_AMASK(64 * 1024 * 1024)
Ashish Kumar227b4bc2017-08-31 16:12:54 +053026
Tom Rini6a5dccc2022-11-16 13:10:41 -050027#define CFG_SYS_NOR0_CSPR \
28 (CSPR_PHYS_ADDR(CFG_SYS_FLASH_BASE_PHYS) | \
Ashish Kumar227b4bc2017-08-31 16:12:54 +053029 CSPR_PORT_SIZE_16 | \
30 CSPR_MSEL_NOR | \
31 CSPR_V)
Tom Rini6a5dccc2022-11-16 13:10:41 -050032#define CFG_SYS_NOR0_CSPR_EARLY \
33 (CSPR_PHYS_ADDR(CFG_SYS_FLASH_BASE_PHYS_EARLY) | \
Ashish Kumar227b4bc2017-08-31 16:12:54 +053034 CSPR_PORT_SIZE_16 | \
35 CSPR_MSEL_NOR | \
36 CSPR_V)
Tom Rini7b577ba2022-11-16 13:10:25 -050037#define CFG_SYS_NOR_CSOR CSOR_NOR_ADM_SHIFT(6)
38#define CFG_SYS_NOR_FTIM0 (FTIM0_NOR_TACSE(0x1) | \
Ashish Kumar227b4bc2017-08-31 16:12:54 +053039 FTIM0_NOR_TEADC(0x1) | \
40 FTIM0_NOR_TEAHC(0x1))
Tom Rini7b577ba2022-11-16 13:10:25 -050041#define CFG_SYS_NOR_FTIM1 (FTIM1_NOR_TACO(0x1) | \
Ashish Kumar227b4bc2017-08-31 16:12:54 +053042 FTIM1_NOR_TRAD_NOR(0x1))
Tom Rini7b577ba2022-11-16 13:10:25 -050043#define CFG_SYS_NOR_FTIM2 (FTIM2_NOR_TCS(0x0) | \
Ashish Kumar227b4bc2017-08-31 16:12:54 +053044 FTIM2_NOR_TCH(0x0) | \
45 FTIM2_NOR_TWP(0x1))
Tom Rini7b577ba2022-11-16 13:10:25 -050046#define CFG_SYS_NOR_FTIM3 0x04000000
Tom Rini6a5dccc2022-11-16 13:10:41 -050047#define CFG_SYS_IFC_CCR 0x01000000
Ashish Kumar227b4bc2017-08-31 16:12:54 +053048
49#ifndef SYS_NO_FLASH
Ashish Kumar227b4bc2017-08-31 16:12:54 +053050#define CONFIG_FLASH_SHOW_PROGRESS 45 /* count down from 45/5: 9..1 */
51
Tom Rini6a5dccc2022-11-16 13:10:41 -050052#define CFG_SYS_FLASH_BANKS_LIST { CFG_SYS_FLASH_BASE }
Ashish Kumar227b4bc2017-08-31 16:12:54 +053053#endif
54#endif
Sumit Garg08da8b22018-01-06 09:04:24 +053055
Tom Rinib4213492022-11-12 17:36:51 -050056#define CFG_SYS_NAND_CSPR_EXT (0x0)
57#define CFG_SYS_NAND_CSPR (CSPR_PHYS_ADDR(CFG_SYS_NAND_BASE_PHYS) \
Ashish Kumar227b4bc2017-08-31 16:12:54 +053058 | CSPR_PORT_SIZE_8 /* Port Size = 8 bit */ \
59 | CSPR_MSEL_NAND /* MSEL = NAND */ \
60 | CSPR_V)
Tom Rinib4213492022-11-12 17:36:51 -050061#define CFG_SYS_NAND_AMASK IFC_AMASK(64 * 1024)
Ashish Kumar227b4bc2017-08-31 16:12:54 +053062
Tom Rinib4213492022-11-12 17:36:51 -050063#define CFG_SYS_NAND_CSOR (CSOR_NAND_ECC_ENC_EN /* ECC on encode */ \
Ashish Kumar227b4bc2017-08-31 16:12:54 +053064 | CSOR_NAND_ECC_DEC_EN /* ECC on decode */ \
65 | CSOR_NAND_ECC_MODE_4 /* 4-bit ECC */ \
66 | CSOR_NAND_RAL_3 /* RAL = 3Byes */ \
67 | CSOR_NAND_PGS_2K /* Page Size = 2K */ \
68 | CSOR_NAND_SPRZ_64/* Spare size = 64 */ \
69 | CSOR_NAND_PB(64)) /*Pages Per Block = 64*/
70
Ashish Kumar227b4bc2017-08-31 16:12:54 +053071/* ONFI NAND Flash mode0 Timing Params */
Tom Rinib4213492022-11-12 17:36:51 -050072#define CFG_SYS_NAND_FTIM0 (FTIM0_NAND_TCCST(0x07) | \
Ashish Kumar227b4bc2017-08-31 16:12:54 +053073 FTIM0_NAND_TWP(0x18) | \
74 FTIM0_NAND_TWCHT(0x07) | \
75 FTIM0_NAND_TWH(0x0a))
Tom Rinib4213492022-11-12 17:36:51 -050076#define CFG_SYS_NAND_FTIM1 (FTIM1_NAND_TADLE(0x32) | \
Ashish Kumar227b4bc2017-08-31 16:12:54 +053077 FTIM1_NAND_TWBE(0x39) | \
78 FTIM1_NAND_TRR(0x0e) | \
79 FTIM1_NAND_TRP(0x18))
Tom Rinib4213492022-11-12 17:36:51 -050080#define CFG_SYS_NAND_FTIM2 (FTIM2_NAND_TRAD(0x0f) | \
Ashish Kumar227b4bc2017-08-31 16:12:54 +053081 FTIM2_NAND_TREH(0x0a) | \
82 FTIM2_NAND_TWHRE(0x1e))
Tom Rinib4213492022-11-12 17:36:51 -050083#define CFG_SYS_NAND_FTIM3 0x0
Ashish Kumar227b4bc2017-08-31 16:12:54 +053084
Tom Rinib4213492022-11-12 17:36:51 -050085#define CFG_SYS_NAND_BASE_LIST { CFG_SYS_NAND_BASE }
Ashish Kumar227b4bc2017-08-31 16:12:54 +053086#define CONFIG_MTD_NAND_VERIFY_WRITE
87
Tom Rini6a5dccc2022-11-16 13:10:41 -050088#define CFG_SYS_I2C_FPGA_ADDR 0x66
Rajesh Bhagata4216252018-01-17 16:13:09 +053089#define QIXIS_BRDCFG4_OFFSET 0x54
Ashish Kumar227b4bc2017-08-31 16:12:54 +053090#define QIXIS_LBMAP_SWITCH 2
91#define QIXIS_QMAP_MASK 0xe0
92#define QIXIS_QMAP_SHIFT 5
93#define QIXIS_LBMAP_MASK 0x1f
94#define QIXIS_LBMAP_SHIFT 5
95#define QIXIS_LBMAP_DFLTBANK 0x00
96#define QIXIS_LBMAP_ALTBANK 0x20
97#define QIXIS_LBMAP_SD 0x00
Ashish Kumar55769ca2018-01-17 12:16:37 +053098#define QIXIS_LBMAP_EMMC 0x00
Ashish Kumar227b4bc2017-08-31 16:12:54 +053099#define QIXIS_LBMAP_SD_QSPI 0x00
100#define QIXIS_LBMAP_QSPI 0x00
101#define QIXIS_RCW_SRC_SD 0x40
Ashish Kumar55769ca2018-01-17 12:16:37 +0530102#define QIXIS_RCW_SRC_EMMC 0x41
Ashish Kumar227b4bc2017-08-31 16:12:54 +0530103#define QIXIS_RCW_SRC_QSPI 0x62
104#define QIXIS_RST_CTL_RESET 0x31
105#define QIXIS_RCFG_CTL_RECONFIG_IDLE 0x20
106#define QIXIS_RCFG_CTL_RECONFIG_START 0x21
107#define QIXIS_RCFG_CTL_WATCHDOG_ENBLE 0x08
108#define QIXIS_RST_FORCE_MEM 0x01
109
Tom Rini6a5dccc2022-11-16 13:10:41 -0500110#define CFG_SYS_FPGA_CSPR_EXT (0x0)
111#define CFG_SYS_FPGA_CSPR (CSPR_PHYS_ADDR(QIXIS_BASE_PHYS_EARLY) \
Ashish Kumar227b4bc2017-08-31 16:12:54 +0530112 | CSPR_PORT_SIZE_8 \
113 | CSPR_MSEL_GPCM \
114 | CSPR_V)
115#define SYS_FPGA_CSPR_FINAL (CSPR_PHYS_ADDR(QIXIS_BASE_PHYS) \
116 | CSPR_PORT_SIZE_8 \
117 | CSPR_MSEL_GPCM \
118 | CSPR_V)
119
Tom Rini6a5dccc2022-11-16 13:10:41 -0500120#define CFG_SYS_FPGA_AMASK IFC_AMASK(64*1024)
121#define CFG_SYS_FPGA_CSOR CSOR_GPCM_ADM_SHIFT(0)
Ashish Kumar227b4bc2017-08-31 16:12:54 +0530122/* QIXIS Timing parameters*/
123#define SYS_FPGA_CS_FTIM0 (FTIM0_GPCM_TACSE(0x0e) | \
124 FTIM0_GPCM_TEADC(0x0e) | \
125 FTIM0_GPCM_TEAHC(0x0e))
126#define SYS_FPGA_CS_FTIM1 (FTIM1_GPCM_TACO(0xff) | \
127 FTIM1_GPCM_TRAD(0x3f))
128#define SYS_FPGA_CS_FTIM2 (FTIM2_GPCM_TCS(0xf) | \
129 FTIM2_GPCM_TCH(0xf) | \
130 FTIM2_GPCM_TWP(0x3E))
131#define SYS_FPGA_CS_FTIM3 0x0
132
Pankit Gargf5c2a832018-12-27 04:37:55 +0000133#if defined(CONFIG_TFABOOT) || \
134 defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI)
Tom Rini6a5dccc2022-11-16 13:10:41 -0500135#define CFG_SYS_CSPR0_EXT CFG_SYS_NAND_CSPR_EXT
136#define CFG_SYS_CSPR0 CFG_SYS_NAND_CSPR
137#define CFG_SYS_AMASK0 CFG_SYS_NAND_AMASK
138#define CFG_SYS_CSOR0 CFG_SYS_NAND_CSOR
139#define CFG_SYS_CS0_FTIM0 CFG_SYS_NAND_FTIM0
140#define CFG_SYS_CS0_FTIM1 CFG_SYS_NAND_FTIM1
141#define CFG_SYS_CS0_FTIM2 CFG_SYS_NAND_FTIM2
142#define CFG_SYS_CS0_FTIM3 CFG_SYS_NAND_FTIM3
143#define CFG_SYS_CSPR2_EXT CFG_SYS_FPGA_CSPR_EXT
144#define CFG_SYS_CSPR2 CFG_SYS_FPGA_CSPR
145#define CFG_SYS_CSPR2_FINAL SYS_FPGA_CSPR_FINAL
146#define CFG_SYS_AMASK2 CFG_SYS_FPGA_AMASK
147#define CFG_SYS_CSOR2 CFG_SYS_FPGA_CSOR
148#define CFG_SYS_CS2_FTIM0 SYS_FPGA_CS_FTIM0
149#define CFG_SYS_CS2_FTIM1 SYS_FPGA_CS_FTIM1
150#define CFG_SYS_CS2_FTIM2 SYS_FPGA_CS_FTIM2
151#define CFG_SYS_CS2_FTIM3 SYS_FPGA_CS_FTIM3
Ashish Kumar227b4bc2017-08-31 16:12:54 +0530152#else
Tom Rini6a5dccc2022-11-16 13:10:41 -0500153#define CFG_SYS_CSPR0_EXT CFG_SYS_NOR0_CSPR_EXT
154#define CFG_SYS_CSPR0 CFG_SYS_NOR0_CSPR_EARLY
155#define CFG_SYS_CSPR0_FINAL CFG_SYS_NOR0_CSPR
156#define CFG_SYS_AMASK0 CFG_SYS_NOR_AMASK
157#define CFG_SYS_CSOR0 CFG_SYS_NOR_CSOR
158#define CFG_SYS_CS0_FTIM0 CFG_SYS_NOR_FTIM0
159#define CFG_SYS_CS0_FTIM1 CFG_SYS_NOR_FTIM1
160#define CFG_SYS_CS0_FTIM2 CFG_SYS_NOR_FTIM2
161#define CFG_SYS_CS0_FTIM3 CFG_SYS_NOR_FTIM3
Ashish Kumar227b4bc2017-08-31 16:12:54 +0530162#endif
163
Tom Rini6a5dccc2022-11-16 13:10:41 -0500164#define CFG_SYS_LS_MC_BOOT_TIMEOUT_MS 5000
Ashish Kumar227b4bc2017-08-31 16:12:54 +0530165
Stephen Carlsonc3301a22021-02-08 11:11:29 +0100166#define I2C_MUX_CH_VOL_MONITOR 0xA
Rajesh Bhagat170eecf2018-01-17 16:13:05 +0530167/* Voltage monitor on channel 2*/
168#define I2C_VOL_MONITOR_ADDR 0x63
169#define I2C_VOL_MONITOR_BUS_V_OFFSET 0x2
170#define I2C_VOL_MONITOR_BUS_V_OVF 0x1
171#define I2C_VOL_MONITOR_BUS_V_SHIFT 3
Rajesh Bhagata4216252018-01-17 16:13:09 +0530172#define I2C_SVDD_MONITOR_ADDR 0x4F
173
Rajesh Bhagata4216252018-01-17 16:13:09 +0530174/* The lowest and highest voltage allowed for LS1088ARDB */
175#define VDD_MV_MIN 819
176#define VDD_MV_MAX 1212
177
Rajesh Bhagat170eecf2018-01-17 16:13:05 +0530178#define PWM_CHANNEL0 0x0
179
Ashish Kumar227b4bc2017-08-31 16:12:54 +0530180/*
181 * I2C bus multiplexer
182 */
183#define I2C_MUX_PCA_ADDR_PRI 0x77
184#define I2C_MUX_PCA_ADDR_SEC 0x76 /* Secondary multiplexer */
185#define I2C_RETIMER_ADDR 0x18
186#define I2C_MUX_CH_DEFAULT 0x8
187#define I2C_MUX_CH5 0xD
Sumit Garg08da8b22018-01-06 09:04:24 +0530188
Ashish Kumar227b4bc2017-08-31 16:12:54 +0530189/*
190* RTC configuration
191*/
Tom Rini6a5dccc2022-11-16 13:10:41 -0500192#define CFG_SYS_I2C_RTC_ADDR 0x51 /* Channel 3*/
Ashish Kumar227b4bc2017-08-31 16:12:54 +0530193
Sumit Garg08da8b22018-01-06 09:04:24 +0530194#ifndef SPL_NO_ENV
Ashish Kumar227b4bc2017-08-31 16:12:54 +0530195/* Initial environment variables */
Pankit Gargf5c2a832018-12-27 04:37:55 +0000196#ifdef CONFIG_TFABOOT
197#define QSPI_MC_INIT_CMD \
Priyanka Jain8f5bd972021-07-19 14:53:34 +0530198 "sf probe 0:0;sf read 0x80a00000 0xA00000 0x200000;" \
199 "sf read 0x80e00000 0xE00000 0x100000;" \
Pankit Gargf5c2a832018-12-27 04:37:55 +0000200 "env exists secureboot && " \
Priyanka Singhf745ae92020-01-22 10:32:34 +0000201 "sf read 0x80640000 0x640000 0x40000 && " \
202 "sf read 0x80680000 0x680000 0x40000 && " \
203 "esbc_validate 0x80640000 && " \
204 "esbc_validate 0x80680000 ;" \
Priyanka Jain8f5bd972021-07-19 14:53:34 +0530205 "fsl_mc start mc 0x80a00000 0x80e00000\0"
Pankit Gargf5c2a832018-12-27 04:37:55 +0000206#define SD_MC_INIT_CMD \
Priyanka Jain8f5bd972021-07-19 14:53:34 +0530207 "mmcinfo;mmc read 0x80a00000 0x5000 0x1000;" \
208 "mmc read 0x80e00000 0x7000 0x800;" \
Pankit Gargf5c2a832018-12-27 04:37:55 +0000209 "env exists secureboot && " \
Priyanka Singhf745ae92020-01-22 10:32:34 +0000210 "mmc read 0x80640000 0x3200 0x20 && " \
211 "mmc read 0x80680000 0x3400 0x20 && " \
212 "esbc_validate 0x80640000 && " \
213 "esbc_validate 0x80680000 ;" \
Priyanka Jain8f5bd972021-07-19 14:53:34 +0530214 "fsl_mc start mc 0x80a00000 0x80e00000\0"
Pankit Gargf5c2a832018-12-27 04:37:55 +0000215#else
Ashish Kumar227b4bc2017-08-31 16:12:54 +0530216#if defined(CONFIG_QSPI_BOOT)
Ashish Kumar2e1fcf32017-11-06 13:19:28 +0530217#define MC_INIT_CMD \
Priyanka Jain8f5bd972021-07-19 14:53:34 +0530218 "mcinitcmd=sf probe 0:0;sf read 0x80a00000 0xA00000 0x200000;" \
219 "sf read 0x80e00000 0xE00000 0x100000;" \
Udit Agarwal09fd5792017-11-22 09:01:26 +0530220 "env exists secureboot && " \
Priyanka Singhf745ae92020-01-22 10:32:34 +0000221 "sf read 0x80640000 0x640000 0x40000 && " \
222 "sf read 0x80680000 0x680000 0x40000 && " \
223 "esbc_validate 0x80640000 && " \
224 "esbc_validate 0x80680000 ;" \
Priyanka Jain8f5bd972021-07-19 14:53:34 +0530225 "fsl_mc start mc 0x80a00000 0x80e00000\0" \
Ashish Kumar2e1fcf32017-11-06 13:19:28 +0530226 "mcmemsize=0x70000000\0"
Ashish Kumar5676ceb2017-11-06 13:18:43 +0530227#elif defined(CONFIG_SD_BOOT)
Ashish Kumar2e1fcf32017-11-06 13:19:28 +0530228#define MC_INIT_CMD \
Priyanka Jain8f5bd972021-07-19 14:53:34 +0530229 "mcinitcmd=mmcinfo;mmc read 0x80a00000 0x5000 0x1000;" \
230 "mmc read 0x80e00000 0x7000 0x800;" \
Udit Agarwal09fd5792017-11-22 09:01:26 +0530231 "env exists secureboot && " \
Priyanka Singhf745ae92020-01-22 10:32:34 +0000232 "mmc read 0x80640000 0x3200 0x20 && " \
233 "mmc read 0x80680000 0x3400 0x20 && " \
234 "esbc_validate 0x80640000 && " \
235 "esbc_validate 0x80680000 ;" \
Priyanka Jain8f5bd972021-07-19 14:53:34 +0530236 "fsl_mc start mc 0x80a00000 0x80e00000\0" \
Ashish Kumar2e1fcf32017-11-06 13:19:28 +0530237 "mcmemsize=0x70000000\0"
238#endif
Pankit Gargf5c2a832018-12-27 04:37:55 +0000239#endif /* CONFIG_TFABOOT */
Ashish Kumar2e1fcf32017-11-06 13:19:28 +0530240
Ashish Kumar5676ceb2017-11-06 13:18:43 +0530241#undef CONFIG_EXTRA_ENV_SETTINGS
Pankit Gargf5c2a832018-12-27 04:37:55 +0000242#ifdef CONFIG_TFABOOT
Ashish Kumar5676ceb2017-11-06 13:18:43 +0530243#define CONFIG_EXTRA_ENV_SETTINGS \
Ashish Kumar2e1fcf32017-11-06 13:19:28 +0530244 "BOARD=ls1088ardb\0" \
Ashish Kumar5676ceb2017-11-06 13:18:43 +0530245 "hwconfig=fsl_ddr:bank_intlv=auto\0" \
Ashish Kumar5676ceb2017-11-06 13:18:43 +0530246 "ramdisk_addr=0x800000\0" \
247 "ramdisk_size=0x2000000\0" \
248 "fdt_high=0xa0000000\0" \
249 "initrd_high=0xffffffffffffffff\0" \
Ashish Kumar2e1fcf32017-11-06 13:19:28 +0530250 "kernel_addr=0x1000000\0" \
251 "kernel_addr_sd=0x8000\0" \
Priyanka Singhf745ae92020-01-22 10:32:34 +0000252 "kernelhdr_addr_sd=0x3000\0" \
Ashish Kumar2e1fcf32017-11-06 13:19:28 +0530253 "kernel_start=0x580100000\0" \
Priyanka Singhf745ae92020-01-22 10:32:34 +0000254 "kernelheader_start=0x580600000\0" \
Ashish Kumar2e1fcf32017-11-06 13:19:28 +0530255 "scriptaddr=0x80000000\0" \
256 "scripthdraddr=0x80080000\0" \
257 "fdtheader_addr_r=0x80100000\0" \
Priyanka Singhf745ae92020-01-22 10:32:34 +0000258 "kernelheader_addr=0x600000\0" \
Ashish Kumar2e1fcf32017-11-06 13:19:28 +0530259 "kernelheader_addr_r=0x80200000\0" \
260 "kernel_addr_r=0x81000000\0" \
261 "kernelheader_size=0x40000\0" \
262 "fdt_addr_r=0x90000000\0" \
263 "load_addr=0xa0000000\0" \
264 "kernel_size=0x2800000\0" \
265 "kernel_size_sd=0x14000\0" \
Udit Agarwal11e1a572019-11-20 08:49:06 +0000266 "kernelhdr_size_sd=0x20\0" \
Pankit Gargf5c2a832018-12-27 04:37:55 +0000267 QSPI_MC_INIT_CMD \
268 "mcmemsize=0x70000000\0" \
269 BOOTENV \
270 "boot_scripts=ls1088ardb_boot.scr\0" \
271 "boot_script_hdr=hdr_ls1088ardb_bs.out\0" \
272 "scan_dev_for_boot_part=" \
273 "part list ${devtype} ${devnum} devplist; " \
274 "env exists devplist || setenv devplist 1; " \
275 "for distro_bootpart in ${devplist}; do " \
276 "if fstype ${devtype} " \
277 "${devnum}:${distro_bootpart} " \
278 "bootfstype; then " \
279 "run scan_dev_for_boot; " \
280 "fi; " \
281 "done\0" \
Pankit Gargf5c2a832018-12-27 04:37:55 +0000282 "boot_a_script=" \
283 "load ${devtype} ${devnum}:${distro_bootpart} " \
284 "${scriptaddr} ${prefix}${script}; " \
285 "env exists secureboot && load ${devtype} " \
286 "${devnum}:${distro_bootpart} " \
Vinitha V Pillai25355ec2019-04-23 05:52:17 +0000287 "${scripthdraddr} ${prefix}${boot_script_hdr}; "\
288 "env exists secureboot " \
Pankit Gargf5c2a832018-12-27 04:37:55 +0000289 "&& esbc_validate ${scripthdraddr};" \
290 "source ${scriptaddr}\0" \
291 "installer=load mmc 0:2 $load_addr " \
292 "/flex_installer_arm64.itb; " \
293 "env exists mcinitcmd && run mcinitcmd && " \
294 "mmc read 0x80001000 0x6800 0x800;" \
295 "fsl_mc lazyapply dpl 0x80001000;" \
296 "bootm $load_addr#ls1088ardb\0" \
297 "qspi_bootcmd=echo Trying load from qspi..;" \
298 "sf probe && sf read $load_addr " \
299 "$kernel_addr $kernel_size ; env exists secureboot " \
300 "&& sf read $kernelheader_addr_r $kernelheader_addr " \
301 "$kernelheader_size && esbc_validate ${kernelheader_addr_r}; "\
302 "bootm $load_addr#$BOARD\0" \
303 "sd_bootcmd=echo Trying load from sd card..;" \
304 "mmcinfo; mmc read $load_addr " \
305 "$kernel_addr_sd $kernel_size_sd ;" \
306 "env exists secureboot && mmc read $kernelheader_addr_r "\
307 "$kernelhdr_addr_sd $kernelhdr_size_sd " \
308 " && esbc_validate ${kernelheader_addr_r};" \
309 "bootm $load_addr#$BOARD\0"
310#else
311#define CONFIG_EXTRA_ENV_SETTINGS \
312 "BOARD=ls1088ardb\0" \
313 "hwconfig=fsl_ddr:bank_intlv=auto\0" \
314 "ramdisk_addr=0x800000\0" \
315 "ramdisk_size=0x2000000\0" \
316 "fdt_high=0xa0000000\0" \
317 "initrd_high=0xffffffffffffffff\0" \
Pankit Gargf5c2a832018-12-27 04:37:55 +0000318 "kernel_addr=0x1000000\0" \
319 "kernel_addr_sd=0x8000\0" \
Priyanka Singhf745ae92020-01-22 10:32:34 +0000320 "kernelhdr_addr_sd=0x3000\0" \
Pankit Gargf5c2a832018-12-27 04:37:55 +0000321 "kernel_start=0x580100000\0" \
322 "kernelheader_start=0x580800000\0" \
323 "scriptaddr=0x80000000\0" \
324 "scripthdraddr=0x80080000\0" \
325 "fdtheader_addr_r=0x80100000\0" \
Priyanka Singhf745ae92020-01-22 10:32:34 +0000326 "kernelheader_addr=0x600000\0" \
Pankit Gargf5c2a832018-12-27 04:37:55 +0000327 "kernelheader_addr_r=0x80200000\0" \
328 "kernel_addr_r=0x81000000\0" \
329 "kernelheader_size=0x40000\0" \
330 "fdt_addr_r=0x90000000\0" \
331 "load_addr=0xa0000000\0" \
332 "kernel_size=0x2800000\0" \
333 "kernel_size_sd=0x14000\0" \
Udit Agarwal11e1a572019-11-20 08:49:06 +0000334 "kernelhdr_size_sd=0x20\0" \
Ashish Kumar2e1fcf32017-11-06 13:19:28 +0530335 MC_INIT_CMD \
336 BOOTENV \
337 "boot_scripts=ls1088ardb_boot.scr\0" \
338 "boot_script_hdr=hdr_ls1088ardb_bs.out\0" \
339 "scan_dev_for_boot_part=" \
340 "part list ${devtype} ${devnum} devplist; " \
341 "env exists devplist || setenv devplist 1; " \
342 "for distro_bootpart in ${devplist}; do " \
343 "if fstype ${devtype} " \
344 "${devnum}:${distro_bootpart} " \
345 "bootfstype; then " \
346 "run scan_dev_for_boot; " \
347 "fi; " \
348 "done\0" \
Ashish Kumar2e1fcf32017-11-06 13:19:28 +0530349 "boot_a_script=" \
350 "load ${devtype} ${devnum}:${distro_bootpart} " \
351 "${scriptaddr} ${prefix}${script}; " \
352 "env exists secureboot && load ${devtype} " \
353 "${devnum}:${distro_bootpart} " \
354 "${scripthdraddr} ${prefix}${boot_script_hdr} " \
355 "&& esbc_validate ${scripthdraddr};" \
356 "source ${scriptaddr}\0" \
357 "installer=load mmc 0:2 $load_addr " \
358 "/flex_installer_arm64.itb; " \
359 "env exists mcinitcmd && run mcinitcmd && " \
Jagdish Gediya40febde2018-06-05 09:04:05 +0530360 "mmc read 0x80001000 0x6800 0x800;" \
361 "fsl_mc lazyapply dpl 0x80001000;" \
Ashish Kumar2e1fcf32017-11-06 13:19:28 +0530362 "bootm $load_addr#ls1088ardb\0" \
363 "qspi_bootcmd=echo Trying load from qspi..;" \
364 "sf probe && sf read $load_addr " \
Udit Agarwal09fd5792017-11-22 09:01:26 +0530365 "$kernel_addr $kernel_size ; env exists secureboot " \
366 "&& sf read $kernelheader_addr_r $kernelheader_addr " \
367 "$kernelheader_size && esbc_validate ${kernelheader_addr_r}; "\
Ashish Kumar2e1fcf32017-11-06 13:19:28 +0530368 "bootm $load_addr#$BOARD\0" \
Udit Agarwal09fd5792017-11-22 09:01:26 +0530369 "sd_bootcmd=echo Trying load from sd card..;" \
Ashish Kumar2e1fcf32017-11-06 13:19:28 +0530370 "mmcinfo; mmc read $load_addr " \
371 "$kernel_addr_sd $kernel_size_sd ;" \
Udit Agarwal09fd5792017-11-22 09:01:26 +0530372 "env exists secureboot && mmc read $kernelheader_addr_r "\
373 "$kernelhdr_addr_sd $kernelhdr_size_sd " \
374 " && esbc_validate ${kernelheader_addr_r};" \
Ashish Kumar2e1fcf32017-11-06 13:19:28 +0530375 "bootm $load_addr#$BOARD\0"
Pankit Gargf5c2a832018-12-27 04:37:55 +0000376#endif /* CONFIG_TFABOOT */
Ashish Kumar227b4bc2017-08-31 16:12:54 +0530377
Pankit Gargf5c2a832018-12-27 04:37:55 +0000378#ifdef CONFIG_TFABOOT
379#define QSPI_NOR_BOOTCOMMAND \
Udit Agarwal11e1a572019-11-20 08:49:06 +0000380 "sf read 0x80001000 0xd00000 0x100000;" \
Pankit Gargf5c2a832018-12-27 04:37:55 +0000381 "env exists mcinitcmd && env exists secureboot " \
Priyanka Singhf745ae92020-01-22 10:32:34 +0000382 " && sf read 0x806C0000 0x6C0000 0x100000 " \
383 "&& esbc_validate 0x806C0000;env exists mcinitcmd " \
Pankit Gargf5c2a832018-12-27 04:37:55 +0000384 "&& fsl_mc lazyapply dpl 0x80001000;" \
385 "run distro_bootcmd;run qspi_bootcmd;" \
386 "env exists secureboot && esbc_halt;"
387#define SD_BOOTCOMMAND \
388 "env exists mcinitcmd && mmcinfo; " \
389 "mmc read 0x80001000 0x6800 0x800; " \
390 "env exists mcinitcmd && env exists secureboot " \
Priyanka Singhf745ae92020-01-22 10:32:34 +0000391 " && mmc read 0x806C0000 0x3600 0x20 " \
392 "&& esbc_validate 0x806C0000;env exists mcinitcmd " \
Pankit Gargf5c2a832018-12-27 04:37:55 +0000393 "&& fsl_mc lazyapply dpl 0x80001000;" \
394 "run distro_bootcmd;run sd_bootcmd;" \
395 "env exists secureboot && esbc_halt;"
396#else
Ashish Kumar2e1fcf32017-11-06 13:19:28 +0530397#if defined(CONFIG_QSPI_BOOT)
398/* Try to boot an on-QSPI kernel first, then do normal distro boot */
Udit Agarwal09fd5792017-11-22 09:01:26 +0530399
Ashish Kumar2e1fcf32017-11-06 13:19:28 +0530400/* Try to boot an on-SD kernel first, then do normal distro boot */
Ashish Kumar227b4bc2017-08-31 16:12:54 +0530401#endif
Pankit Gargf5c2a832018-12-27 04:37:55 +0000402#endif /* CONFIG_TFABOOT */
Ashish Kumar227b4bc2017-08-31 16:12:54 +0530403
404/* MAC/PHY configuration */
405#ifdef CONFIG_FSL_MC_ENET
Ashish Kumar227b4bc2017-08-31 16:12:54 +0530406#define AQ_PHY_ADDR1 0x00
407#define AQR105_IRQ_MASK 0x00000004
408
409#define QSGMII1_PORT1_PHY_ADDR 0x0c
410#define QSGMII1_PORT2_PHY_ADDR 0x0d
411#define QSGMII1_PORT3_PHY_ADDR 0x0e
412#define QSGMII1_PORT4_PHY_ADDR 0x0f
413#define QSGMII2_PORT1_PHY_ADDR 0x1c
414#define QSGMII2_PORT2_PHY_ADDR 0x1d
415#define QSGMII2_PORT3_PHY_ADDR 0x1e
416#define QSGMII2_PORT4_PHY_ADDR 0x1f
Ashish Kumar227b4bc2017-08-31 16:12:54 +0530417#endif
Sumit Garg08da8b22018-01-06 09:04:24 +0530418#endif
Ashish Kumar227b4bc2017-08-31 16:12:54 +0530419
Sumit Garg08da8b22018-01-06 09:04:24 +0530420#ifndef SPL_NO_ENV
Ashish Kumar227b4bc2017-08-31 16:12:54 +0530421
422#define BOOT_TARGET_DEVICES(func) \
Ashish Kumar227b4bc2017-08-31 16:12:54 +0530423 func(MMC, mmc, 0) \
Era Tiwarid07527b2020-05-15 12:48:39 +0530424 func(USB, usb, 0) \
Mian Yousaf Kaukab30a7a632019-01-29 16:38:32 +0100425 func(SCSI, scsi, 0) \
426 func(DHCP, dhcp, na)
Ashish Kumar227b4bc2017-08-31 16:12:54 +0530427#include <config_distro_bootcmd.h>
Sumit Garg08da8b22018-01-06 09:04:24 +0530428#endif
Ashish Kumar227b4bc2017-08-31 16:12:54 +0530429
430#include <asm/fsl_secure_boot.h>
431
432#endif /* __LS1088A_RDB_H */