karo: tx6: add support for TX6 HW Rev. 3
[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                  10001000
135 #define CONFIG_SYS_LOAD_ADDR            _pfx(0x, CONFIG_LOADADDR)
136 #define CONFIG_SYS_FDT_ADDR             _pfx(0x, CONFIG_FDTADDR)
137 #define CONFIG_IMX_WATCHDOG
138 #define CONFIG_WATCHDOG_TIMEOUT_MSECS   3000
139 #ifndef CONFIG_SYS_LVDS_IF
140 #define DEFAULT_VIDEO_MODE              "VGA"
141 #else
142 #define DEFAULT_VIDEO_MODE              "HSD100PXN1"
143 #endif
144
145 /*
146  * Extra Environments
147  */
148 #ifndef CONFIG_MFG
149 #ifdef CONFIG_ENV_IS_NOWHERE
150 #define CONFIG_EXTRA_ENV_SETTINGS                                       \
151         "autostart=no\0"                                                \
152         "autoload=no\0"                                                 \
153         "bootdelay=-1\0"                                                \
154         "fdtaddr=" xstr(CONFIG_FDTADDR) "\0"                            \
155         "mtdids=" MTDIDS_DEFAULT "\0"                                   \
156         "mtdparts=" MTDPARTS_DEFAULT "\0"
157 #else
158 #define CONFIG_EXTRA_ENV_SETTINGS                                       \
159         "autostart=no\0"                                                \
160         "baseboard=stk5-v3\0"                                           \
161         "bootargs_jffs2=run default_bootargs;set bootargs ${bootargs}"  \
162         " root=/dev/mtdblock3 rootfstype=jffs2\0"                       \
163         "bootargs_mmc=run default_bootargs;set bootargs ${bootargs}"    \
164         MMC_ROOT_STR                                                    \
165         "bootargs_nfs=run default_bootargs;set bootargs ${bootargs}"    \
166         " root=/dev/nfs nfsroot=${nfs_server}:${nfsroot},nolock"        \
167         " ip=dhcp\0"                                                    \
168         "bootargs_ubifs=run default_bootargs;set bootargs ${bootargs}"  \
169         " ubi.mtd=rootfs root=ubi0:rootfs rootfstype=ubifs\0"           \
170         "bootcmd_jffs2=set autostart no;run bootargs_jffs2"             \
171         ";nboot linux\0"                                                \
172         "bootcmd_mmc=set autostart no;run bootargs_mmc"                 \
173         ";fatload mmc 0 ${loadaddr} uImage\0"                           \
174         CONFIG_SYS_BOOT_CMD_NAND                                        \
175         "bootcmd_net=set autoload y;set autostart n;run bootargs_nfs"   \
176         ";dhcp\0"                                                       \
177         "bootm_cmd=bootm ${loadaddr} - ${fdtaddr}\0"                    \
178         "boot_mode=" CONFIG_SYS_DEFAULT_BOOT_MODE "\0"                  \
179         "cpu_clk=800\0"                                                 \
180         "default_bootargs=set bootargs " CONFIG_BOOTARGS                \
181         " ${append_bootargs}\0"                                         \
182         "fdtaddr=" xstr(CONFIG_FDTADDR) "\0"                            \
183         CONFIG_SYS_FDTSAVE_CMD                                          \
184         "mtdids=" MTDIDS_DEFAULT "\0"                                   \
185         "mtdparts=" MTDPARTS_DEFAULT "\0"                               \
186         "nfsroot=/tftpboot/rootfs\0"                                    \
187         "otg_mode=device\0"                                             \
188         ROOTPART_UUID_STR                                               \
189         "touchpanel=tsc2007\0"                                          \
190         "video_mode=" DEFAULT_VIDEO_MODE "\0"
191 #endif /*  CONFIG_ENV_IS_NOWHERE */
192 #endif /*  CONFIG_MFG */
193
194 #ifndef CONFIG_NO_NAND
195 #define CONFIG_SYS_DEFAULT_BOOT_MODE "nand"
196 #define CONFIG_SYS_BOOT_CMD_NAND                                        \
197         "bootcmd_nand=set autostart no;run bootargs_ubifs;nboot linux\0"
198 #define CONFIG_SYS_FDTSAVE_CMD                                          \
199         "fdtsave=fdt resize;nand erase.part dtb"                        \
200         ";nand write ${fdtaddr} dtb ${fdtsize}\0"
201 #define MTD_NAME                        "gpmi-nand"
202 #define MTDIDS_DEFAULT                  "nand0=" MTD_NAME
203 #define CONFIG_SYS_NAND_ONFI_DETECTION
204 #define MMC_ROOT_STR " root=dev/mmcblk0p2 rootwait\0"
205 #define ROOTPART_UUID_STR ""
206 #else
207 #define CONFIG_SYS_DEFAULT_BOOT_MODE "mmc"
208 #define CONFIG_SYS_BOOT_CMD_NAND ""
209 #define CONFIG_SYS_FDTSAVE_CMD                                          \
210         "fdtsave=mmc open 0 1;mmc write ${fdtaddr} "                    \
211         xstr(CONFIG_SYS_DTB_BLKNO) " 80;mmc close 0 1\0"
212 #define MMC_ROOT_STR " root=PARTUUID=${rootpart_uuid} rootwait\0"
213 #define ROOTPART_UUID_STR "rootpart_uuid=0cc66cc0-02\0"
214 #define MTD_NAME                        ""
215 #define MTDIDS_DEFAULT                  ""
216 #define CONFIG_SUPPORT_EMMC_BOOT
217 #define CONFIG_MMC_BOOT_DEV             0
218 #endif
219
220 /*
221  * U-Boot Commands
222  */
223 #include <config_cmd_default.h>
224 #define CONFIG_CMD_CACHE
225 #define CONFIG_CMD_MMC
226 #ifndef CONFIG_NO_NAND
227 #define CONFIG_CMD_NAND
228 #define CONFIG_CMD_MTDPARTS
229 #endif
230 #define CONFIG_CMD_BOOTCE
231 #define CONFIG_CMD_BOOTZ
232 #define CONFIG_CMD_TIME
233 #define CONFIG_CMD_I2C
234 #define CONFIG_CMD_MEMTEST
235
236 /*
237  * Serial Driver
238  */
239 #define CONFIG_MXC_UART
240 #define CONFIG_MXC_UART_BASE            UART1_BASE
241 #define CONFIG_BAUDRATE                 115200          /* Default baud rate */
242 #define CONFIG_SYS_BAUDRATE_TABLE       { 9600, 19200, 38400, 57600, 115200, }
243 #define CONFIG_SYS_CONSOLE_INFO_QUIET
244
245 /*
246  * GPIO driver
247  */
248 #define CONFIG_MXC_GPIO
249
250 /*
251  * Ethernet Driver
252  */
253 #define CONFIG_FEC_MXC
254 #ifdef CONFIG_FEC_MXC
255 /* This is required for the FEC driver to work with cache enabled */
256 #define CONFIG_SYS_ARM_CACHE_WRITETHROUGH
257 #define CONFIG_SYS_CACHELINE_SIZE       64
258
259 #define IMX_FEC_BASE                    ENET_BASE_ADDR
260 #define CONFIG_FEC_MXC_PHYADDR          0
261 #define CONFIG_PHYLIB
262 #define CONFIG_PHY_SMSC
263 #define CONFIG_MII
264 #define CONFIG_FEC_XCV_TYPE             RMII
265 #define CONFIG_GET_FEC_MAC_ADDR_FROM_IIM
266 #define CONFIG_CMD_MII
267 #define CONFIG_CMD_DHCP
268 #define CONFIG_CMD_PING
269 /* Add for working with "strict" DHCP server */
270 #define CONFIG_BOOTP_SUBNETMASK
271 #define CONFIG_BOOTP_GATEWAY
272 #define CONFIG_BOOTP_DNS
273 #endif
274
275 /*
276  * I2C Configs
277  */
278 #ifdef CONFIG_CMD_I2C
279 #define CONFIG_HARD_I2C
280 #define CONFIG_I2C_MXC
281 #define CONFIG_SYS_I2C_BASE             I2C1_BASE_ADDR
282 #define CONFIG_SYS_I2C_MX6_PORT1
283 #define CONFIG_SYS_I2C_SPEED            400000
284 #if CONFIG_TX6_REV == 0x1
285 #define CONFIG_SYS_I2C_SLAVE            0x3c
286 #define CONFIG_LTC3676
287 #elif CONFIG_TX6_REV == 0x2
288 #define CONFIG_SYS_I2C_SLAVE            0x32
289 #define CONFIG_RN5T618
290 #elif CONFIG_TX6_REV == 0x3
291 #define CONFIG_SYS_I2C_SLAVE            0x33
292 #define CONFIG_RN5T567
293 #else
294 #error Unsupported TX6 module revision
295 #endif
296 #endif
297
298 #ifndef CONFIG_ENV_IS_NOWHERE
299 /* define one of the following options:
300 #define CONFIG_ENV_IS_IN_NAND
301 #define CONFIG_ENV_IS_IN_MMC
302 */
303 #define CONFIG_ENV_IS_IN_NAND
304 #endif
305 #define CONFIG_ENV_OVERWRITE
306
307 /*
308  * NAND flash driver
309  */
310 #ifndef CONFIG_NO_NAND
311 #define CONFIG_MTD_DEVICE
312 #if 0
313 #define CONFIG_MTD_DEBUG
314 #define CONFIG_MTD_DEBUG_VERBOSE        4
315 #endif
316 #define CONFIG_NAND_MXS
317 #define CONFIG_NAND_MXS_NO_BBM_SWAP
318 #define CONFIG_APBH_DMA
319 #define CONFIG_APBH_DMA_BURST
320 #define CONFIG_APBH_DMA_BURST8
321 #define CONFIG_CMD_NAND_TRIMFFS
322 #define CONFIG_SYS_MXS_DMA_CHANNEL      4
323 #define CONFIG_SYS_MAX_FLASH_BANKS      1
324 #define CONFIG_SYS_NAND_MAX_CHIPS       1
325 #define CONFIG_SYS_MAX_NAND_DEVICE      1
326 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
327 #define CONFIG_SYS_NAND_USE_FLASH_BBT
328 #define CONFIG_SYS_NAND_BASE            0x00000000
329 #define CONFIG_CMD_ROMUPDATE
330
331 #define CONFIG_ENV_OFFSET               (CONFIG_U_BOOT_IMG_SIZE + CONFIG_SYS_NAND_U_BOOT_OFFS)
332 #define CONFIG_ENV_SIZE                 SZ_128K
333 #define CONFIG_ENV_RANGE                (3 * CONFIG_SYS_NAND_BLOCK_SIZE)
334 #else
335 #undef CONFIG_ENV_IS_IN_NAND
336 #endif /* CONFIG_NO_NAND */
337
338 #ifdef CONFIG_ENV_OFFSET_REDUND
339 #define CONFIG_SYS_ENV_PART_STR         xstr(CONFIG_SYS_ENV_PART_SIZE)  \
340         "(env),"                                                        \
341         xstr(CONFIG_SYS_ENV_PART_SIZE)                                  \
342         "(env2),"
343 #define CONFIG_SYS_USERFS_PART_STR      xstr(CONFIG_SYS_USERFS_PART_SIZE) "(userfs)"
344 #else
345 #define CONFIG_SYS_ENV_PART_STR         xstr(CONFIG_SYS_ENV_PART_SIZE)  \
346         "(env),"
347 #define CONFIG_SYS_USERFS_PART_STR      xstr(CONFIG_SYS_USERFS_PART_SIZE2) "(userfs)"
348 #endif /* CONFIG_ENV_OFFSET_REDUND */
349
350 /*
351  * MMC Driver
352  */
353 #ifdef CONFIG_CMD_MMC
354 #define CONFIG_MMC
355 #define CONFIG_GENERIC_MMC
356 #define CONFIG_FSL_ESDHC
357 #define CONFIG_FSL_USDHC
358 #define CONFIG_SYS_FSL_ESDHC_ADDR       0
359
360 #define CONFIG_DOS_PARTITION
361 #define CONFIG_CMD_FAT
362 #define CONFIG_FAT_WRITE
363 #define CONFIG_CMD_EXT2
364
365 /*
366  * Environments on MMC
367  */
368 #ifdef CONFIG_ENV_IS_IN_MMC
369 #define CONFIG_SYS_MMC_ENV_DEV          0
370 #define CONFIG_SYS_MMC_ENV_PART         1
371 #define CONFIG_DYNAMIC_MMC_DEVNO
372 #endif /* CONFIG_ENV_IS_IN_MMC */
373 #else
374 #undef CONFIG_ENV_IS_IN_MMC
375 #endif /* CONFIG_CMD_MMC */
376
377 #ifdef CONFIG_ENV_IS_NOWHERE
378 #undef CONFIG_ENV_SIZE
379 #define CONFIG_ENV_SIZE                 SZ_4K
380 #endif
381
382 #ifndef CONFIG_NO_NAND
383 #define MTDPARTS_DEFAULT                "mtdparts=" MTD_NAME ":"        \
384         xstr(CONFIG_SYS_U_BOOT_PART_SIZE)                               \
385         "@" xstr(CONFIG_SYS_NAND_U_BOOT_OFFS)                           \
386         "(u-boot),"                                                     \
387         CONFIG_SYS_ENV_PART_STR                                         \
388         "6m(linux),32m(rootfs)," CONFIG_SYS_USERFS_PART_STR ","         \
389         xstr(CONFIG_SYS_DTB_PART_SIZE)                                  \
390         "@" xstr(CONFIG_SYS_NAND_DTB_OFFSET) "(dtb),"                   \
391         xstr(CONFIG_SYS_NAND_BBT_SIZE)                                  \
392         "@" xstr(CONFIG_SYS_NAND_BBT_OFFSET) "(bbt)ro"
393 #else
394 #define MTDPARTS_DEFAULT                ""
395 #endif
396
397 #define CONFIG_SYS_SDRAM_BASE           PHYS_SDRAM_1
398 #define CONFIG_SYS_INIT_SP_ADDR         (CONFIG_SYS_SDRAM_BASE + 0x1000 - /* Fix this */ \
399                                         GENERATED_GBL_DATA_SIZE)
400
401 #endif /* __CONFIG_H */