karo: reset fdtaddr to the original value due to prevent overlap with linux kernel
[karo-tx-uboot.git] / include / configs / tx6.h
1 /*
2  * Copyright (C) 2012 <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 #include <asm/sizes.h>
12 #include <asm/arch/imx-regs.h>
13
14 /*
15  * Ka-Ro TX6 board - SoC configuration
16  */
17 #ifndef CONFIG_TX6_REV
18 #define CONFIG_TX6_REV                  0x1             /* '1' would be converted to 'y' by define2mk.sed */
19 #endif
20 #define CONFIG_MX6
21 #define CONFIG_SYS_MX6_HCLK             24000000
22 #define CONFIG_SYS_MX6_CLK32            32768
23 #define CONFIG_SYS_HZ                   1000            /* Ticks per second */
24 #define CONFIG_SHOW_ACTIVITY
25 #define CONFIG_ARCH_CPU_INIT
26 #define CONFIG_DISPLAY_BOARDINFO
27 #define CONFIG_BOARD_LATE_INIT
28 #define CONFIG_BOARD_EARLY_INIT_F
29
30 #ifndef CONFIG_MFG
31 /* LCD Logo and Splash screen support */
32 #define CONFIG_LCD
33 #ifdef CONFIG_LCD
34 #define CONFIG_SPLASH_SCREEN
35 #define CONFIG_SPLASH_SCREEN_ALIGN
36 #define CONFIG_VIDEO_IPUV3
37 #define CONFIG_IPUV3_CLK                (CONFIG_SYS_SDRAM_CLK * 1000000 / 2)
38 #define CONFIG_LCD_LOGO
39 #define LCD_BPP                         LCD_COLOR24
40 #define CONFIG_CMD_BMP
41 #define CONFIG_VIDEO_BMP_RLE8
42 #endif /* CONFIG_LCD */
43 #endif /* CONFIG_MFG */
44
45 /*
46  * Memory configuration options
47  */
48 #define CONFIG_NR_DRAM_BANKS            1               /* # of SDRAM banks */
49 #define PHYS_SDRAM_1                    0x10000000      /* Base address of bank 1 */
50 #ifdef CONFIG_SYS_SDRAM_BUS_WIDTH
51 #define PHYS_SDRAM_1_WIDTH              CONFIG_SYS_SDRAM_BUS_WIDTH
52 #else
53 #define PHYS_SDRAM_1_WIDTH              64
54 #endif
55 #define PHYS_SDRAM_1_SIZE               (SZ_512M / 32 * PHYS_SDRAM_1_WIDTH)
56 #ifdef CONFIG_MX6Q
57 #define CONFIG_SYS_SDRAM_CLK            528
58 #else
59 #define CONFIG_SYS_SDRAM_CLK            400
60 #endif
61 #define CONFIG_STACKSIZE                SZ_128K
62 #define CONFIG_SYS_MALLOC_LEN           SZ_8M
63 #define CONFIG_SYS_MEMTEST_START        PHYS_SDRAM_1    /* Memtest start address */
64 #define CONFIG_SYS_MEMTEST_END          (CONFIG_SYS_MEMTEST_START + SZ_4M)
65
66 /*
67  * U-Boot general configurations
68  */
69 #define CONFIG_SYS_LONGHELP
70 #if defined(CONFIG_MX6Q)
71 #define CONFIG_SYS_PROMPT               "TX6Q U-Boot > "
72 #elif defined(CONFIG_MX6DL)
73 #define CONFIG_SYS_PROMPT               "TX6DL U-Boot > "
74 #elif defined(CONFIG_MX6S)
75 #define CONFIG_SYS_PROMPT               "TX6S U-Boot > "
76 #else
77 #error Unsupported i.MX6 processor variant
78 #endif
79 #define CONFIG_SYS_CBSIZE               2048    /* Console I/O buffer size */
80 #define CONFIG_SYS_PBSIZE                                               \
81         (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
82                                                 /* Print buffer size */
83 #define CONFIG_SYS_MAXARGS              256     /* Max number of command args */
84 #define CONFIG_SYS_BARGSIZE             CONFIG_SYS_CBSIZE
85                                                 /* Boot argument buffer size */
86 #define CONFIG_VERSION_VARIABLE                 /* U-BOOT version */
87 #define CONFIG_AUTO_COMPLETE                    /* Command auto complete */
88 #define CONFIG_CMDLINE_EDITING                  /* Command history etc */
89
90 #define CONFIG_SYS_64BIT_VSPRINTF
91 #define CONFIG_SYS_NO_FLASH
92
93 /*
94  * Flattened Device Tree (FDT) support
95 */
96 #ifndef CONFIG_MFG
97 #define CONFIG_OF_LIBFDT
98 #ifdef CONFIG_OF_LIBFDT
99 #ifndef CONFIG_NO_NAND
100 #define CONFIG_FDT_FIXUP_PARTITIONS
101 #endif
102 #define CONFIG_OF_BOARD_SETUP
103 #endif /* CONFIG_OF_LIBFDT */
104 #endif /* CONFIG_MFG */
105
106 /*
107  * Boot Linux
108  */
109 #define xstr(s)                         str(s)
110 #define str(s)                          #s
111 #define __pfx(x, s)                     (x##s)
112 #define _pfx(x, s)                      __pfx(x, s)
113
114 #define CONFIG_CMDLINE_TAG
115 #define CONFIG_INITRD_TAG
116 #define CONFIG_SETUP_MEMORY_TAGS
117 #ifndef CONFIG_MFG
118 #define CONFIG_BOOTDELAY                1
119 #else
120 #define CONFIG_BOOTDELAY                0
121 #endif
122 #define CONFIG_ZERO_BOOTDELAY_CHECK
123 #define CONFIG_SYS_AUTOLOAD             "no"
124 #ifndef CONFIG_MFG
125 #define CONFIG_BOOTFILE                 "uImage"
126 #define CONFIG_BOOTARGS                 "init=/linuxrc console=ttymxc0,115200 ro debug panic=1"
127 #define CONFIG_BOOTCOMMAND              "run bootcmd_${boot_mode} bootm_cmd"
128 #else
129 #define CONFIG_BOOTCOMMAND              "env import " xstr(CONFIG_BOOTCMD_MFG_LOADADDR) ";run bootcmd_mfg"
130 #define CONFIG_BOOTCMD_MFG_LOADADDR     10500000
131 #define CONFIG_DELAY_ENVIRONMENT
132 #endif /* CONFIG_MFG */
133 #define CONFIG_LOADADDR                 18000000
134 #define CONFIG_FDTADDR                  11000000
135 #define CONFIG_SYS_LOAD_ADDR            _pfx(0x, CONFIG_LOADADDR)
136 #define CONFIG_SYS_FDT_ADDR             _pfx(0x, CONFIG_FDTADDR)
137 #define CONFIG_HW_WATCHDOG
138 #ifndef CONFIG_SYS_LVDS_IF
139 #define DEFAULT_VIDEO_MODE              "VGA"
140 #else
141 #define DEFAULT_VIDEO_MODE              "HSD100PXN1"
142 #endif
143
144 /*
145  * Extra Environments
146  */
147 #ifndef CONFIG_MFG
148 #ifdef CONFIG_ENV_IS_NOWHERE
149 #define CONFIG_EXTRA_ENV_SETTINGS                                       \
150         "autostart=no\0"                                                \
151         "autoload=no\0"                                                 \
152         "bootdelay=-1\0"                                                \
153         "fdtaddr=" xstr(CONFIG_FDTADDR) "\0"                            \
154         "mtdids=" MTDIDS_DEFAULT "\0"                                   \
155         "mtdparts=" MTDPARTS_DEFAULT "\0"
156 #else
157 #define CONFIG_EXTRA_ENV_SETTINGS                                       \
158         "autostart=no\0"                                                \
159         "baseboard=stk5-v3\0"                                           \
160         "bootargs_jffs2=run default_bootargs;set bootargs ${bootargs}"  \
161         " root=/dev/mtdblock3 rootfstype=jffs2\0"                       \
162         "bootargs_mmc=run default_bootargs;set bootargs ${bootargs}"    \
163         MMC_ROOT_STR                                                    \
164         "bootargs_nfs=run default_bootargs;set bootargs ${bootargs}"    \
165         " root=/dev/nfs nfsroot=${nfs_server}:${nfsroot},nolock"        \
166         " ip=dhcp\0"                                                    \
167         "bootargs_ubifs=run default_bootargs;set bootargs ${bootargs}"  \
168         " ubi.mtd=rootfs root=ubi0:rootfs rootfstype=ubifs\0"           \
169         "bootcmd_jffs2=set autostart no;run bootargs_jffs2"             \
170         ";nboot linux\0"                                                \
171         "bootcmd_mmc=set autostart no;run bootargs_mmc"                 \
172         ";fatload mmc 0 ${loadaddr} uImage\0"                           \
173         CONFIG_SYS_BOOT_CMD_NAND                                        \
174         "bootcmd_net=set autoload y;set autostart n;run bootargs_nfs"   \
175         ";dhcp\0"                                                       \
176         "bootm_cmd=bootm ${loadaddr} - ${fdtaddr}\0"                    \
177         "boot_mode=" CONFIG_SYS_DEFAULT_BOOT_MODE "\0"                  \
178         "cpu_clk=800\0"                                                 \
179         "default_bootargs=set bootargs " CONFIG_BOOTARGS                \
180         " ${append_bootargs}\0"                                         \
181         "fdtaddr=" xstr(CONFIG_FDTADDR) "\0"                            \
182         CONFIG_SYS_FDTSAVE_CMD                                          \
183         "mtdids=" MTDIDS_DEFAULT "\0"                                   \
184         "mtdparts=" MTDPARTS_DEFAULT "\0"                               \
185         "nfsroot=/tftpboot/rootfs\0"                                    \
186         "otg_mode=device\0"                                             \
187         ROOTPART_UUID_STR                                               \
188         "touchpanel=tsc2007\0"                                          \
189         "video_mode=" DEFAULT_VIDEO_MODE "\0"
190 #endif /*  CONFIG_ENV_IS_NOWHERE */
191 #endif /*  CONFIG_MFG */
192
193 #ifndef CONFIG_NO_NAND
194 #define CONFIG_SYS_DEFAULT_BOOT_MODE "nand"
195 #define CONFIG_SYS_BOOT_CMD_NAND                                        \
196         "bootcmd_nand=set autostart no;run bootargs_ubifs;nboot linux\0"
197 #define CONFIG_SYS_FDTSAVE_CMD                                          \
198         "fdtsave=fdt resize;nand erase.part dtb"                        \
199         ";nand write ${fdtaddr} dtb ${fdtsize}\0"
200 #define MTD_NAME                        "gpmi-nand"
201 #define MTDIDS_DEFAULT                  "nand0=" MTD_NAME
202 #define CONFIG_SYS_NAND_ONFI_DETECTION
203 #define MMC_ROOT_STR " root=dev/mmcblk0p2 rootwait\0"
204 #define ROOTPART_UUID_STR ""
205 #else
206 #define CONFIG_SYS_DEFAULT_BOOT_MODE "mmc"
207 #define CONFIG_SYS_BOOT_CMD_NAND ""
208 #define CONFIG_SYS_FDTSAVE_CMD                                          \
209         "fdtsave=mmc open 0 1;mmc write ${fdtaddr} "                    \
210         xstr(CONFIG_SYS_DTB_BLKNO) " 80;mmc close 0 1\0"
211 #define MMC_ROOT_STR " root=PARTUUID=${rootpart_uuid} rootwait\0"
212 #define ROOTPART_UUID_STR "rootpart_uuid=0cc66cc0-02\0"
213 #define MTD_NAME                        ""
214 #define MTDIDS_DEFAULT                  ""
215 #define CONFIG_SUPPORT_EMMC_BOOT
216 #define CONFIG_MMC_BOOT_DEV             0
217 #endif
218
219 /*
220  * U-Boot Commands
221  */
222 #include <config_cmd_default.h>
223 #define CONFIG_CMD_CACHE
224 #define CONFIG_CMD_MMC
225 #ifndef CONFIG_NO_NAND
226 #define CONFIG_CMD_NAND
227 #define CONFIG_CMD_MTDPARTS
228 #endif
229 #define CONFIG_CMD_BOOTCE
230 #define CONFIG_CMD_BOOTZ
231 #define CONFIG_CMD_TIME
232 #define CONFIG_CMD_I2C
233 #define CONFIG_CMD_MEMTEST
234
235 /*
236  * Serial Driver
237  */
238 #define CONFIG_MXC_UART
239 #define CONFIG_MXC_UART_BASE            UART1_BASE
240 #define CONFIG_BAUDRATE                 115200          /* Default baud rate */
241 #define CONFIG_SYS_BAUDRATE_TABLE       { 9600, 19200, 38400, 57600, 115200, }
242 #define CONFIG_SYS_CONSOLE_INFO_QUIET
243
244 /*
245  * GPIO driver
246  */
247 #define CONFIG_MXC_GPIO
248
249 /*
250  * Ethernet Driver
251  */
252 #define CONFIG_FEC_MXC
253 #ifdef CONFIG_FEC_MXC
254 /* This is required for the FEC driver to work with cache enabled */
255 #define CONFIG_SYS_ARM_CACHE_WRITETHROUGH
256 #define CONFIG_SYS_CACHELINE_SIZE       64
257
258 #define IMX_FEC_BASE                    ENET_BASE_ADDR
259 #define CONFIG_FEC_MXC_PHYADDR          0
260 #define CONFIG_PHYLIB
261 #define CONFIG_PHY_SMSC
262 #define CONFIG_MII
263 #define CONFIG_FEC_XCV_TYPE             RMII
264 #define CONFIG_GET_FEC_MAC_ADDR_FROM_IIM
265 #define CONFIG_CMD_MII
266 #define CONFIG_CMD_DHCP
267 #define CONFIG_CMD_PING
268 /* Add for working with "strict" DHCP server */
269 #define CONFIG_BOOTP_SUBNETMASK
270 #define CONFIG_BOOTP_GATEWAY
271 #define CONFIG_BOOTP_DNS
272 #endif
273
274 /*
275  * I2C Configs
276  */
277 #ifdef CONFIG_CMD_I2C
278 #define CONFIG_HARD_I2C
279 #define CONFIG_I2C_MXC
280 #define CONFIG_SYS_I2C_BASE             I2C1_BASE_ADDR
281 #define CONFIG_SYS_I2C_MX6_PORT1
282 #define CONFIG_SYS_I2C_SPEED            400000
283 #if CONFIG_TX6_REV == 0x1
284 #define CONFIG_SYS_I2C_SLAVE            0x3c
285 #define CONFIG_LTC3676
286 #elif CONFIG_TX6_REV == 0x2
287 #define CONFIG_SYS_I2C_SLAVE            0x32
288 #define CONFIG_RN5T618
289 #elif CONFIG_TX6_REV == 0x3
290 #define CONFIG_SYS_I2C_SLAVE            0x33
291 #define CONFIG_RN5T567
292 #else
293 #error Unsupported TX6 module revision
294 #endif
295 #endif
296
297 #ifndef CONFIG_ENV_IS_NOWHERE
298 /* define one of the following options:
299 #define CONFIG_ENV_IS_IN_NAND
300 #define CONFIG_ENV_IS_IN_MMC
301 */
302 #define CONFIG_ENV_IS_IN_NAND
303 #endif
304 #define CONFIG_ENV_OVERWRITE
305
306 /*
307  * NAND flash driver
308  */
309 #ifndef CONFIG_NO_NAND
310 #define CONFIG_MTD_DEVICE
311 #if 0
312 #define CONFIG_MTD_DEBUG
313 #define CONFIG_MTD_DEBUG_VERBOSE        4
314 #endif
315 #define CONFIG_NAND_MXS
316 #define CONFIG_NAND_MXS_NO_BBM_SWAP
317 #define CONFIG_APBH_DMA
318 #define CONFIG_APBH_DMA_BURST
319 #define CONFIG_APBH_DMA_BURST8
320 #define CONFIG_CMD_NAND_TRIMFFS
321 #define CONFIG_SYS_MXS_DMA_CHANNEL      4
322 #define CONFIG_SYS_MAX_FLASH_BANKS      1
323 #define CONFIG_SYS_NAND_MAX_CHIPS       1
324 #define CONFIG_SYS_MAX_NAND_DEVICE      1
325 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
326 #define CONFIG_SYS_NAND_USE_FLASH_BBT
327 #define CONFIG_SYS_NAND_BASE            0x00000000
328 #define CONFIG_CMD_ROMUPDATE
329
330 #define CONFIG_ENV_OFFSET               (CONFIG_U_BOOT_IMG_SIZE + CONFIG_SYS_NAND_U_BOOT_OFFS)
331 #define CONFIG_ENV_SIZE                 SZ_128K
332 #define CONFIG_ENV_RANGE                (3 * CONFIG_SYS_NAND_BLOCK_SIZE)
333 #else
334 #undef CONFIG_ENV_IS_IN_NAND
335 #endif /* CONFIG_NO_NAND */
336
337 #ifdef CONFIG_ENV_OFFSET_REDUND
338 #define CONFIG_SYS_ENV_PART_STR         xstr(CONFIG_SYS_ENV_PART_SIZE)  \
339         "(env),"                                                        \
340         xstr(CONFIG_SYS_ENV_PART_SIZE)                                  \
341         "(env2),"
342 #define CONFIG_SYS_USERFS_PART_STR      xstr(CONFIG_SYS_USERFS_PART_SIZE) "(userfs)"
343 #else
344 #define CONFIG_SYS_ENV_PART_STR         xstr(CONFIG_SYS_ENV_PART_SIZE)  \
345         "(env),"
346 #define CONFIG_SYS_USERFS_PART_STR      xstr(CONFIG_SYS_USERFS_PART_SIZE2) "(userfs)"
347 #endif /* CONFIG_ENV_OFFSET_REDUND */
348
349 /*
350  * MMC Driver
351  */
352 #ifdef CONFIG_CMD_MMC
353 #define CONFIG_MMC
354 #define CONFIG_GENERIC_MMC
355 #define CONFIG_FSL_ESDHC
356 #define CONFIG_FSL_USDHC
357 #define CONFIG_SYS_FSL_ESDHC_ADDR       0
358
359 #define CONFIG_DOS_PARTITION
360 #define CONFIG_CMD_FAT
361 #define CONFIG_FAT_WRITE
362 #define CONFIG_CMD_EXT2
363
364 /*
365  * Environments on MMC
366  */
367 #ifdef CONFIG_ENV_IS_IN_MMC
368 #define CONFIG_SYS_MMC_ENV_DEV          0
369 #define CONFIG_SYS_MMC_ENV_PART         1
370 #define CONFIG_DYNAMIC_MMC_DEVNO
371 #endif /* CONFIG_ENV_IS_IN_MMC */
372 #else
373 #undef CONFIG_ENV_IS_IN_MMC
374 #endif /* CONFIG_CMD_MMC */
375
376 #ifdef CONFIG_ENV_IS_NOWHERE
377 #undef CONFIG_ENV_SIZE
378 #define CONFIG_ENV_SIZE                 SZ_4K
379 #endif
380
381 #ifndef CONFIG_NO_NAND
382 #define MTDPARTS_DEFAULT                "mtdparts=" MTD_NAME ":"        \
383         xstr(CONFIG_SYS_U_BOOT_PART_SIZE)                               \
384         "@" xstr(CONFIG_SYS_NAND_U_BOOT_OFFS)                           \
385         "(u-boot),"                                                     \
386         CONFIG_SYS_ENV_PART_STR                                         \
387         "6m(linux),32m(rootfs)," CONFIG_SYS_USERFS_PART_STR ","         \
388         xstr(CONFIG_SYS_DTB_PART_SIZE)                                  \
389         "@" xstr(CONFIG_SYS_NAND_DTB_OFFSET) "(dtb),"                   \
390         xstr(CONFIG_SYS_NAND_BBT_SIZE)                                  \
391         "@" xstr(CONFIG_SYS_NAND_BBT_OFFSET) "(bbt)ro"
392 #else
393 #define MTDPARTS_DEFAULT                ""
394 #endif
395
396 #define CONFIG_SYS_SDRAM_BASE           PHYS_SDRAM_1
397 #define CONFIG_SYS_INIT_SP_ADDR         (CONFIG_SYS_SDRAM_BASE + 0x1000 - /* Fix this */ \
398                                         GENERATED_GBL_DATA_SIZE)
399
400 #endif /* __CONFIG_H */