blob: e4e5522a238415bdf83f95e2f2e3a9f3fa93f600 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Wang Huan550e3dc2014-09-05 13:52:44 +08002/*
3 * Copyright 2014 Freescale Semiconductor, Inc.
Biwen Li9ebde882019-12-31 15:33:44 +08004 * Copyright 2019 NXP
Wang Huan550e3dc2014-09-05 13:52:44 +08005 */
6
7#ifndef __CONFIG_H
8#define __CONFIG_H
9
Tom Rini65cc0e22022-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 Huan550e3dc2014-09-05 13:52:44 +080012
Alison Wang8ab967b2014-12-09 17:38:14 +080013#ifdef CONFIG_NAND_BOOT
Tom Rini4e590942022-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 Wang8ab967b2014-12-09 17:38:14 +080017
Alison Wang8ab967b2014-12-09 17:38:14 +080018#endif
19
Wang Huan550e3dc2014-09-05 13:52:44 +080020#define SPD_EEPROM_ADDRESS 0x51
Wang Huan550e3dc2014-09-05 13:52:44 +080021
Tom Rini65cc0e22022-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 Huan550e3dc2014-09-05 13:52:44 +080024
Wang Huan550e3dc2014-09-05 13:52:44 +080025/*
26 * IFC Definitions
27 */
Alison Wang70097022016-02-02 15:16:23 +080028#if !defined(CONFIG_QSPI_BOOT) && !defined(CONFIG_SD_BOOT_QSPI)
Tom Rini65cc0e22022-11-16 13:10:41 -050029#define CFG_SYS_FLASH_BASE 0x60000000
30#define CFG_SYS_FLASH_BASE_PHYS CFG_SYS_FLASH_BASE
Wang Huan550e3dc2014-09-05 13:52:44 +080031
Tom Rini65cc0e22022-11-16 13:10:41 -050032#define CFG_SYS_NOR0_CSPR_EXT (0x0)
33#define CFG_SYS_NOR0_CSPR (CSPR_PHYS_ADDR(CFG_SYS_FLASH_BASE_PHYS) | \
Wang Huan550e3dc2014-09-05 13:52:44 +080034 CSPR_PORT_SIZE_16 | \
35 CSPR_MSEL_NOR | \
36 CSPR_V)
Tom Rini65cc0e22022-11-16 13:10:41 -050037#define CFG_SYS_NOR1_CSPR_EXT (0x0)
38#define CFG_SYS_NOR1_CSPR (CSPR_PHYS_ADDR(CFG_SYS_FLASH_BASE_PHYS \
Wang Huan550e3dc2014-09-05 13:52:44 +080039 + 0x8000000) | \
40 CSPR_PORT_SIZE_16 | \
41 CSPR_MSEL_NOR | \
42 CSPR_V)
Tom Rini0ed384f2022-11-16 13:10:25 -050043#define CFG_SYS_NOR_AMASK IFC_AMASK(128 * 1024 * 1024)
Wang Huan550e3dc2014-09-05 13:52:44 +080044
Tom Rini0ed384f2022-11-16 13:10:25 -050045#define CFG_SYS_NOR_CSOR (CSOR_NOR_ADM_SHIFT(4) | \
Wang Huan550e3dc2014-09-05 13:52:44 +080046 CSOR_NOR_TRHZ_80)
Tom Rini0ed384f2022-11-16 13:10:25 -050047#define CFG_SYS_NOR_FTIM0 (FTIM0_NOR_TACSE(0x4) | \
Wang Huan550e3dc2014-09-05 13:52:44 +080048 FTIM0_NOR_TEADC(0x5) | \
49 FTIM0_NOR_TEAHC(0x5))
Tom Rini0ed384f2022-11-16 13:10:25 -050050#define CFG_SYS_NOR_FTIM1 (FTIM1_NOR_TACO(0x35) | \
Wang Huan550e3dc2014-09-05 13:52:44 +080051 FTIM1_NOR_TRAD_NOR(0x1a) | \
52 FTIM1_NOR_TSEQRAD_NOR(0x13))
Tom Rini0ed384f2022-11-16 13:10:25 -050053#define CFG_SYS_NOR_FTIM2 (FTIM2_NOR_TCS(0x4) | \
Wang Huan550e3dc2014-09-05 13:52:44 +080054 FTIM2_NOR_TCH(0x4) | \
55 FTIM2_NOR_TWPH(0xe) | \
56 FTIM2_NOR_TWP(0x1c))
Tom Rini0ed384f2022-11-16 13:10:25 -050057#define CFG_SYS_NOR_FTIM3 0
Wang Huan550e3dc2014-09-05 13:52:44 +080058
Tom Rini65cc0e22022-11-16 13:10:41 -050059#define CFG_SYS_WRITE_SWAPPED_DATA
Wang Huan550e3dc2014-09-05 13:52:44 +080060
Tom Rini65cc0e22022-11-16 13:10:41 -050061#define CFG_SYS_FLASH_BANKS_LIST {CFG_SYS_FLASH_BASE_PHYS, \
62 CFG_SYS_FLASH_BASE_PHYS + 0x8000000}
Wang Huan550e3dc2014-09-05 13:52:44 +080063
64/*
65 * NAND Flash Definitions
66 */
Wang Huan550e3dc2014-09-05 13:52:44 +080067
Tom Rini4e590942022-11-12 17:36:51 -050068#define CFG_SYS_NAND_BASE 0x7e800000
69#define CFG_SYS_NAND_BASE_PHYS CFG_SYS_NAND_BASE
Wang Huan550e3dc2014-09-05 13:52:44 +080070
Tom Rini4e590942022-11-12 17:36:51 -050071#define CFG_SYS_NAND_CSPR_EXT (0x0)
Wang Huan550e3dc2014-09-05 13:52:44 +080072
Tom Rini4e590942022-11-12 17:36:51 -050073#define CFG_SYS_NAND_CSPR (CSPR_PHYS_ADDR(CFG_SYS_NAND_BASE_PHYS) \
Wang Huan550e3dc2014-09-05 13:52:44 +080074 | CSPR_PORT_SIZE_8 \
75 | CSPR_MSEL_NAND \
76 | CSPR_V)
Tom Rini4e590942022-11-12 17:36:51 -050077#define CFG_SYS_NAND_AMASK IFC_AMASK(64*1024)
78#define CFG_SYS_NAND_CSOR (CSOR_NAND_ECC_ENC_EN /* ECC on encode */ \
Wang Huan550e3dc2014-09-05 13:52:44 +080079 | CSOR_NAND_ECC_DEC_EN /* ECC on decode */ \
80 | CSOR_NAND_ECC_MODE_4 /* 4-bit ECC */ \
81 | CSOR_NAND_RAL_3 /* RAL = 3 Bytes */ \
82 | CSOR_NAND_PGS_2K /* Page Size = 2K */ \
83 | CSOR_NAND_SPRZ_64 /* Spare size = 64 */ \
84 | CSOR_NAND_PB(64)) /* 64 Pages Per Block */
85
Tom Rini4e590942022-11-12 17:36:51 -050086#define CFG_SYS_NAND_FTIM0 (FTIM0_NAND_TCCST(0x7) | \
Wang Huan550e3dc2014-09-05 13:52:44 +080087 FTIM0_NAND_TWP(0x18) | \
88 FTIM0_NAND_TWCHT(0x7) | \
89 FTIM0_NAND_TWH(0xa))
Tom Rini4e590942022-11-12 17:36:51 -050090#define CFG_SYS_NAND_FTIM1 (FTIM1_NAND_TADLE(0x32) | \
Wang Huan550e3dc2014-09-05 13:52:44 +080091 FTIM1_NAND_TWBE(0x39) | \
92 FTIM1_NAND_TRR(0xe) | \
93 FTIM1_NAND_TRP(0x18))
Tom Rini4e590942022-11-12 17:36:51 -050094#define CFG_SYS_NAND_FTIM2 (FTIM2_NAND_TRAD(0xf) | \
Wang Huan550e3dc2014-09-05 13:52:44 +080095 FTIM2_NAND_TREH(0xa) | \
96 FTIM2_NAND_TWHRE(0x1e))
Tom Rini4e590942022-11-12 17:36:51 -050097#define CFG_SYS_NAND_FTIM3 0x0
Wang Huan550e3dc2014-09-05 13:52:44 +080098
Tom Rini4e590942022-11-12 17:36:51 -050099#define CFG_SYS_NAND_BASE_LIST { CFG_SYS_NAND_BASE }
Alison Wangd612f0a2014-12-09 17:38:02 +0800100#endif
Wang Huan550e3dc2014-09-05 13:52:44 +0800101
102/*
103 * QIXIS Definitions
104 */
Wang Huan550e3dc2014-09-05 13:52:44 +0800105
106#ifdef CONFIG_FSL_QIXIS
107#define QIXIS_BASE 0x7fb00000
108#define QIXIS_BASE_PHYS QIXIS_BASE
Tom Rini65cc0e22022-11-16 13:10:41 -0500109#define CFG_SYS_I2C_FPGA_ADDR 0x66
Wang Huan550e3dc2014-09-05 13:52:44 +0800110#define QIXIS_LBMAP_SWITCH 6
111#define QIXIS_LBMAP_MASK 0x0f
112#define QIXIS_LBMAP_SHIFT 0
113#define QIXIS_LBMAP_DFLTBANK 0x00
114#define QIXIS_LBMAP_ALTBANK 0x04
Hongbo Zhangaeb901f2016-07-21 18:09:38 +0800115#define QIXIS_PWR_CTL 0x21
116#define QIXIS_PWR_CTL_POWEROFF 0x80
Wang Huan550e3dc2014-09-05 13:52:44 +0800117#define QIXIS_RST_CTL_RESET 0x44
118#define QIXIS_RCFG_CTL_RECONFIG_IDLE 0x20
119#define QIXIS_RCFG_CTL_RECONFIG_START 0x21
120#define QIXIS_RCFG_CTL_WATCHDOG_ENBLE 0x08
Hongbo Zhang349cfc92016-08-19 17:20:31 +0800121#define QIXIS_CTL_SYS 0x5
122#define QIXIS_CTL_SYS_EVTSW_MASK 0x0c
123#define QIXIS_CTL_SYS_EVTSW_IRQ 0x04
124#define QIXIS_RST_FORCE_3 0x45
125#define QIXIS_RST_FORCE_3_PCIESLOT1 0x80
126#define QIXIS_PWR_CTL2 0x21
127#define QIXIS_PWR_CTL2_PCTL 0x2
Wang Huan550e3dc2014-09-05 13:52:44 +0800128
Tom Rini65cc0e22022-11-16 13:10:41 -0500129#define CFG_SYS_FPGA_CSPR_EXT (0x0)
130#define CFG_SYS_FPGA_CSPR (CSPR_PHYS_ADDR(QIXIS_BASE_PHYS) | \
Wang Huan550e3dc2014-09-05 13:52:44 +0800131 CSPR_PORT_SIZE_8 | \
132 CSPR_MSEL_GPCM | \
133 CSPR_V)
Tom Rini65cc0e22022-11-16 13:10:41 -0500134#define CFG_SYS_FPGA_AMASK IFC_AMASK(64 * 1024)
135#define CFG_SYS_FPGA_CSOR (CSOR_NOR_ADM_SHIFT(4) | \
Wang Huan550e3dc2014-09-05 13:52:44 +0800136 CSOR_NOR_NOR_MODE_AVD_NOR | \
137 CSOR_NOR_TRHZ_80)
138
139/*
140 * QIXIS Timing parameters for IFC GPCM
141 */
Tom Rini65cc0e22022-11-16 13:10:41 -0500142#define CFG_SYS_FPGA_FTIM0 (FTIM0_GPCM_TACSE(0xe) | \
Wang Huan550e3dc2014-09-05 13:52:44 +0800143 FTIM0_GPCM_TEADC(0xe) | \
144 FTIM0_GPCM_TEAHC(0xe))
Tom Rini65cc0e22022-11-16 13:10:41 -0500145#define CFG_SYS_FPGA_FTIM1 (FTIM1_GPCM_TACO(0xe) | \
Wang Huan550e3dc2014-09-05 13:52:44 +0800146 FTIM1_GPCM_TRAD(0x1f))
Tom Rini65cc0e22022-11-16 13:10:41 -0500147#define CFG_SYS_FPGA_FTIM2 (FTIM2_GPCM_TCS(0xe) | \
Wang Huan550e3dc2014-09-05 13:52:44 +0800148 FTIM2_GPCM_TCH(0xe) | \
149 FTIM2_GPCM_TWP(0xf0))
Tom Rini65cc0e22022-11-16 13:10:41 -0500150#define CFG_SYS_FPGA_FTIM3 0x0
Wang Huan550e3dc2014-09-05 13:52:44 +0800151#endif
152
Alison Wang8ab967b2014-12-09 17:38:14 +0800153#if defined(CONFIG_NAND_BOOT)
Tom Rini65cc0e22022-11-16 13:10:41 -0500154#define CFG_SYS_CSPR0_EXT CFG_SYS_NAND_CSPR_EXT
155#define CFG_SYS_CSPR0 CFG_SYS_NAND_CSPR
156#define CFG_SYS_AMASK0 CFG_SYS_NAND_AMASK
157#define CFG_SYS_CSOR0 CFG_SYS_NAND_CSOR
158#define CFG_SYS_CS0_FTIM0 CFG_SYS_NAND_FTIM0
159#define CFG_SYS_CS0_FTIM1 CFG_SYS_NAND_FTIM1
160#define CFG_SYS_CS0_FTIM2 CFG_SYS_NAND_FTIM2
161#define CFG_SYS_CS0_FTIM3 CFG_SYS_NAND_FTIM3
162#define CFG_SYS_CSPR1_EXT CFG_SYS_NOR0_CSPR_EXT
163#define CFG_SYS_CSPR1 CFG_SYS_NOR0_CSPR
164#define CFG_SYS_AMASK1 CFG_SYS_NOR_AMASK
165#define CFG_SYS_CSOR1 CFG_SYS_NOR_CSOR
166#define CFG_SYS_CS1_FTIM0 CFG_SYS_NOR_FTIM0
167#define CFG_SYS_CS1_FTIM1 CFG_SYS_NOR_FTIM1
168#define CFG_SYS_CS1_FTIM2 CFG_SYS_NOR_FTIM2
169#define CFG_SYS_CS1_FTIM3 CFG_SYS_NOR_FTIM3
170#define CFG_SYS_CSPR2_EXT CFG_SYS_NOR1_CSPR_EXT
171#define CFG_SYS_CSPR2 CFG_SYS_NOR1_CSPR
172#define CFG_SYS_AMASK2 CFG_SYS_NOR_AMASK
173#define CFG_SYS_CSOR2 CFG_SYS_NOR_CSOR
174#define CFG_SYS_CS2_FTIM0 CFG_SYS_NOR_FTIM0
175#define CFG_SYS_CS2_FTIM1 CFG_SYS_NOR_FTIM1
176#define CFG_SYS_CS2_FTIM2 CFG_SYS_NOR_FTIM2
177#define CFG_SYS_CS2_FTIM3 CFG_SYS_NOR_FTIM3
178#define CFG_SYS_CSPR3_EXT CFG_SYS_FPGA_CSPR_EXT
179#define CFG_SYS_CSPR3 CFG_SYS_FPGA_CSPR
180#define CFG_SYS_AMASK3 CFG_SYS_FPGA_AMASK
181#define CFG_SYS_CSOR3 CFG_SYS_FPGA_CSOR
182#define CFG_SYS_CS3_FTIM0 CFG_SYS_FPGA_FTIM0
183#define CFG_SYS_CS3_FTIM1 CFG_SYS_FPGA_FTIM1
184#define CFG_SYS_CS3_FTIM2 CFG_SYS_FPGA_FTIM2
185#define CFG_SYS_CS3_FTIM3 CFG_SYS_FPGA_FTIM3
Alison Wang8ab967b2014-12-09 17:38:14 +0800186#else
Tom Rini65cc0e22022-11-16 13:10:41 -0500187#define CFG_SYS_CSPR0_EXT CFG_SYS_NOR0_CSPR_EXT
188#define CFG_SYS_CSPR0 CFG_SYS_NOR0_CSPR
189#define CFG_SYS_AMASK0 CFG_SYS_NOR_AMASK
190#define CFG_SYS_CSOR0 CFG_SYS_NOR_CSOR
191#define CFG_SYS_CS0_FTIM0 CFG_SYS_NOR_FTIM0
192#define CFG_SYS_CS0_FTIM1 CFG_SYS_NOR_FTIM1
193#define CFG_SYS_CS0_FTIM2 CFG_SYS_NOR_FTIM2
194#define CFG_SYS_CS0_FTIM3 CFG_SYS_NOR_FTIM3
195#define CFG_SYS_CSPR1_EXT CFG_SYS_NOR1_CSPR_EXT
196#define CFG_SYS_CSPR1 CFG_SYS_NOR1_CSPR
197#define CFG_SYS_AMASK1 CFG_SYS_NOR_AMASK
198#define CFG_SYS_CSOR1 CFG_SYS_NOR_CSOR
199#define CFG_SYS_CS1_FTIM0 CFG_SYS_NOR_FTIM0
200#define CFG_SYS_CS1_FTIM1 CFG_SYS_NOR_FTIM1
201#define CFG_SYS_CS1_FTIM2 CFG_SYS_NOR_FTIM2
202#define CFG_SYS_CS1_FTIM3 CFG_SYS_NOR_FTIM3
203#define CFG_SYS_CSPR2_EXT CFG_SYS_NAND_CSPR_EXT
204#define CFG_SYS_CSPR2 CFG_SYS_NAND_CSPR
205#define CFG_SYS_AMASK2 CFG_SYS_NAND_AMASK
206#define CFG_SYS_CSOR2 CFG_SYS_NAND_CSOR
207#define CFG_SYS_CS2_FTIM0 CFG_SYS_NAND_FTIM0
208#define CFG_SYS_CS2_FTIM1 CFG_SYS_NAND_FTIM1
209#define CFG_SYS_CS2_FTIM2 CFG_SYS_NAND_FTIM2
210#define CFG_SYS_CS2_FTIM3 CFG_SYS_NAND_FTIM3
211#define CFG_SYS_CSPR3_EXT CFG_SYS_FPGA_CSPR_EXT
212#define CFG_SYS_CSPR3 CFG_SYS_FPGA_CSPR
213#define CFG_SYS_AMASK3 CFG_SYS_FPGA_AMASK
214#define CFG_SYS_CSOR3 CFG_SYS_FPGA_CSOR
215#define CFG_SYS_CS3_FTIM0 CFG_SYS_FPGA_FTIM0
216#define CFG_SYS_CS3_FTIM1 CFG_SYS_FPGA_FTIM1
217#define CFG_SYS_CS3_FTIM2 CFG_SYS_FPGA_FTIM2
218#define CFG_SYS_CS3_FTIM3 CFG_SYS_FPGA_FTIM3
Alison Wang8ab967b2014-12-09 17:38:14 +0800219#endif
Wang Huan550e3dc2014-09-05 13:52:44 +0800220
221/*
222 * Serial Port
223 */
Tom Rinidb48e522022-03-23 17:20:00 -0400224#ifndef CONFIG_LPUART
Tom Rini91092132022-11-16 13:10:28 -0500225#define CFG_SYS_NS16550_CLK get_serial_clock()
Alison Wang8fc21212015-01-04 15:30:58 +0800226#endif
Wang Huan550e3dc2014-09-05 13:52:44 +0800227
Wang Huan550e3dc2014-09-05 13:52:44 +0800228/*
229 * I2C
230 */
Wang Huan550e3dc2014-09-05 13:52:44 +0800231
Biwen Lid58ea632021-02-05 19:02:03 +0800232/* GPIO */
Biwen Lid58ea632021-02-05 19:02:03 +0800233
Wang Huan550e3dc2014-09-05 13:52:44 +0800234/*
235 * I2C bus multiplexer
236 */
237#define I2C_MUX_PCA_ADDR_PRI 0x77
238#define I2C_MUX_CH_DEFAULT 0x8
Xiubo Lidd048322014-12-16 14:50:33 +0800239#define I2C_MUX_CH_CH7301 0xC
Wang Huan550e3dc2014-09-05 13:52:44 +0800240
241/*
242 * MMC
243 */
Wang Huan550e3dc2014-09-05 13:52:44 +0800244
Tom Rini3e204422022-12-04 10:13:54 -0500245#define CFG_SMP_PEN_ADDR 0x01ee0200
Xiubo Li1a2826f2014-11-21 17:40:57 +0800246
Zhuoyu Zhang03c22442015-08-17 18:55:12 +0800247#define HWCONFIG_BUFFER_SIZE 256
248
Alison Wang8fc21212015-01-04 15:30:58 +0800249#ifdef CONFIG_LPUART
Tom Rini0613c362022-12-04 10:03:50 -0500250#define CFG_EXTRA_ENV_SETTINGS \
Alison Wang8fc21212015-01-04 15:30:58 +0800251 "bootargs=root=/dev/ram0 rw console=ttyLP0,115200\0" \
Alison Wang99fe4542015-11-05 11:16:26 +0800252 "initrd_high=0xffffffff\0" \
Alison Wang8fc21212015-01-04 15:30:58 +0800253 "hwconfig=fsl_ddr:ctlr_intlv=null,bank_intlv=null\0"
254#else
Tom Rini0613c362022-12-04 10:03:50 -0500255#define CFG_EXTRA_ENV_SETTINGS \
Wang Huan550e3dc2014-09-05 13:52:44 +0800256 "bootargs=root=/dev/ram0 rw console=ttyS0,115200\0" \
Alison Wang99fe4542015-11-05 11:16:26 +0800257 "initrd_high=0xffffffff\0" \
Wang Huan550e3dc2014-09-05 13:52:44 +0800258 "hwconfig=fsl_ddr:ctlr_intlv=null,bank_intlv=null\0"
Alison Wang8fc21212015-01-04 15:30:58 +0800259#endif
Wang Huan550e3dc2014-09-05 13:52:44 +0800260
261/*
262 * Miscellaneous configurable options
263 */
Tom Rini65cc0e22022-11-16 13:10:41 -0500264#define CFG_SYS_BOOTMAPSZ (256 << 20)
Wang Huan550e3dc2014-09-05 13:52:44 +0800265
Wang Huan550e3dc2014-09-05 13:52:44 +0800266/*
267 * Environment
268 */
Wang Huan550e3dc2014-09-05 13:52:44 +0800269
Aneesh Bansalef6c55a2016-01-22 16:37:22 +0530270#include <asm/fsl_secure_boot.h>
Ruchika Gupta4ba4a092014-10-15 11:39:06 +0530271
Wang Huan550e3dc2014-09-05 13:52:44 +0800272#endif