blob: 94d372f791892cf9cb3051e6da8f2acdcdf5f686 [file] [log] [blame]
York Sun7b08d212014-06-23 15:15:56 -07001/*
2 * Copyright (C) 2014 Freescale Semiconductor
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#ifndef __LS2_COMMON_H
8#define __LS2_COMMON_H
9
10#define CONFIG_SYS_GENERIC_BOARD
11
12#define CONFIG_REMAKE_ELF
13#define CONFIG_FSL_LSCH3
14#define CONFIG_LS2085A
15#define CONFIG_GICV3
Bhupesh Sharmaa0c00ff2015-01-06 13:11:21 -080016#define CONFIG_FSL_TZPC_BP147
York Sun7b08d212014-06-23 15:15:56 -070017
Bhupesh Sharma0ec7a282015-01-23 15:50:05 +053018/* Errata fixes */
19#define CONFIG_ARM_ERRATA_828024
20#define CONFIG_ARM_ERRATA_826974
21
Bhupesh Sharma25b8efe2015-03-19 09:20:43 -070022/* We need architecture specific misc initializations */
23#define CONFIG_ARCH_MISC_INIT
24
York Sun7b08d212014-06-23 15:15:56 -070025/* Link Definitions */
York Sunc4da12e2014-09-08 12:20:02 -070026#define CONFIG_SYS_TEXT_BASE 0x30001000
York Sun7b08d212014-06-23 15:15:56 -070027
Prabhakar Kushwaha962b2de2014-07-16 09:21:12 +053028#ifdef CONFIG_EMU
York Sun7b08d212014-06-23 15:15:56 -070029#define CONFIG_SYS_NO_FLASH
Prabhakar Kushwaha962b2de2014-07-16 09:21:12 +053030#endif
York Sun7b08d212014-06-23 15:15:56 -070031
32#define CONFIG_SUPPORT_RAW_INITRD
33
34#define CONFIG_SKIP_LOWLEVEL_INIT
35#define CONFIG_BOARD_EARLY_INIT_F 1
36
York Sun7b08d212014-06-23 15:15:56 -070037/* Flat Device Tree Definitions */
38#define CONFIG_OF_LIBFDT
39#define CONFIG_OF_BOARD_SETUP
40
41/* new uImage format support */
42#define CONFIG_FIT
43#define CONFIG_FIT_VERBOSE /* enable fit_format_{error,warning}() */
44
45#define CONFIG_FSL_DDR_INTERACTIVE /* Interactive debugging */
46#ifndef CONFIG_SYS_FSL_DDR4
47#define CONFIG_SYS_FSL_DDR3 /* Use DDR3 memory */
48#define CONFIG_SYS_DDR_RAW_TIMING
49#endif
50#define CONFIG_DIMM_SLOTS_PER_CTLR 1
51#define CONFIG_CHIP_SELECTS_PER_CTRL 4
52
53#define CONFIG_SYS_FSL_DDR_INTLV_256B /* force 256 byte interleaving */
54
York Sun7b08d212014-06-23 15:15:56 -070055#define CONFIG_SYS_DDR_SDRAM_BASE 0x80000000UL
56#define CONFIG_SYS_FSL_DDR_SDRAM_BASE_PHY 0
57#define CONFIG_SYS_SDRAM_BASE CONFIG_SYS_DDR_SDRAM_BASE
58#define CONFIG_SYS_DDR_BLOCK2_BASE 0x8080000000ULL
York Sunc7a0e302014-08-13 10:21:05 -070059#define CONFIG_SYS_FSL_DDR_MAIN_NUM_CTRLS 2
60
York Sun290a83a2014-09-08 12:20:01 -070061/*
62 * SMP Definitinos
63 */
64#define CPU_RELEASE_ADDR secondary_boot_func
65
York Sunc7a0e302014-08-13 10:21:05 -070066#define CONFIG_SYS_FSL_OTHER_DDR_NUM_CTRLS
67#define CONFIG_SYS_DP_DDR_BASE 0x6000000000ULL
68/*
69 * DDR controller use 0 as the base address for binding.
70 * It is mapped to CONFIG_SYS_DP_DDR_BASE for core to access.
71 */
72#define CONFIG_SYS_DP_DDR_BASE_PHY 0
73#define CONFIG_DP_DDR_CTRL 2
74#define CONFIG_DP_DDR_NUM_CTRLS 1
75#define CONFIG_DP_DDR_DIMM_SLOTS_PER_CTLR 1
York Sun7b08d212014-06-23 15:15:56 -070076
77/* Generic Timer Definitions */
78#define COUNTER_FREQUENCY 12000000 /* 12MHz */
79
80/* Size of malloc() pool */
81#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 128 * 1024)
82
83/* I2C */
84#define CONFIG_CMD_I2C
85#define CONFIG_SYS_I2C
86#define CONFIG_SYS_I2C_MXC
87#define CONFIG_SYS_MXC_I2C1_SPEED 40000000
88#define CONFIG_SYS_MXC_I2C2_SPEED 40000000
89
90/* Serial Port */
91#define CONFIG_CONS_INDEX 2
92#define CONFIG_SYS_NS16550
93#define CONFIG_SYS_NS16550_SERIAL
94#define CONFIG_SYS_NS16550_REG_SIZE 1
95#define CONFIG_SYS_NS16550_CLK (get_bus_freq(0)/2)
96
97#define CONFIG_BAUDRATE 115200
98#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
99
100/* IFC */
101#define CONFIG_FSL_IFC
102#define CONFIG_SYS_NOR0_CSPR_EXT (0x0)
103#define CONFIG_SYS_NOR_AMASK IFC_AMASK(128*1024*1024)
104/*
105 * During booting, CS0 needs to be at the region of 0x30000000, i.e. the IFC
106 * address 0. But this region is limited to 256MB. To accommodate bigger NOR
107 * flash and other devices, we will map CS0 to 0x580000000 after relocation.
108 * CONFIG_SYS_FLASH_BASE has the final address (core view)
109 * CONFIG_SYS_FLASH_BASE_PHYS has the final address (IFC view)
110 * CONFIG_SYS_FLASH_BASE_PHYS_EARLY has the temporary IFC address
111 * CONFIG_SYS_TEXT_BASE is linked to 0x30000000 for booting
112 */
113#define CONFIG_SYS_FLASH_BASE 0x580000000ULL
114#define CONFIG_SYS_FLASH_BASE_PHYS 0x80000000
115#define CONFIG_SYS_FLASH_BASE_PHYS_EARLY 0x00000000
116
117/*
118 * NOR Flash Timing Params
119 */
120#define CONFIG_SYS_NOR0_CSPR \
121 (CSPR_PHYS_ADDR(CONFIG_SYS_FLASH_BASE_PHYS) | \
122 CSPR_PORT_SIZE_16 | \
123 CSPR_MSEL_NOR | \
124 CSPR_V)
125#define CONFIG_SYS_NOR0_CSPR_EARLY \
126 (CSPR_PHYS_ADDR(CONFIG_SYS_FLASH_BASE_PHYS_EARLY) | \
127 CSPR_PORT_SIZE_16 | \
128 CSPR_MSEL_NOR | \
129 CSPR_V)
130#define CONFIG_SYS_NOR_CSOR CSOR_NOR_ADM_SHIFT(12)
131#define CONFIG_SYS_NOR_FTIM0 (FTIM0_NOR_TACSE(0x1) | \
132 FTIM0_NOR_TEADC(0x1) | \
133 FTIM0_NOR_TEAHC(0x1))
134#define CONFIG_SYS_NOR_FTIM1 (FTIM1_NOR_TACO(0x1) | \
135 FTIM1_NOR_TRAD_NOR(0x1))
136#define CONFIG_SYS_NOR_FTIM2 (FTIM2_NOR_TCS(0x0) | \
137 FTIM2_NOR_TCH(0x0) | \
138 FTIM2_NOR_TWP(0x1))
139#define CONFIG_SYS_NOR_FTIM3 0x04000000
140#define CONFIG_SYS_IFC_CCR 0x01000000
141
Prabhakar Kushwaha962b2de2014-07-16 09:21:12 +0530142#ifndef CONFIG_SYS_NO_FLASH
143#define CONFIG_FLASH_CFI_DRIVER
144#define CONFIG_SYS_FLASH_CFI
145#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE
146#define CONFIG_SYS_FLASH_QUIET_TEST
147#define CONFIG_FLASH_SHOW_PROGRESS 45 /* count down from 45/5: 9..1 */
148
149#define CONFIG_SYS_MAX_FLASH_BANKS 1 /* number of banks */
150#define CONFIG_SYS_MAX_FLASH_SECT 1024 /* sectors per device */
151#define CONFIG_SYS_FLASH_ERASE_TOUT 60000 /* Flash Erase Timeout (ms) */
152#define CONFIG_SYS_FLASH_WRITE_TOUT 500 /* Flash Write Timeout (ms) */
153
154#define CONFIG_SYS_FLASH_EMPTY_INFO
155#define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE }
156#endif
157
158#define CONFIG_NAND_FSL_IFC
159#define CONFIG_SYS_NAND_MAX_ECCPOS 256
160#define CONFIG_SYS_NAND_MAX_OOBFREE 2
161#define CONFIG_SYS_NAND_BASE 0x520000000
162#define CONFIG_SYS_NAND_BASE_PHYS 0x20000000
163
164#define CONFIG_SYS_NAND_CSPR_EXT (0x0)
165#define CONFIG_SYS_NAND_CSPR (CSPR_PHYS_ADDR(CONFIG_SYS_NAND_BASE_PHYS) \
166 | CSPR_PORT_SIZE_8 /* Port Size = 8 bit */ \
167 | CSPR_MSEL_NAND /* MSEL = NAND */ \
168 | CSPR_V)
169#define CONFIG_SYS_NAND_AMASK IFC_AMASK(64 * 1024)
170
171#define CONFIG_SYS_NAND_CSOR (CSOR_NAND_ECC_ENC_EN /* ECC on encode */ \
172 | CSOR_NAND_ECC_DEC_EN /* ECC on decode */ \
173 | CSOR_NAND_ECC_MODE_4 /* 4-bit ECC */ \
174 | CSOR_NAND_RAL_3 /* RAL = 2Byes */ \
175 | CSOR_NAND_PGS_2K /* Page Size = 2K */ \
176 | CSOR_NAND_SPRZ_64/* Spare size = 64 */ \
177 | CSOR_NAND_PB(64)) /*Pages Per Block = 64*/
178
179#define CONFIG_SYS_NAND_ONFI_DETECTION
180
181/* ONFI NAND Flash mode0 Timing Params */
182#define CONFIG_SYS_NAND_FTIM0 (FTIM0_NAND_TCCST(0x07) | \
183 FTIM0_NAND_TWP(0x18) | \
184 FTIM0_NAND_TWCHT(0x07) | \
185 FTIM0_NAND_TWH(0x0a))
186#define CONFIG_SYS_NAND_FTIM1 (FTIM1_NAND_TADLE(0x32) | \
187 FTIM1_NAND_TWBE(0x39) | \
188 FTIM1_NAND_TRR(0x0e) | \
189 FTIM1_NAND_TRP(0x18))
190#define CONFIG_SYS_NAND_FTIM2 (FTIM2_NAND_TRAD(0x0f) | \
191 FTIM2_NAND_TREH(0x0a) | \
192 FTIM2_NAND_TWHRE(0x1e))
193#define CONFIG_SYS_NAND_FTIM3 0x0
194
195#define CONFIG_SYS_NAND_BASE_LIST { CONFIG_SYS_NAND_BASE }
196#define CONFIG_SYS_MAX_NAND_DEVICE 1
Prabhakar Kushwaha962b2de2014-07-16 09:21:12 +0530197#define CONFIG_CMD_NAND
198
199#define CONFIG_SYS_NAND_BLOCK_SIZE (128 * 1024)
200
York Sun7b08d212014-06-23 15:15:56 -0700201#define CONFIG_SYS_CSPR0_EXT CONFIG_SYS_NOR0_CSPR_EXT
202#define CONFIG_SYS_CSPR0 CONFIG_SYS_NOR0_CSPR_EARLY
203#define CONFIG_SYS_CSPR0_FINAL CONFIG_SYS_NOR0_CSPR
204#define CONFIG_SYS_AMASK0 CONFIG_SYS_NOR_AMASK
205#define CONFIG_SYS_CSOR0 CONFIG_SYS_NOR_CSOR
206#define CONFIG_SYS_CS0_FTIM0 CONFIG_SYS_NOR_FTIM0
207#define CONFIG_SYS_CS0_FTIM1 CONFIG_SYS_NOR_FTIM1
208#define CONFIG_SYS_CS0_FTIM2 CONFIG_SYS_NOR_FTIM2
209#define CONFIG_SYS_CS0_FTIM3 CONFIG_SYS_NOR_FTIM3
210
Bhupesh Sharma25b8efe2015-03-19 09:20:43 -0700211/* Debug Server firmware */
212#define CONFIG_FSL_DEBUG_SERVER
213#define CONFIG_SYS_DEBUG_SERVER_DRAM_BLOCK_MIN_SIZE (512UL * 1024 * 1024)
214#define CONFIG_SYS_DEBUG_SERVER_FW_IN_NOR
215#define CONFIG_SYS_DEBUG_SERVER_FW_ADDR 0x580C00000ULL
216/* 2 sec timeout */
217#define CONFIG_SYS_DEBUG_SERVER_TIMEOUT (2 * 1000 * 1000)
218
York Sun7b08d212014-06-23 15:15:56 -0700219/* MC firmware */
220#define CONFIG_FSL_MC_ENET
221#define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE (512UL * 1024 * 1024)
222#define CONFIG_SYS_LS_MC_FW_IN_NOR
223#define CONFIG_SYS_LS_MC_FW_ADDR 0x580200000ULL
York Sun7b08d212014-06-23 15:15:56 -0700224#define CONFIG_SYS_LS_MC_DPL_IN_NOR
225#define CONFIG_SYS_LS_MC_DPL_ADDR 0x5806C0000ULL
226/* TODO Actual DPL max length needs to be confirmed with the MC FW team */
J. German Rivera43e4ae32015-01-06 13:19:02 -0800227#define CONFIG_SYS_LS_MC_DPL_MAX_LENGTH (256 * 1024)
York Sun7b08d212014-06-23 15:15:56 -0700228#define CONFIG_SYS_LS_MC_DRAM_DPL_OFFSET 0xe00000
229
Bhupesh Sharma25b8efe2015-03-19 09:20:43 -0700230/* Carve out a DDR region which will not be used by u-boot/Linux */
231#if defined(CONFIG_FSL_MC_ENET) || defined(CONFIG_FSL_DEBUG_SERVER)
232#define CONFIG_SYS_MEM_TOP_HIDE get_dram_size_to_hide()
York Sun7b08d212014-06-23 15:15:56 -0700233#endif
234
235/* Command line configuration */
236#define CONFIG_CMD_CACHE
237#define CONFIG_CMD_BDI
238#define CONFIG_CMD_DHCP
239#define CONFIG_CMD_ENV
240#define CONFIG_CMD_FLASH
241#define CONFIG_CMD_IMI
242#define CONFIG_CMD_MEMORY
243#define CONFIG_CMD_MII
244#define CONFIG_CMD_NET
245#define CONFIG_CMD_PING
246#define CONFIG_CMD_SAVEENV
247#define CONFIG_CMD_RUN
248#define CONFIG_CMD_BOOTD
249#define CONFIG_CMD_ECHO
250#define CONFIG_CMD_SOURCE
251#define CONFIG_CMD_FAT
252#define CONFIG_DOS_PARTITION
253
254/* Miscellaneous configurable options */
255#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_DDR_SDRAM_BASE + 0x10000000)
York Sun290a83a2014-09-08 12:20:01 -0700256#define CONFIG_ARCH_EARLY_INIT_R
York Sun7b08d212014-06-23 15:15:56 -0700257
258/* Physical Memory Map */
259/* fixme: these need to be checked against the board */
260#define CONFIG_CHIP_SELECTS_PER_CTRL 4
York Sun0080f222015-01-06 13:18:54 -0800261#define CONFIG_SYS_CLK_FREQ 100000000
262#define CONFIG_DDR_CLK_FREQ 133333333
York Sun7b08d212014-06-23 15:15:56 -0700263
York Sunc7a0e302014-08-13 10:21:05 -0700264#define CONFIG_NR_DRAM_BANKS 3
York Sun7b08d212014-06-23 15:15:56 -0700265
York Sun7b08d212014-06-23 15:15:56 -0700266#define CONFIG_HWCONFIG
267#define HWCONFIG_BUFFER_SIZE 128
268
269#define CONFIG_DISPLAY_CPUINFO
270
271/* Initial environment variables */
272#define CONFIG_EXTRA_ENV_SETTINGS \
273 "hwconfig=fsl_ddr:bank_intlv=auto\0" \
274 "loadaddr=0x80100000\0" \
275 "kernel_addr=0x100000\0" \
276 "ramdisk_addr=0x800000\0" \
277 "ramdisk_size=0x2000000\0" \
278 "fdt_high=0xffffffffffffffff\0" \
279 "initrd_high=0xffffffffffffffff\0" \
280 "kernel_start=0x581200000\0" \
Stuart Yoderd4792d82015-01-06 13:18:57 -0800281 "kernel_load=0xa0000000\0" \
York Sun7b08d212014-06-23 15:15:56 -0700282 "kernel_size=0x1000000\0" \
283 "console=ttyAMA0,38400n8\0"
284
Arnab Basu77d31652015-01-06 13:18:56 -0800285#define CONFIG_BOOTARGS "console=ttyS1,115200 root=/dev/ram0 " \
286 "earlycon=uart8250,mmio,0x21c0600,115200 " \
287 "default_hugepagesz=2m hugepagesz=2m " \
288 "hugepages=16"
York Sun7b08d212014-06-23 15:15:56 -0700289#define CONFIG_BOOTCOMMAND "cp.b $kernel_start $kernel_load " \
290 "$kernel_size && bootm $kernel_load"
291#define CONFIG_BOOTDELAY 1
292
293/* Store environment at top of flash */
294#define CONFIG_ENV_IS_NOWHERE 1
295#define CONFIG_ENV_SIZE 0x1000
296
297/* Monitor Command Prompt */
298#define CONFIG_SYS_CBSIZE 512 /* Console I/O Buffer Size */
299#define CONFIG_SYS_PROMPT "> "
300#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
301 sizeof(CONFIG_SYS_PROMPT) + 16)
302#define CONFIG_SYS_HUSH_PARSER
303#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
304#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot args buffer */
305#define CONFIG_SYS_LONGHELP
306#define CONFIG_CMDLINE_EDITING 1
307#define CONFIG_SYS_MAXARGS 64 /* max command args */
308
309#ifndef __ASSEMBLY__
Bhupesh Sharma25b8efe2015-03-19 09:20:43 -0700310unsigned long get_dram_size_to_hide(void);
York Sun7b08d212014-06-23 15:15:56 -0700311#endif
312
313#endif /* __LS2_COMMON_H */