blob: e49588489c115186cc3d357e05acf668b31b7b7a [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Wang Huanf0ce7d62014-09-05 13:52:44 +08002/*
3 * Copyright 2014 Freescale Semiconductor, Inc.
Biwen Lid15aa9f2019-12-31 15:33:44 +08004 * Copyright 2019 NXP
Wang Huanf0ce7d62014-09-05 13:52:44 +08005 */
6
7#ifndef __CONFIG_H
8#define __CONFIG_H
9
Tom Rini6a5dccc2022-11-16 13:10:41 -050010#define CFG_SYS_INIT_RAM_ADDR OCRAM_BASE_ADDR
11#define CFG_SYS_INIT_RAM_SIZE OCRAM_SIZE
Wang Huanf0ce7d62014-09-05 13:52:44 +080012
Alison Wangab98bb52014-12-09 17:38:14 +080013#ifdef CONFIG_NAND_BOOT
Tom Rinib4213492022-11-12 17:36:51 -050014#define CFG_SYS_NAND_U_BOOT_SIZE (400 << 10)
15#define CFG_SYS_NAND_U_BOOT_DST CONFIG_TEXT_BASE
16#define CFG_SYS_NAND_U_BOOT_START CONFIG_TEXT_BASE
Alison Wangab98bb52014-12-09 17:38:14 +080017
Alison Wangab98bb52014-12-09 17:38:14 +080018#endif
19
Wang Huanf0ce7d62014-09-05 13:52:44 +080020#define SPD_EEPROM_ADDRESS 0x51
Wang Huanf0ce7d62014-09-05 13:52:44 +080021
Tom Rini6a5dccc2022-11-16 13:10:41 -050022#define CFG_SYS_DDR_SDRAM_BASE 0x80000000UL
23#define CFG_SYS_SDRAM_BASE CFG_SYS_DDR_SDRAM_BASE
Wang Huanf0ce7d62014-09-05 13:52:44 +080024
Wang Huanf0ce7d62014-09-05 13:52:44 +080025#ifdef CONFIG_DDR_ECC
Wang Huanf0ce7d62014-09-05 13:52:44 +080026#define CONFIG_MEM_INIT_VALUE 0xdeadbeef
27#endif
28
Wang Huanf0ce7d62014-09-05 13:52:44 +080029/*
30 * IFC Definitions
31 */
Alison Wang34de5e42016-02-02 15:16:23 +080032#if !defined(CONFIG_QSPI_BOOT) && !defined(CONFIG_SD_BOOT_QSPI)
Tom Rini6a5dccc2022-11-16 13:10:41 -050033#define CFG_SYS_FLASH_BASE 0x60000000
34#define CFG_SYS_FLASH_BASE_PHYS CFG_SYS_FLASH_BASE
Wang Huanf0ce7d62014-09-05 13:52:44 +080035
Tom Rini6a5dccc2022-11-16 13:10:41 -050036#define CFG_SYS_NOR0_CSPR_EXT (0x0)
37#define CFG_SYS_NOR0_CSPR (CSPR_PHYS_ADDR(CFG_SYS_FLASH_BASE_PHYS) | \
Wang Huanf0ce7d62014-09-05 13:52:44 +080038 CSPR_PORT_SIZE_16 | \
39 CSPR_MSEL_NOR | \
40 CSPR_V)
Tom Rini6a5dccc2022-11-16 13:10:41 -050041#define CFG_SYS_NOR1_CSPR_EXT (0x0)
42#define CFG_SYS_NOR1_CSPR (CSPR_PHYS_ADDR(CFG_SYS_FLASH_BASE_PHYS \
Wang Huanf0ce7d62014-09-05 13:52:44 +080043 + 0x8000000) | \
44 CSPR_PORT_SIZE_16 | \
45 CSPR_MSEL_NOR | \
46 CSPR_V)
Tom Rini7b577ba2022-11-16 13:10:25 -050047#define CFG_SYS_NOR_AMASK IFC_AMASK(128 * 1024 * 1024)
Wang Huanf0ce7d62014-09-05 13:52:44 +080048
Tom Rini7b577ba2022-11-16 13:10:25 -050049#define CFG_SYS_NOR_CSOR (CSOR_NOR_ADM_SHIFT(4) | \
Wang Huanf0ce7d62014-09-05 13:52:44 +080050 CSOR_NOR_TRHZ_80)
Tom Rini7b577ba2022-11-16 13:10:25 -050051#define CFG_SYS_NOR_FTIM0 (FTIM0_NOR_TACSE(0x4) | \
Wang Huanf0ce7d62014-09-05 13:52:44 +080052 FTIM0_NOR_TEADC(0x5) | \
53 FTIM0_NOR_TEAHC(0x5))
Tom Rini7b577ba2022-11-16 13:10:25 -050054#define CFG_SYS_NOR_FTIM1 (FTIM1_NOR_TACO(0x35) | \
Wang Huanf0ce7d62014-09-05 13:52:44 +080055 FTIM1_NOR_TRAD_NOR(0x1a) | \
56 FTIM1_NOR_TSEQRAD_NOR(0x13))
Tom Rini7b577ba2022-11-16 13:10:25 -050057#define CFG_SYS_NOR_FTIM2 (FTIM2_NOR_TCS(0x4) | \
Wang Huanf0ce7d62014-09-05 13:52:44 +080058 FTIM2_NOR_TCH(0x4) | \
59 FTIM2_NOR_TWPH(0xe) | \
60 FTIM2_NOR_TWP(0x1c))
Tom Rini7b577ba2022-11-16 13:10:25 -050061#define CFG_SYS_NOR_FTIM3 0
Wang Huanf0ce7d62014-09-05 13:52:44 +080062
Tom Rini6a5dccc2022-11-16 13:10:41 -050063#define CFG_SYS_WRITE_SWAPPED_DATA
Wang Huanf0ce7d62014-09-05 13:52:44 +080064
Tom Rini6a5dccc2022-11-16 13:10:41 -050065#define CFG_SYS_FLASH_BANKS_LIST {CFG_SYS_FLASH_BASE_PHYS, \
66 CFG_SYS_FLASH_BASE_PHYS + 0x8000000}
Wang Huanf0ce7d62014-09-05 13:52:44 +080067
68/*
69 * NAND Flash Definitions
70 */
Wang Huanf0ce7d62014-09-05 13:52:44 +080071
Tom Rinib4213492022-11-12 17:36:51 -050072#define CFG_SYS_NAND_BASE 0x7e800000
73#define CFG_SYS_NAND_BASE_PHYS CFG_SYS_NAND_BASE
Wang Huanf0ce7d62014-09-05 13:52:44 +080074
Tom Rinib4213492022-11-12 17:36:51 -050075#define CFG_SYS_NAND_CSPR_EXT (0x0)
Wang Huanf0ce7d62014-09-05 13:52:44 +080076
Tom Rinib4213492022-11-12 17:36:51 -050077#define CFG_SYS_NAND_CSPR (CSPR_PHYS_ADDR(CFG_SYS_NAND_BASE_PHYS) \
Wang Huanf0ce7d62014-09-05 13:52:44 +080078 | CSPR_PORT_SIZE_8 \
79 | CSPR_MSEL_NAND \
80 | CSPR_V)
Tom Rinib4213492022-11-12 17:36:51 -050081#define CFG_SYS_NAND_AMASK IFC_AMASK(64*1024)
82#define CFG_SYS_NAND_CSOR (CSOR_NAND_ECC_ENC_EN /* ECC on encode */ \
Wang Huanf0ce7d62014-09-05 13:52:44 +080083 | CSOR_NAND_ECC_DEC_EN /* ECC on decode */ \
84 | CSOR_NAND_ECC_MODE_4 /* 4-bit ECC */ \
85 | CSOR_NAND_RAL_3 /* RAL = 3 Bytes */ \
86 | CSOR_NAND_PGS_2K /* Page Size = 2K */ \
87 | CSOR_NAND_SPRZ_64 /* Spare size = 64 */ \
88 | CSOR_NAND_PB(64)) /* 64 Pages Per Block */
89
Tom Rinib4213492022-11-12 17:36:51 -050090#define CFG_SYS_NAND_FTIM0 (FTIM0_NAND_TCCST(0x7) | \
Wang Huanf0ce7d62014-09-05 13:52:44 +080091 FTIM0_NAND_TWP(0x18) | \
92 FTIM0_NAND_TWCHT(0x7) | \
93 FTIM0_NAND_TWH(0xa))
Tom Rinib4213492022-11-12 17:36:51 -050094#define CFG_SYS_NAND_FTIM1 (FTIM1_NAND_TADLE(0x32) | \
Wang Huanf0ce7d62014-09-05 13:52:44 +080095 FTIM1_NAND_TWBE(0x39) | \
96 FTIM1_NAND_TRR(0xe) | \
97 FTIM1_NAND_TRP(0x18))
Tom Rinib4213492022-11-12 17:36:51 -050098#define CFG_SYS_NAND_FTIM2 (FTIM2_NAND_TRAD(0xf) | \
Wang Huanf0ce7d62014-09-05 13:52:44 +080099 FTIM2_NAND_TREH(0xa) | \
100 FTIM2_NAND_TWHRE(0x1e))
Tom Rinib4213492022-11-12 17:36:51 -0500101#define CFG_SYS_NAND_FTIM3 0x0
Wang Huanf0ce7d62014-09-05 13:52:44 +0800102
Tom Rinib4213492022-11-12 17:36:51 -0500103#define CFG_SYS_NAND_BASE_LIST { CFG_SYS_NAND_BASE }
Alison Wang2145a372014-12-09 17:38:02 +0800104#endif
Wang Huanf0ce7d62014-09-05 13:52:44 +0800105
106/*
107 * QIXIS Definitions
108 */
Wang Huanf0ce7d62014-09-05 13:52:44 +0800109
110#ifdef CONFIG_FSL_QIXIS
111#define QIXIS_BASE 0x7fb00000
112#define QIXIS_BASE_PHYS QIXIS_BASE
Tom Rini6a5dccc2022-11-16 13:10:41 -0500113#define CFG_SYS_I2C_FPGA_ADDR 0x66
Wang Huanf0ce7d62014-09-05 13:52:44 +0800114#define QIXIS_LBMAP_SWITCH 6
115#define QIXIS_LBMAP_MASK 0x0f
116#define QIXIS_LBMAP_SHIFT 0
117#define QIXIS_LBMAP_DFLTBANK 0x00
118#define QIXIS_LBMAP_ALTBANK 0x04
Hongbo Zhang4f6e6102016-07-21 18:09:38 +0800119#define QIXIS_PWR_CTL 0x21
120#define QIXIS_PWR_CTL_POWEROFF 0x80
Wang Huanf0ce7d62014-09-05 13:52:44 +0800121#define QIXIS_RST_CTL_RESET 0x44
122#define QIXIS_RCFG_CTL_RECONFIG_IDLE 0x20
123#define QIXIS_RCFG_CTL_RECONFIG_START 0x21
124#define QIXIS_RCFG_CTL_WATCHDOG_ENBLE 0x08
Hongbo Zhangf253bbd2016-08-19 17:20:31 +0800125#define QIXIS_CTL_SYS 0x5
126#define QIXIS_CTL_SYS_EVTSW_MASK 0x0c
127#define QIXIS_CTL_SYS_EVTSW_IRQ 0x04
128#define QIXIS_RST_FORCE_3 0x45
129#define QIXIS_RST_FORCE_3_PCIESLOT1 0x80
130#define QIXIS_PWR_CTL2 0x21
131#define QIXIS_PWR_CTL2_PCTL 0x2
Wang Huanf0ce7d62014-09-05 13:52:44 +0800132
Tom Rini6a5dccc2022-11-16 13:10:41 -0500133#define CFG_SYS_FPGA_CSPR_EXT (0x0)
134#define CFG_SYS_FPGA_CSPR (CSPR_PHYS_ADDR(QIXIS_BASE_PHYS) | \
Wang Huanf0ce7d62014-09-05 13:52:44 +0800135 CSPR_PORT_SIZE_8 | \
136 CSPR_MSEL_GPCM | \
137 CSPR_V)
Tom Rini6a5dccc2022-11-16 13:10:41 -0500138#define CFG_SYS_FPGA_AMASK IFC_AMASK(64 * 1024)
139#define CFG_SYS_FPGA_CSOR (CSOR_NOR_ADM_SHIFT(4) | \
Wang Huanf0ce7d62014-09-05 13:52:44 +0800140 CSOR_NOR_NOR_MODE_AVD_NOR | \
141 CSOR_NOR_TRHZ_80)
142
143/*
144 * QIXIS Timing parameters for IFC GPCM
145 */
Tom Rini6a5dccc2022-11-16 13:10:41 -0500146#define CFG_SYS_FPGA_FTIM0 (FTIM0_GPCM_TACSE(0xe) | \
Wang Huanf0ce7d62014-09-05 13:52:44 +0800147 FTIM0_GPCM_TEADC(0xe) | \
148 FTIM0_GPCM_TEAHC(0xe))
Tom Rini6a5dccc2022-11-16 13:10:41 -0500149#define CFG_SYS_FPGA_FTIM1 (FTIM1_GPCM_TACO(0xe) | \
Wang Huanf0ce7d62014-09-05 13:52:44 +0800150 FTIM1_GPCM_TRAD(0x1f))
Tom Rini6a5dccc2022-11-16 13:10:41 -0500151#define CFG_SYS_FPGA_FTIM2 (FTIM2_GPCM_TCS(0xe) | \
Wang Huanf0ce7d62014-09-05 13:52:44 +0800152 FTIM2_GPCM_TCH(0xe) | \
153 FTIM2_GPCM_TWP(0xf0))
Tom Rini6a5dccc2022-11-16 13:10:41 -0500154#define CFG_SYS_FPGA_FTIM3 0x0
Wang Huanf0ce7d62014-09-05 13:52:44 +0800155#endif
156
Alison Wangab98bb52014-12-09 17:38:14 +0800157#if defined(CONFIG_NAND_BOOT)
Tom Rini6a5dccc2022-11-16 13:10:41 -0500158#define CFG_SYS_CSPR0_EXT CFG_SYS_NAND_CSPR_EXT
159#define CFG_SYS_CSPR0 CFG_SYS_NAND_CSPR
160#define CFG_SYS_AMASK0 CFG_SYS_NAND_AMASK
161#define CFG_SYS_CSOR0 CFG_SYS_NAND_CSOR
162#define CFG_SYS_CS0_FTIM0 CFG_SYS_NAND_FTIM0
163#define CFG_SYS_CS0_FTIM1 CFG_SYS_NAND_FTIM1
164#define CFG_SYS_CS0_FTIM2 CFG_SYS_NAND_FTIM2
165#define CFG_SYS_CS0_FTIM3 CFG_SYS_NAND_FTIM3
166#define CFG_SYS_CSPR1_EXT CFG_SYS_NOR0_CSPR_EXT
167#define CFG_SYS_CSPR1 CFG_SYS_NOR0_CSPR
168#define CFG_SYS_AMASK1 CFG_SYS_NOR_AMASK
169#define CFG_SYS_CSOR1 CFG_SYS_NOR_CSOR
170#define CFG_SYS_CS1_FTIM0 CFG_SYS_NOR_FTIM0
171#define CFG_SYS_CS1_FTIM1 CFG_SYS_NOR_FTIM1
172#define CFG_SYS_CS1_FTIM2 CFG_SYS_NOR_FTIM2
173#define CFG_SYS_CS1_FTIM3 CFG_SYS_NOR_FTIM3
174#define CFG_SYS_CSPR2_EXT CFG_SYS_NOR1_CSPR_EXT
175#define CFG_SYS_CSPR2 CFG_SYS_NOR1_CSPR
176#define CFG_SYS_AMASK2 CFG_SYS_NOR_AMASK
177#define CFG_SYS_CSOR2 CFG_SYS_NOR_CSOR
178#define CFG_SYS_CS2_FTIM0 CFG_SYS_NOR_FTIM0
179#define CFG_SYS_CS2_FTIM1 CFG_SYS_NOR_FTIM1
180#define CFG_SYS_CS2_FTIM2 CFG_SYS_NOR_FTIM2
181#define CFG_SYS_CS2_FTIM3 CFG_SYS_NOR_FTIM3
182#define CFG_SYS_CSPR3_EXT CFG_SYS_FPGA_CSPR_EXT
183#define CFG_SYS_CSPR3 CFG_SYS_FPGA_CSPR
184#define CFG_SYS_AMASK3 CFG_SYS_FPGA_AMASK
185#define CFG_SYS_CSOR3 CFG_SYS_FPGA_CSOR
186#define CFG_SYS_CS3_FTIM0 CFG_SYS_FPGA_FTIM0
187#define CFG_SYS_CS3_FTIM1 CFG_SYS_FPGA_FTIM1
188#define CFG_SYS_CS3_FTIM2 CFG_SYS_FPGA_FTIM2
189#define CFG_SYS_CS3_FTIM3 CFG_SYS_FPGA_FTIM3
Alison Wangab98bb52014-12-09 17:38:14 +0800190#else
Tom Rini6a5dccc2022-11-16 13:10:41 -0500191#define CFG_SYS_CSPR0_EXT CFG_SYS_NOR0_CSPR_EXT
192#define CFG_SYS_CSPR0 CFG_SYS_NOR0_CSPR
193#define CFG_SYS_AMASK0 CFG_SYS_NOR_AMASK
194#define CFG_SYS_CSOR0 CFG_SYS_NOR_CSOR
195#define CFG_SYS_CS0_FTIM0 CFG_SYS_NOR_FTIM0
196#define CFG_SYS_CS0_FTIM1 CFG_SYS_NOR_FTIM1
197#define CFG_SYS_CS0_FTIM2 CFG_SYS_NOR_FTIM2
198#define CFG_SYS_CS0_FTIM3 CFG_SYS_NOR_FTIM3
199#define CFG_SYS_CSPR1_EXT CFG_SYS_NOR1_CSPR_EXT
200#define CFG_SYS_CSPR1 CFG_SYS_NOR1_CSPR
201#define CFG_SYS_AMASK1 CFG_SYS_NOR_AMASK
202#define CFG_SYS_CSOR1 CFG_SYS_NOR_CSOR
203#define CFG_SYS_CS1_FTIM0 CFG_SYS_NOR_FTIM0
204#define CFG_SYS_CS1_FTIM1 CFG_SYS_NOR_FTIM1
205#define CFG_SYS_CS1_FTIM2 CFG_SYS_NOR_FTIM2
206#define CFG_SYS_CS1_FTIM3 CFG_SYS_NOR_FTIM3
207#define CFG_SYS_CSPR2_EXT CFG_SYS_NAND_CSPR_EXT
208#define CFG_SYS_CSPR2 CFG_SYS_NAND_CSPR
209#define CFG_SYS_AMASK2 CFG_SYS_NAND_AMASK
210#define CFG_SYS_CSOR2 CFG_SYS_NAND_CSOR
211#define CFG_SYS_CS2_FTIM0 CFG_SYS_NAND_FTIM0
212#define CFG_SYS_CS2_FTIM1 CFG_SYS_NAND_FTIM1
213#define CFG_SYS_CS2_FTIM2 CFG_SYS_NAND_FTIM2
214#define CFG_SYS_CS2_FTIM3 CFG_SYS_NAND_FTIM3
215#define CFG_SYS_CSPR3_EXT CFG_SYS_FPGA_CSPR_EXT
216#define CFG_SYS_CSPR3 CFG_SYS_FPGA_CSPR
217#define CFG_SYS_AMASK3 CFG_SYS_FPGA_AMASK
218#define CFG_SYS_CSOR3 CFG_SYS_FPGA_CSOR
219#define CFG_SYS_CS3_FTIM0 CFG_SYS_FPGA_FTIM0
220#define CFG_SYS_CS3_FTIM1 CFG_SYS_FPGA_FTIM1
221#define CFG_SYS_CS3_FTIM2 CFG_SYS_FPGA_FTIM2
222#define CFG_SYS_CS3_FTIM3 CFG_SYS_FPGA_FTIM3
Alison Wangab98bb52014-12-09 17:38:14 +0800223#endif
Wang Huanf0ce7d62014-09-05 13:52:44 +0800224
225/*
226 * Serial Port
227 */
Tom Rini037415a2022-03-23 17:20:00 -0400228#ifndef CONFIG_LPUART
Tom Rinidf6a2152022-11-16 13:10:28 -0500229#define CFG_SYS_NS16550_CLK get_serial_clock()
Alison Wange2f33ae2015-01-04 15:30:58 +0800230#endif
Wang Huanf0ce7d62014-09-05 13:52:44 +0800231
Wang Huanf0ce7d62014-09-05 13:52:44 +0800232/*
233 * I2C
234 */
Wang Huanf0ce7d62014-09-05 13:52:44 +0800235
Biwen Li4b451fd2021-02-05 19:02:03 +0800236/* GPIO */
Biwen Li4b451fd2021-02-05 19:02:03 +0800237
Wang Huanf0ce7d62014-09-05 13:52:44 +0800238/*
239 * I2C bus multiplexer
240 */
241#define I2C_MUX_PCA_ADDR_PRI 0x77
242#define I2C_MUX_CH_DEFAULT 0x8
Xiubo Li27e2fe62014-12-16 14:50:33 +0800243#define I2C_MUX_CH_CH7301 0xC
Wang Huanf0ce7d62014-09-05 13:52:44 +0800244
245/*
246 * MMC
247 */
Wang Huanf0ce7d62014-09-05 13:52:44 +0800248
Xiubo Li563e3ce2014-11-21 17:40:57 +0800249#define CONFIG_PEN_ADDR_BIG_ENDIAN
250#define CONFIG_SMP_PEN_ADDR 0x01ee0200
Xiubo Li563e3ce2014-11-21 17:40:57 +0800251
Zhuoyu Zhangfe4f2882015-08-17 18:55:12 +0800252#define HWCONFIG_BUFFER_SIZE 256
253
Alison Wange2f33ae2015-01-04 15:30:58 +0800254#ifdef CONFIG_LPUART
255#define CONFIG_EXTRA_ENV_SETTINGS \
256 "bootargs=root=/dev/ram0 rw console=ttyLP0,115200\0" \
Alison Wangf6370242015-11-05 11:16:26 +0800257 "initrd_high=0xffffffff\0" \
Alison Wange2f33ae2015-01-04 15:30:58 +0800258 "hwconfig=fsl_ddr:ctlr_intlv=null,bank_intlv=null\0"
259#else
Wang Huanf0ce7d62014-09-05 13:52:44 +0800260#define CONFIG_EXTRA_ENV_SETTINGS \
261 "bootargs=root=/dev/ram0 rw console=ttyS0,115200\0" \
Alison Wangf6370242015-11-05 11:16:26 +0800262 "initrd_high=0xffffffff\0" \
Wang Huanf0ce7d62014-09-05 13:52:44 +0800263 "hwconfig=fsl_ddr:ctlr_intlv=null,bank_intlv=null\0"
Alison Wange2f33ae2015-01-04 15:30:58 +0800264#endif
Wang Huanf0ce7d62014-09-05 13:52:44 +0800265
266/*
267 * Miscellaneous configurable options
268 */
Tom Rini6a5dccc2022-11-16 13:10:41 -0500269#define CFG_SYS_BOOTMAPSZ (256 << 20)
Wang Huanf0ce7d62014-09-05 13:52:44 +0800270
Wang Huanf0ce7d62014-09-05 13:52:44 +0800271/*
272 * Environment
273 */
Wang Huanf0ce7d62014-09-05 13:52:44 +0800274
Aneesh Bansal962021a2016-01-22 16:37:22 +0530275#include <asm/fsl_secure_boot.h>
Ruchika Gupta901ae762014-10-15 11:39:06 +0530276
Wang Huanf0ce7d62014-09-05 13:52:44 +0800277#endif