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