blob: a7fd43bc7b8e56a8a8b0c1257a5dc69b1b57858d [file] [log] [blame]
Eric Benard3cbeb0f2014-04-04 19:05:55 +02001/*
2 * Copyright (C) 2014 Eukréa Electromatique
3 * Author: Eric Bénard <eric@eukrea.com>
4 *
5 * Configuration settings for the Embest RIoTboard
6 *
7 * based on mx6*sabre*.h which are :
8 * Copyright (C) 2012 Freescale Semiconductor, Inc.
9 *
10 * SPDX-License-Identifier: GPL-2.0+
11 */
12
13#ifndef __RIOTBOARD_CONFIG_H
14#define __RIOTBOARD_CONFIG_H
15
16#include <asm/arch/imx-regs.h>
17#include <asm/imx-common/gpio.h>
18
19#include "mx6_common.h"
20#include <linux/sizes.h>
21
Iain Paton6ed9c7b2014-06-09 23:09:00 +010022#define CONFIG_SYS_GENERIC_BOARD
23
Eric Benard3cbeb0f2014-04-04 19:05:55 +020024#define CONFIG_MXC_UART_BASE UART2_BASE
Fabio Estevamfa4a7a42014-06-09 13:35:35 -030025#define CONFIG_CONSOLE_DEV "ttymxc1"
Eric Benard3cbeb0f2014-04-04 19:05:55 +020026#define CONFIG_MMCROOT "/dev/mmcblk1p2"
27
28#define PHYS_SDRAM_SIZE (1u * 1024 * 1024 * 1024)
29
30#define CONFIG_MX6
31
32#define CONFIG_DISPLAY_CPUINFO
33#define CONFIG_DISPLAY_BOARDINFO
34
35#define CONFIG_CMDLINE_TAG
36#define CONFIG_SETUP_MEMORY_TAGS
37#define CONFIG_INITRD_TAG
38#define CONFIG_REVISION_TAG
39
40/* Size of malloc() pool */
41#define CONFIG_SYS_MALLOC_LEN (10 * SZ_1M)
42
43#define CONFIG_BOARD_EARLY_INIT_F
44#define CONFIG_BOARD_LATE_INIT
45#define CONFIG_MXC_GPIO
46
47#define CONFIG_MXC_UART
48
49#define CONFIG_CMD_FUSE
50#ifdef CONFIG_CMD_FUSE
51#define CONFIG_MXC_OCOTP
52#endif
53
54/* I2C Configs */
55#define CONFIG_CMD_I2C
56#define CONFIG_SYS_I2C
57#define CONFIG_SYS_I2C_MXC
58#define CONFIG_SYS_I2C_SPEED 100000
59
60/* USB Configs */
61#define CONFIG_CMD_USB
62#define CONFIG_USB_EHCI
63#define CONFIG_USB_EHCI_MX6
64#define CONFIG_USB_STORAGE
65#define CONFIG_USB_HOST_ETHER
66#define CONFIG_USB_ETHER_ASIX
67#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
68#define CONFIG_EHCI_HCD_INIT_AFTER_RESET /* For OTG port */
69#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
70#define CONFIG_MXC_USB_FLAGS 0
71
72/* MMC Configs */
73#define CONFIG_FSL_ESDHC
74#define CONFIG_FSL_USDHC
75#define CONFIG_SYS_FSL_ESDHC_ADDR 0
76
77#define CONFIG_MMC
78#define CONFIG_CMD_MMC
79#define CONFIG_GENERIC_MMC
80#define CONFIG_BOUNCE_BUFFER
81#define CONFIG_CMD_EXT2
82#define CONFIG_CMD_FAT
83#define CONFIG_DOS_PARTITION
84
85#define CONFIG_CMD_PING
86#define CONFIG_CMD_DHCP
87#define CONFIG_CMD_MII
88#define CONFIG_CMD_NET
89#define CONFIG_FEC_MXC
90#define CONFIG_MII
91#define IMX_FEC_BASE ENET_BASE_ADDR
92#define CONFIG_FEC_XCV_TYPE RGMII
93#define CONFIG_ETHPRIME "FEC"
94#define CONFIG_FEC_MXC_PHYADDR 4
95
96#define CONFIG_PHYLIB
97#define CONFIG_PHY_ATHEROS
98
99#define CONFIG_CMD_SF
100#ifdef CONFIG_CMD_SF
101#define CONFIG_SPI_FLASH
102#define CONFIG_SPI_FLASH_SST
103#define CONFIG_MXC_SPI
104#define CONFIG_SF_DEFAULT_BUS 0
105#define CONFIG_SF_DEFAULT_CS (0 | (IMX_GPIO_NR(2, 30) << 8))
106#define CONFIG_SF_DEFAULT_SPEED 20000000
107#define CONFIG_SF_DEFAULT_MODE SPI_MODE_0
108#endif
109
110/* allow to overwrite serial and ethaddr */
111#define CONFIG_ENV_OVERWRITE
112#define CONFIG_CONS_INDEX 1
113#define CONFIG_BAUDRATE 115200
114
115/* Command definition */
116#include <config_cmd_default.h>
117
118#define CONFIG_CMD_BMODE
119#define CONFIG_CMD_BOOTZ
120#define CONFIG_CMD_SETEXPR
121#undef CONFIG_CMD_IMLS
122
123#define CONFIG_BOOTDELAY 1
124
125#define CONFIG_LOADADDR 0x12000000
126#define CONFIG_SYS_TEXT_BASE 0x17800000
127
128#ifdef CONFIG_SUPPORT_EMMC_BOOT
129#define EMMC_ENV \
130 "emmcdev=2\0" \
131 "update_emmc_firmware=" \
132 "if test ${ip_dyn} = yes; then " \
133 "setenv get_cmd dhcp; " \
134 "else " \
135 "setenv get_cmd tftp; " \
136 "fi; " \
137 "if ${get_cmd} ${update_sd_firmware_filename}; then " \
138 "if mmc dev ${emmcdev}; then " \
139 "setexpr fw_sz ${filesize} / 0x200; " \
140 "setexpr fw_sz ${fw_sz} + 1; " \
141 "mmc write ${loadaddr} 0x2 ${fw_sz}; " \
142 "fi; " \
143 "fi\0"
144#else
145#define EMMC_ENV ""
146#endif
147
148#ifdef CONFIG_CMD_SF
149#define SF_ENV \
150 "update_spi_firmware=" \
151 "if test ${ip_dyn} = yes; then " \
152 "setenv get_cmd dhcp; " \
153 "else " \
154 "setenv get_cmd tftp; " \
155 "fi; " \
156 "if ${get_cmd} ${update_spi_firmware_filename}; then " \
157 "if sf probe; then " \
158 "sf erase 0 0xc0000; " \
159 "sf write ${loadaddr} 0x400 ${filesize}; " \
160 "fi; " \
161 "fi\0"
162#else
163#define SF_ENV ""
164#endif
165
166#define CONFIG_EXTRA_ENV_SETTINGS \
167 "script=boot.scr\0" \
168 "image=zImage\0" \
169 "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
170 "fdt_addr=0x18000000\0" \
171 "boot_fdt=try\0" \
172 "ip_dyn=yes\0" \
173 "console=" CONFIG_CONSOLE_DEV "\0" \
174 "fdt_high=0xffffffff\0" \
175 "initrd_high=0xffffffff\0" \
176 "mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
177 "mmcpart=1\0" \
178 "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
179 "update_sd_firmware=" \
180 "if test ${ip_dyn} = yes; then " \
181 "setenv get_cmd dhcp; " \
182 "else " \
183 "setenv get_cmd tftp; " \
184 "fi; " \
185 "if mmc dev ${mmcdev}; then " \
186 "if ${get_cmd} ${update_sd_firmware_filename}; then " \
187 "setexpr fw_sz ${filesize} / 0x200; " \
188 "setexpr fw_sz ${fw_sz} + 1; " \
189 "mmc write ${loadaddr} 0x2 ${fw_sz}; " \
190 "fi; " \
191 "fi\0" \
192 EMMC_ENV \
193 SF_ENV \
194 "mmcargs=setenv bootargs console=${console},${baudrate} " \
195 "root=${mmcroot}\0" \
196 "loadbootscript=" \
197 "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
198 "bootscript=echo Running bootscript from mmc ...; " \
199 "source\0" \
200 "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
201 "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
202 "mmcboot=echo Booting from mmc ...; " \
203 "run mmcargs; " \
204 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
205 "if run loadfdt; then " \
206 "bootz ${loadaddr} - ${fdt_addr}; " \
207 "else " \
208 "if test ${boot_fdt} = try; then " \
209 "bootz; " \
210 "else " \
211 "echo WARN: Cannot load the DT; " \
212 "fi; " \
213 "fi; " \
214 "else " \
215 "bootz; " \
216 "fi;\0" \
217 "netargs=setenv bootargs console=${console},${baudrate} " \
218 "root=/dev/nfs " \
219 "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
220 "netboot=echo Booting from net ...; " \
221 "run netargs; " \
222 "if test ${ip_dyn} = yes; then " \
223 "setenv get_cmd dhcp; " \
224 "else " \
225 "setenv get_cmd tftp; " \
226 "fi; " \
227 "${get_cmd} ${image}; " \
228 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
229 "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
230 "bootz ${loadaddr} - ${fdt_addr}; " \
231 "else " \
232 "if test ${boot_fdt} = try; then " \
233 "bootz; " \
234 "else " \
235 "echo WARN: Cannot load the DT; " \
236 "fi; " \
237 "fi; " \
238 "else " \
239 "bootz; " \
240 "fi;\0"
241
242#define CONFIG_BOOTCOMMAND \
243 "mmc dev ${mmcdev};" \
244 "if mmc rescan; then " \
245 "if run loadbootscript; then " \
246 "run bootscript; " \
247 "else " \
248 "if run loadimage; then " \
249 "run mmcboot; " \
250 "else run netboot; " \
251 "fi; " \
252 "fi; " \
253 "else run netboot; fi"
254
255#define CONFIG_ARP_TIMEOUT 200UL
256
257/* Miscellaneous configurable options */
258#define CONFIG_SYS_LONGHELP
259#define CONFIG_SYS_HUSH_PARSER
260#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
261#define CONFIG_AUTO_COMPLETE
262#define CONFIG_SYS_CBSIZE 256
263
264/* Print Buffer Size */
265#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
266#define CONFIG_SYS_MAXARGS 16
267#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
268
269#define CONFIG_SYS_MEMTEST_START 0x10000000
270#define CONFIG_SYS_MEMTEST_END 0x10010000
271#define CONFIG_SYS_MEMTEST_SCRATCH 0x10800000
272
273#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
274
275#define CONFIG_CMDLINE_EDITING
276#define CONFIG_STACKSIZE (128 * 1024)
277
278/* Physical Memory Map */
279#define CONFIG_NR_DRAM_BANKS 1
280#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
281
282#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
283#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
284#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
285
286#define CONFIG_SYS_INIT_SP_OFFSET \
287 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
288#define CONFIG_SYS_INIT_SP_ADDR \
289 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
290
291/* FLASH and environment organization */
292#define CONFIG_SYS_NO_FLASH
293
294#define CONFIG_ENV_SIZE (8 * 1024)
295
296#if defined(CONFIG_ENV_IS_IN_MMC)
297/* RiOTboard */
Fabio Estevama7650482014-06-09 13:42:14 -0300298#define CONFIG_DEFAULT_FDT_FILE "imx6dl-riotboard.dtb"
Eric Benard3cbeb0f2014-04-04 19:05:55 +0200299#define CONFIG_SYS_FSL_USDHC_NUM 3
300#define CONFIG_SYS_MMC_ENV_DEV 2 /* SDHC4 */
301#define CONFIG_ENV_OFFSET (6 * 64 * 1024)
302#define CONFIG_SUPPORT_EMMC_BOOT /* eMMC specific */
303#elif defined(CONFIG_ENV_IS_IN_SPI_FLASH)
304/* MarSBoard */
305#define CONFIG_DEFAULT_FDT_FILE "imx6q-marsboard.dtb"
306#define CONFIG_SYS_FSL_USDHC_NUM 2
307#define CONFIG_ENV_OFFSET (768 * 1024)
308#define CONFIG_ENV_SECT_SIZE (8 * 1024)
309#define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS
310#define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS
311#define CONFIG_ENV_SPI_MODE CONFIG_SF_DEFAULT_MODE
312#define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED
313#endif
314
315#define CONFIG_OF_LIBFDT
316
317#ifndef CONFIG_SYS_DCACHE_OFF
318#define CONFIG_CMD_CACHE
319#endif
320
321/* Framebuffer */
322#define CONFIG_VIDEO
323#define CONFIG_VIDEO_IPUV3
324#define CONFIG_CFB_CONSOLE
325#define CONFIG_VGA_AS_SINGLE_DEVICE
326#define CONFIG_SYS_CONSOLE_IS_IN_ENV
327#define CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
328#define CONFIG_VIDEO_BMP_RLE8
329#define CONFIG_SPLASH_SCREEN
330#define CONFIG_SPLASH_SCREEN_ALIGN
331#define CONFIG_BMP_16BPP
332#define CONFIG_VIDEO_LOGO
333#define CONFIG_VIDEO_BMP_LOGO
334#define CONFIG_IPUV3_CLK 260000000
335#define CONFIG_IMX_HDMI
336#define CONFIG_IMX_VIDEO_SKIP
337
338#endif /* __RIOTBOARD_CONFIG_H */