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