karo: tx6: enable bootretry
[karo-tx-uboot.git] / include / configs / tx6.h
1 /*
2  * Copyright (C) 2012-2015 <LW@KARO-electronics.de>
3  *
4  * SPDX-License-Identifier:      GPL-2.0
5  *
6  */
7
8 #ifndef __CONFIG_H
9 #define __CONFIG_H
10
11 #ifndef CONFIG_SOC_MX6UL
12 #define CONFIG_ARM_ERRATA_743622
13 #define CONFIG_ARM_ERRATA_751472
14 #define CONFIG_ARM_ERRATA_794072
15 #define CONFIG_ARM_ERRATA_761320
16
17 #ifndef CONFIG_SYS_L2CACHE_OFF
18 #define CONFIG_SYS_L2_PL310
19 #define CONFIG_SYS_PL310_BASE   L2_PL310_BASE
20 #endif
21
22 #define CONFIG_SYS_FSL_ESDHC_HAS_DDR_MODE
23 #define CONFIG_MP
24 #endif
25 #define CONFIG_BOARD_POSTCLK_INIT
26 #define CONFIG_MXC_GPT_HCLK
27
28 #include <linux/kconfig.h>
29 #include <linux/sizes.h>
30 #include <asm/arch/imx-regs.h>
31
32 /*
33  * Ka-Ro TX6 board - SoC configuration
34  */
35 #define CONFIG_SYS_MX6_HCLK             24000000
36 #define CONFIG_SYS_MX6_CLK32            32768
37 #define CONFIG_SYS_HZ                   1000            /* Ticks per second */
38 #define CONFIG_SHOW_ACTIVITY
39 #define CONFIG_ARCH_CPU_INIT
40 #define CONFIG_DISPLAY_BOARDINFO
41 #define CONFIG_BOARD_LATE_INIT
42 #define CONFIG_BOARD_EARLY_INIT_F
43 #define CONFIG_SYS_GENERIC_BOARD
44 #define CONFIG_CMD_GPIO
45
46 /* LCD Logo and Splash screen support */
47 #ifdef CONFIG_LCD
48 #define CONFIG_SPLASH_SCREEN
49 #define CONFIG_SPLASH_SCREEN_ALIGN
50 #ifndef CONFIG_SOC_MX6UL
51 #define CONFIG_VIDEO_IPUV3
52 #define CONFIG_IPUV3_CLK                (CONFIG_SYS_SDRAM_CLK * 1000000 / 2)
53 #else
54 #define CONFIG_VIDEO_MXS
55 #define MXS_LCDIF_BASE                  0x021c8000UL
56 #endif /* CONFIG_SOC_MX6UL */
57 #define CONFIG_LCD_LOGO
58 #define LCD_BPP                         LCD_COLOR32
59 #define CONFIG_CMD_BMP
60 #define CONFIG_BMP_8BPP
61 #define CONFIG_BMP_16BPP
62 #define CONFIG_BMP_24BPP
63 #define CONFIG_BMP_32BPP
64 #define CONFIG_VIDEO_BMP_RLE8
65 #endif /* CONFIG_LCD */
66
67 /*
68  * Memory configuration options
69  */
70 #define CONFIG_NR_DRAM_BANKS            0x1             /* # of SDRAM banks */
71 #ifndef CONFIG_SOC_MX6UL
72 #define PHYS_SDRAM_1                    0x10000000      /* Base address of bank 1 */
73 #define CONFIG_SYS_MPU_CLK              792
74 #else
75 #define PHYS_SDRAM_1                    0x80000000      /* Base address of bank 1 */
76 #define CONFIG_SYS_MPU_CLK              528
77 #endif
78 #ifndef CONFIG_SYS_SDRAM_BUS_WIDTH
79 #if defined(CONFIG_SYS_SDRAM_BUS_WIDTH_32)
80 #define CONFIG_SYS_SDRAM_BUS_WIDTH      32
81 #elif defined(CONFIG_SYS_SDRAM_BUS_WIDTH_16)
82 #define CONFIG_SYS_SDRAM_BUS_WIDTH      16
83 #else
84 #define CONFIG_SYS_SDRAM_BUS_WIDTH      64
85 #endif
86 #endif /* CONFIG_SYS_SDRAM_BUS_WIDTH */
87 #ifdef __ASSEMBLY__
88 #define _AC(x,s)                        x
89 #else
90 #define _AC(x,s)                        (x##s)
91 #endif
92 #define UL(x)                           _AC(x,UL)
93 #define PHYS_SDRAM_1_SIZE               (UL(CONFIG_SYS_SDRAM_CHIP_SIZE) * SZ_1M \
94                                 / 32 * CONFIG_SYS_SDRAM_BUS_WIDTH)
95 #if PHYS_SDRAM_1_SIZE > SZ_1G
96 #define FDT_HIGH_STR                    "fdt_high=ffffffff\0"
97 #else
98 #define FDT_HIGH_STR                    ""
99 #endif
100
101 #ifdef CONFIG_SOC_MX6Q
102 #define CONFIG_SYS_SDRAM_CLK            528
103 #else
104 #define CONFIG_SYS_SDRAM_CLK            400
105 #endif
106 #define CONFIG_STACKSIZE                SZ_128K
107 #define CONFIG_SPL_STACK                (IRAM_BASE_ADDR + SZ_16K)
108 #define CONFIG_SYS_MALLOC_LEN           SZ_8M
109 #define CONFIG_SYS_MEMTEST_START        PHYS_SDRAM_1    /* Memtest start address */
110 #define CONFIG_SYS_MEMTEST_END          (CONFIG_SYS_MEMTEST_START + SZ_4M)
111
112 /*
113  * U-Boot general configurations
114  */
115 #define CONFIG_SYS_LONGHELP
116 #if defined(CONFIG_SOC_MX6Q)
117 #elif defined(CONFIG_SOC_MX6DL)
118 #elif defined(CONFIG_SOC_MX6S)
119 #elif defined(CONFIG_SOC_MX6UL)
120 #else
121 #error Unsupported i.MX6 processor variant
122 #endif
123 #define CONFIG_SYS_CBSIZE               2048    /* Console I/O buffer size */
124 #define CONFIG_SYS_PBSIZE                                               \
125         (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
126                                                 /* Print buffer size */
127 #define CONFIG_SYS_MAXARGS              256     /* Max number of command args */
128 #define CONFIG_SYS_BARGSIZE             CONFIG_SYS_CBSIZE
129                                                 /* Boot argument buffer size */
130 #define CONFIG_VERSION_VARIABLE                 /* U-BOOT version */
131 #define CONFIG_AUTO_COMPLETE                    /* Command auto complete */
132 #define CONFIG_CMDLINE_EDITING                  /* Command history etc */
133
134 #define CONFIG_SYS_64BIT_VSPRINTF
135
136 /*
137  * Boot Linux
138  */
139 #define xstr(s)                         str(s)
140 #define str(s)                          #s
141 #define __pfx(x, s)                     (x##s)
142 #define _pfx(x, s)                      __pfx(x, s)
143
144 #define CONFIG_CMDLINE_TAG
145 #define CONFIG_INITRD_TAG
146 #define CONFIG_SETUP_MEMORY_TAGS
147 #ifndef CONFIG_TX6_UBOOT_MFG
148 #define CONFIG_BOOTDELAY                1
149 #else
150 #define CONFIG_BOOTDELAY                0
151 #endif
152 #define CONFIG_BOOT_RETRY_TIME          -1
153 #define CONFIG_BOOT_RETRY_MIN           3
154 #define CONFIG_RESET_TO_RETRY
155 #define CONFIG_ZERO_BOOTDELAY_CHECK
156 #define CONFIG_SYS_AUTOLOAD             "no"
157 #define DEFAULT_BOOTCMD                 "run bootcmd_${boot_mode} bootm_cmd"
158 #define CONFIG_BOOTFILE                 "uImage"
159 #define CONFIG_BOOTARGS                 "init=/linuxrc console=ttymxc0,115200 ro debug panic=1"
160 #ifndef CONFIG_TX6_UBOOT_MFG
161 #define CONFIG_BOOTCOMMAND              DEFAULT_BOOTCMD
162 #else
163 #define CONFIG_BOOTCOMMAND              "setenv bootcmd '" DEFAULT_BOOTCMD "';" \
164         "env import " xstr(CONFIG_BOOTCMD_MFG_LOADADDR) ";run bootcmd_mfg"
165 #if (defined(CONFIG_SOC_MX6SX) || defined(CONFIG_SOC_MX6SL) || defined(CONFIG_SOC_MX6UL))
166 #define CONFIG_BOOTCMD_MFG_LOADADDR     80500000
167 #else
168 #define CONFIG_BOOTCMD_MFG_LOADADDR     10500000
169 #endif
170 #define CONFIG_DELAY_ENVIRONMENT
171 #endif /* CONFIG_TX6_UBOOT_MFG */
172 #if (defined(CONFIG_SOC_MX6SX) || defined(CONFIG_SOC_MX6SL) || defined(CONFIG_SOC_MX6UL))
173 #define CONFIG_LOADADDR                 82000000
174 #define CONFIG_FDTADDR                  81000000
175 #else
176 #define CONFIG_LOADADDR                 18000000
177 #define CONFIG_FDTADDR                  11000000
178 #endif
179 #define CONFIG_SYS_LOAD_ADDR            _pfx(0x, CONFIG_LOADADDR)
180 #define CONFIG_SYS_FDT_ADDR             _pfx(0x, CONFIG_FDTADDR)
181 #ifndef CONFIG_SYS_LVDS_IF
182 #define DEFAULT_VIDEO_MODE              "VGA"
183 #else
184 #define DEFAULT_VIDEO_MODE              "HSD100PXN1"
185 #endif
186
187 /*
188  * Extra Environment Settings
189  */
190 #ifdef CONFIG_TX6_UBOOT_NOENV
191 #define CONFIG_EXTRA_ENV_SETTINGS                                       \
192         "autostart=no\0"                                                \
193         "autoload=no\0"                                                 \
194         "baseboard=stk5-v3\0"                                           \
195         "bootdelay=-1\0"                                                \
196         "fdtaddr=" xstr(CONFIG_FDTADDR) "\0"                            \
197         "mtdids=" MTDIDS_DEFAULT "\0"                                   \
198         "mtdparts=" MTDPARTS_DEFAULT "\0"
199 #else
200 #define CONFIG_SYS_CPU_CLK_STR          xstr(CONFIG_SYS_MPU_CLK)
201
202 #define CONFIG_EXTRA_ENV_SETTINGS                                       \
203         "autostart=no\0"                                                \
204         "baseboard=stk5-v3\0"                                           \
205         "bootargs_jffs2=run default_bootargs"                           \
206         ";setenv bootargs ${bootargs}"                                  \
207         " root=/dev/mtdblock3 rootfstype=jffs2\0"                       \
208         "bootargs_mmc=run default_bootargs;setenv bootargs ${bootargs}" \
209         MMC_ROOT_STR                                                    \
210         "bootargs_nfs=run default_bootargs;setenv bootargs ${bootargs}" \
211         " root=/dev/nfs nfsroot=${nfs_server}:${nfsroot},nolock"        \
212         " ip=dhcp\0"                                                    \
213         "bootargs_ubifs=run default_bootargs"                           \
214         ";setenv bootargs ${bootargs}"                                  \
215         " ubi.mtd=rootfs root=ubi0:rootfs rootfstype=ubifs\0"           \
216         "bootcmd_jffs2=setenv autostart no;run bootargs_jffs2"          \
217         ";nboot linux\0"                                                \
218         "bootcmd_mmc=setenv autostart no;run bootargs_mmc"              \
219         ";fatload mmc 0 ${loadaddr} uImage\0"                           \
220         CONFIG_SYS_BOOT_CMD_NAND                                        \
221         "bootcmd_net=setenv autoload y;setenv autostart n"              \
222         ";run bootargs_nfs"                                             \
223         ";dhcp\0"                                                       \
224         "bootm_cmd=bootm ${loadaddr} - ${fdtaddr}\0"                    \
225         "boot_mode=" CONFIG_SYS_DEFAULT_BOOT_MODE "\0"                  \
226         "cpu_clk=" CONFIG_SYS_CPU_CLK_STR "\0"                          \
227         "default_bootargs=setenv bootargs " CONFIG_BOOTARGS             \
228         " ${append_bootargs}\0"                                         \
229         EMMC_BOOT_PART_STR                                              \
230         EMMC_BOOT_ACK_STR                                               \
231         "fdtaddr=" xstr(CONFIG_FDTADDR) "\0"                            \
232         FDT_HIGH_STR                                                    \
233         FDTSAVE_CMD_STR                                                 \
234         "mtdids=" MTDIDS_DEFAULT "\0"                                   \
235         "mtdparts=" MTDPARTS_DEFAULT "\0"                               \
236         "nfsroot=/tftpboot/rootfs\0"                                    \
237         "otg_mode=device\0"                                             \
238         ROOTPART_UUID_STR                                               \
239         "silent=1\0"                                                    \
240         "touchpanel=tsc2007\0"                                          \
241         "video_mode=" DEFAULT_VIDEO_MODE "\0"
242 #endif /*  CONFIG_ENV_IS_NOWHERE */
243
244 #ifdef CONFIG_TX6_NAND
245 #define CONFIG_SYS_DEFAULT_BOOT_MODE    "nand"
246 #define CONFIG_SYS_BOOT_CMD_NAND                                        \
247         "bootcmd_nand=setenv autostart no;run bootargs_ubifs;nboot linux\0"
248 #define FDTSAVE_CMD_STR                                                 \
249         "fdtsave=fdt resize;nand erase.part dtb"                        \
250         ";nand write ${fdtaddr} dtb ${fdtsize}\0"
251 #define MTD_NAME                        "gpmi-nand"
252 #define MTDIDS_DEFAULT                  "nand0=" MTD_NAME
253 #define CONFIG_SYS_NAND_ONFI_DETECTION
254 #define MMC_ROOT_STR " root=/dev/mmcblk0p2 rootwait\0"
255 #define ROOTPART_UUID_STR               ""
256 #define EMMC_BOOT_ACK_STR               ""
257 #define EMMC_BOOT_PART_STR              ""
258 #else
259 #define CONFIG_SYS_DEFAULT_BOOT_MODE    "mmc"
260 #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1
261 #define CONFIG_SYS_BOOT_CMD_NAND        ""
262 #define FDTSAVE_CMD_STR                                                 \
263         "fdtsave=mmc partconf 0 ${emmc_boot_ack} ${emmc_boot_part} ${emmc_boot_part}" \
264         ";mmc write ${fdtaddr} " xstr(CONFIG_SYS_DTB_BLKNO) " 80"       \
265         ";mmc partconf 0 ${emmc_boot_ack} ${emmc_boot_part} 0\0"
266 #define MTD_NAME                        ""
267 #define MTDIDS_DEFAULT                  ""
268 #define MMC_ROOT_STR " root=PARTUUID=${rootpart_uuid} rootwait\0"
269 #define ROOTPART_UUID_STR "rootpart_uuid=0cc66cc0-02\0"
270 #define EMMC_BOOT_ACK_STR               "emmc_boot_ack=1\0"
271 #define EMMC_BOOT_PART_STR              "emmc_boot_part="       \
272         xstr(CONFIG_SYS_MMCSD_FS_BOOT_PARTITION) "\0"
273 #endif /* CONFIG_TX6_NAND */
274
275 /*
276  * Serial Driver
277  */
278 #define CONFIG_MXC_UART
279 #define CONFIG_MXC_UART_BASE            UART1_BASE
280 #define CONFIG_BAUDRATE                 115200          /* Default baud rate */
281 #define CONFIG_SYS_BAUDRATE_TABLE       { 9600, 19200, 38400, 57600, 115200, }
282 #define CONFIG_SYS_CONSOLE_INFO_QUIET
283 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
284 #define CONFIG_SILENT_CONSOLE
285 #define CONFIG_SILENT_CONSOLE_UPDATE_ON_SET
286 #define CONFIG_SILENT_CONSOLE_UPDATE_ON_RELOC
287 #define CONFIG_SILENT_U_BOOT_ONLY
288 #define CONFIG_SYS_DEVICE_NULLDEV
289 #define CONFIG_CONS_INDEX               1
290
291 /*
292  * GPIO driver
293  */
294 #define CONFIG_MXC_GPIO
295
296 /*
297  * Ethernet Driver
298  */
299 #ifdef CONFIG_FEC_MXC
300 /* This is required for the FEC driver to work with cache enabled */
301 #define CONFIG_SYS_ARM_CACHE_WRITETHROUGH
302
303 #ifndef CONFIG_SOC_MX6UL
304 #define CONFIG_FEC_MXC_PHYADDR          0
305 #define IMX_FEC_BASE                    ENET_BASE_ADDR
306 #else
307 #define FEC_MDIO_BASE_ADDR              ENET_BASE_ADDR
308 #endif
309 #define CONFIG_FEC_XCV_TYPE             RMII
310 #endif
311
312 /*
313  * I2C Configs
314  */
315 #ifdef CONFIG_HARD_I2C
316 #define CONFIG_SYS_I2C_BASE             I2C1_BASE_ADDR
317 #define CONFIG_SYS_I2C_SPEED            400000
318 #endif /* CONFIG_HARD_I2C */
319 #if defined(CONFIG_TX6_REV)
320 #if CONFIG_TX6_REV == 0x1
321 #define CONFIG_LTC3676
322 #elif CONFIG_TX6_REV == 0x3
323 #define CONFIG_RN5T567
324 #else
325 #error Unsupported TX6 module revision
326 #endif
327 #else /* CONFIG_TX6_REV */
328 #ifdef CONFIG_SOC_MX6UL
329 #ifdef CONFIG_SYS_I2C_SOFT
330 /* NOENV U-Boot is used for initial bootstrap.
331  * Since the TAMPER_PIN_DISABLE fuses have to be programmed
332  * to be able to use the TAMPER pins as GPIO to access the
333  * PMIC I2C bus, this is not possible on virgin hardware.
334  */
335 #define CONFIG_SYS_I2C_SOFT_SPEED       400000
336 #define CONFIG_SYS_I2C_SPEED            CONFIG_SYS_I2C_SOFT_SPEED
337 #define CONFIG_SOFT_I2C_GPIO_SCL        IMX_GPIO_NR(5, 0)
338 #define CONFIG_SOFT_I2C_GPIO_SDA        IMX_GPIO_NR(5, 1)
339 #define CONFIG_SOFT_I2C_READ_REPEATED_START
340 #endif /* CONFIG_SYS_I2C_SOFT */
341 #else /* !CONFIG_SOC_MX6UL */
342 /* autodetect which PMIC is present to derive TX6_REV */
343 #define CONFIG_LTC3676                  /* TX6_REV == 1 */
344 #endif /*  CONFIG_SOC_MX6UL */
345 #define CONFIG_RN5T567                  /* TX6_REV == 3 */
346 #endif /* CONFIG_TX6_REV */
347
348 #define CONFIG_ENV_OVERWRITE
349
350 /*
351  * NAND flash driver
352  */
353 #ifdef CONFIG_TX6_NAND
354 #define CONFIG_SYS_MXS_DMA_CHANNEL      4
355 #define CONFIG_SYS_MAX_FLASH_BANKS      0x1
356 #define CONFIG_SYS_NAND_MAX_CHIPS       0x1
357 #define CONFIG_SYS_MAX_NAND_DEVICE      0x1
358 #define CONFIG_SYS_NAND_BASE            0x00000000
359 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
360
361 #define CONFIG_ENV_OFFSET               (CONFIG_U_BOOT_IMG_SIZE + CONFIG_SYS_NAND_U_BOOT_OFFS)
362 #define CONFIG_ENV_SIZE                 SZ_128K
363 #define CONFIG_ENV_RANGE                (3 * CONFIG_SYS_NAND_BLOCK_SIZE)
364 #endif /* CONFIG_TX6_NAND */
365
366 #ifdef CONFIG_ENV_OFFSET_REDUND
367 #define CONFIG_SYS_ENV_PART_STR         xstr(CONFIG_SYS_ENV_PART_SIZE)  \
368         "(env),"                                                        \
369         xstr(CONFIG_SYS_ENV_PART_SIZE)                                  \
370         "(env2),"
371 #define CONFIG_SYS_USERFS_PART_STR      xstr(CONFIG_SYS_USERFS_PART_SIZE) "(userfs)"
372 #else
373 #define CONFIG_SYS_ENV_PART_STR         xstr(CONFIG_SYS_ENV_PART_SIZE)  \
374         "(env),"
375 #define CONFIG_SYS_USERFS_PART_STR      xstr(CONFIG_SYS_USERFS_PART_SIZE2) "(userfs)"
376 #endif /* CONFIG_ENV_OFFSET_REDUND */
377
378 /*
379  * MMC Driver
380  */
381 #ifdef CONFIG_FSL_ESDHC
382 #define CONFIG_SYS_FSL_ESDHC_ADDR       0
383 #endif
384 #ifdef CONFIG_CMD_MMC
385 #define CONFIG_CMD_FAT
386 #define CONFIG_FAT_WRITE
387 #define CONFIG_CMD_EXT2
388
389 /*
390  * Environments on MMC
391  */
392 #ifdef CONFIG_ENV_IS_IN_MMC
393 #define CONFIG_SYS_MMC_ENV_DEV          0
394 #define CONFIG_SYS_MMC_ENV_PART         0x1
395 #define CONFIG_DYNAMIC_MMC_DEVNO
396 #endif /* CONFIG_ENV_IS_IN_MMC */
397 #endif /* CONFIG_CMD_MMC */
398
399 #ifdef CONFIG_TX6_NAND
400 #define MTDPARTS_DEFAULT                "mtdparts=" MTD_NAME ":"        \
401         xstr(CONFIG_SYS_U_BOOT_PART_SIZE)                               \
402         "@" xstr(CONFIG_SYS_NAND_U_BOOT_OFFS)                           \
403         "(u-boot),"                                                     \
404         CONFIG_SYS_ENV_PART_STR                                         \
405         "6m(linux),32m(rootfs)," CONFIG_SYS_USERFS_PART_STR ","         \
406         xstr(CONFIG_SYS_DTB_PART_SIZE)                                  \
407         "@" xstr(CONFIG_SYS_NAND_DTB_OFFSET) "(dtb),"                   \
408         xstr(CONFIG_SYS_NAND_BBT_SIZE)                                  \
409         "@" xstr(CONFIG_SYS_NAND_BBT_OFFSET) "(bbt)ro"
410 #else
411 #define MTDPARTS_DEFAULT                ""
412 #endif
413
414 #define CONFIG_SYS_SDRAM_BASE           PHYS_SDRAM_1
415 #define CONFIG_SYS_INIT_SP_ADDR         (CONFIG_SYS_SDRAM_BASE + 0x1000 - /* Fix this */ \
416                                         GENERATED_GBL_DATA_SIZE)
417
418 #endif /* __CONFIG_H */