1e4af07a07a388830dc01dfc22c37225974210f7
[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 #include <linux/sizes.h>
12 #include <asm/arch/imx-regs.h>
13 #include "mx6_common.h"
14
15 /*
16  * Ka-Ro TX6 board - SoC configuration
17  */
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 #define CONFIG_SYS_GENERIC_BOARD
27
28 #ifndef CONFIG_TX6_UBOOT_MFG
29 /* LCD Logo and Splash screen support */
30 #define CONFIG_LCD
31 #ifdef CONFIG_LCD
32 #define CONFIG_SPLASH_SCREEN
33 #define CONFIG_SPLASH_SCREEN_ALIGN
34 #define CONFIG_VIDEO_IPUV3
35 #define CONFIG_IPUV3_CLK                (CONFIG_SYS_SDRAM_CLK * 1000000 / 2)
36 #define CONFIG_LCD_LOGO
37 #define LCD_BPP                         LCD_COLOR32
38 #define CONFIG_CMD_BMP
39 #define CONFIG_VIDEO_BMP_RLE8
40 #endif /* CONFIG_LCD */
41 #endif /* CONFIG_TX6_UBOOT_MFG */
42
43 /*
44  * Memory configuration options
45  */
46 #define CONFIG_NR_DRAM_BANKS            0x1             /* # of SDRAM banks */
47 #define PHYS_SDRAM_1                    0x10000000      /* Base address of bank 1 */
48 #ifdef CONFIG_SYS_SDRAM_BUS_WIDTH
49 #define PHYS_SDRAM_1_WIDTH              CONFIG_SYS_SDRAM_BUS_WIDTH
50 #elif defined(CONFIG_SYS_SDRAM_BUS_WIDTH_32)
51 #define PHYS_SDRAM_1_WIDTH              32
52 #elif defined(CONFIG_SYS_SDRAM_BUS_WIDTH_16)
53 #define PHYS_SDRAM_1_WIDTH              16
54 #else
55 #define PHYS_SDRAM_1_WIDTH              64
56 #endif
57 #define PHYS_SDRAM_1_SIZE               (SZ_512M / 32 * PHYS_SDRAM_1_WIDTH)
58 #ifdef CONFIG_MX6Q
59 #define CONFIG_SYS_SDRAM_CLK            528
60 #else
61 #define CONFIG_SYS_SDRAM_CLK            400
62 #endif
63 #define CONFIG_STACKSIZE                SZ_128K
64 #define CONFIG_SYS_MALLOC_LEN           SZ_8M
65 #define CONFIG_SYS_MEMTEST_START        PHYS_SDRAM_1    /* Memtest start address */
66 #define CONFIG_SYS_MEMTEST_END          (CONFIG_SYS_MEMTEST_START + SZ_4M)
67
68 /*
69  * U-Boot general configurations
70  */
71 #define CONFIG_SYS_LONGHELP
72 #if defined(CONFIG_MX6Q)
73 #define CONFIG_SYS_PROMPT               "TX6Q U-Boot > "
74 #elif defined(CONFIG_MX6DL)
75 #define CONFIG_SYS_PROMPT               "TX6DL U-Boot > "
76 #elif defined(CONFIG_MX6S)
77 #define CONFIG_SYS_PROMPT               "TX6S U-Boot > "
78 #else
79 #error Unsupported i.MX6 processor variant
80 #endif
81 #define CONFIG_SYS_CBSIZE               2048    /* Console I/O buffer size */
82 #define CONFIG_SYS_PBSIZE                                               \
83         (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
84                                                 /* Print buffer size */
85 #define CONFIG_SYS_MAXARGS              256     /* Max number of command args */
86 #define CONFIG_SYS_BARGSIZE             CONFIG_SYS_CBSIZE
87                                                 /* Boot argument buffer size */
88 #define CONFIG_VERSION_VARIABLE                 /* U-BOOT version */
89 #define CONFIG_AUTO_COMPLETE                    /* Command auto complete */
90 #define CONFIG_CMDLINE_EDITING                  /* Command history etc */
91
92 #define CONFIG_SYS_64BIT_VSPRINTF
93
94 /*
95  * Flattened Device Tree (FDT) support
96 */
97 #ifdef CONFIG_OF_LIBFDT
98 #ifdef CONFIG_TX6_NAND
99 #endif
100 #endif /* CONFIG_OF_LIBFDT */
101
102 /*
103  * Boot Linux
104  */
105 #define xstr(s)                         str(s)
106 #define str(s)                          #s
107 #define __pfx(x, s)                     (x##s)
108 #define _pfx(x, s)                      __pfx(x, s)
109
110 #define CONFIG_CMDLINE_TAG
111 #define CONFIG_INITRD_TAG
112 #define CONFIG_SETUP_MEMORY_TAGS
113 #ifndef CONFIG_TX6_UBOOT_MFG
114 #define CONFIG_BOOTDELAY                1
115 #else
116 #define CONFIG_BOOTDELAY                0
117 #endif
118 #define CONFIG_ZERO_BOOTDELAY_CHECK
119 #define CONFIG_SYS_AUTOLOAD             "no"
120 #ifndef CONFIG_TX6_UBOOT_MFG
121 #define CONFIG_BOOTFILE                 "uImage"
122 #define CONFIG_BOOTARGS                 "init=/linuxrc console=ttymxc0,115200 ro debug panic=1"
123 #define CONFIG_BOOTCOMMAND              "run bootcmd_${boot_mode} bootm_cmd"
124 #else
125 #define CONFIG_BOOTCOMMAND              "env import " xstr(CONFIG_BOOTCMD_MFG_LOADADDR) ";run bootcmd_mfg"
126 #define CONFIG_BOOTCMD_MFG_LOADADDR     10500000
127 #define CONFIG_DELAY_ENVIRONMENT
128 #endif /* CONFIG_TX6_UBOOT_MFG */
129 #define CONFIG_LOADADDR                 18000000
130 #define CONFIG_FDTADDR                  11000000
131 #define CONFIG_SYS_LOAD_ADDR            _pfx(0x, CONFIG_LOADADDR)
132 #define CONFIG_SYS_FDT_ADDR             _pfx(0x, CONFIG_FDTADDR)
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_TX6_UBOOT_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_TX6_UBOOT_MFG */
187
188 #ifdef CONFIG_TX6_NAND
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 #ifdef CONFIG_SUPPORT_EMMC_BOOT
211 #endif
212 #endif /* CONFIG_TX6_NAND */
213
214 /*
215  * U-Boot Commands
216  */
217 #include <config_cmd_default.h>
218
219 /*
220  * Serial Driver
221  */
222 #define CONFIG_MXC_UART
223 #define CONFIG_MXC_UART_BASE            UART1_BASE
224 #define CONFIG_BAUDRATE                 115200          /* Default baud rate */
225 #define CONFIG_SYS_BAUDRATE_TABLE       { 9600, 19200, 38400, 57600, 115200, }
226 #define CONFIG_SYS_CONSOLE_INFO_QUIET
227
228 /*
229  * GPIO driver
230  */
231 #define CONFIG_MXC_GPIO
232
233 /*
234  * Ethernet Driver
235  */
236 #ifdef CONFIG_FEC_MXC
237 /* This is required for the FEC driver to work with cache enabled */
238 #define CONFIG_SYS_ARM_CACHE_WRITETHROUGH
239
240 #define IMX_FEC_BASE                    ENET_BASE_ADDR
241 #define CONFIG_FEC_XCV_TYPE             RMII
242 #endif
243
244 /*
245  * I2C Configs
246  */
247 #ifdef CONFIG_SYS_I2C
248 #define CONFIG_SYS_I2C_BASE             I2C1_BASE_ADDR
249 #define CONFIG_SYS_I2C_SPEED            400000
250 #if defined(CONFIG_TX6_REV)
251 #if CONFIG_TX6_REV == 0x1
252 #define CONFIG_SYS_I2C_SLAVE            0x3c
253 #define CONFIG_LTC3676
254 #elif CONFIG_TX6_REV == 0x2
255 #define CONFIG_SYS_I2C_SLAVE            0x32
256 #define CONFIG_RN5T618
257 #elif CONFIG_TX6_REV == 0x3
258 #define CONFIG_SYS_I2C_SLAVE            0x33
259 #define CONFIG_RN5T567
260 #else
261 #error Unsupported TX6 module revision
262 #endif
263 #endif /* CONFIG_TX6_REV */
264 /* autodetect which PMIC is present to derive TX6_REV */
265 #define CONFIG_LTC3676                  /* TX6_REV == 1 */
266 #define CONFIG_RN5T567                  /* TX6_REV == 3 */
267 #endif /* CONFIG_CMD_I2C */
268
269 #define CONFIG_ENV_OVERWRITE
270
271 /*
272  * NAND flash driver
273  */
274 #ifdef CONFIG_TX6_NAND
275 #define CONFIG_SYS_MXS_DMA_CHANNEL      4
276 #define CONFIG_SYS_MAX_FLASH_BANKS      0x1
277 #define CONFIG_SYS_NAND_MAX_CHIPS       0x1
278 #define CONFIG_SYS_MAX_NAND_DEVICE      0x1
279 #define CONFIG_SYS_NAND_BASE            0x00000000
280 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
281
282 #define CONFIG_ENV_OFFSET               (CONFIG_U_BOOT_IMG_SIZE + CONFIG_SYS_NAND_U_BOOT_OFFS)
283 #define CONFIG_ENV_SIZE                 SZ_128K
284 #define CONFIG_ENV_RANGE                (3 * CONFIG_SYS_NAND_BLOCK_SIZE)
285 #else
286 #undef CONFIG_ENV_IS_IN_NAND
287 #endif /* CONFIG_TX6_NAND */
288
289 #ifdef CONFIG_ENV_OFFSET_REDUND
290 #define CONFIG_SYS_ENV_PART_STR         xstr(CONFIG_SYS_ENV_PART_SIZE)  \
291         "(env),"                                                        \
292         xstr(CONFIG_SYS_ENV_PART_SIZE)                                  \
293         "(env2),"
294 #define CONFIG_SYS_USERFS_PART_STR      xstr(CONFIG_SYS_USERFS_PART_SIZE) "(userfs)"
295 #else
296 #define CONFIG_SYS_ENV_PART_STR         xstr(CONFIG_SYS_ENV_PART_SIZE)  \
297         "(env),"
298 #define CONFIG_SYS_USERFS_PART_STR      xstr(CONFIG_SYS_USERFS_PART_SIZE2) "(userfs)"
299 #endif /* CONFIG_ENV_OFFSET_REDUND */
300
301 /*
302  * MMC Driver
303  */
304 #ifdef CONFIG_FSL_ESDHC
305 #define CONFIG_SYS_FSL_ESDHC_ADDR       0
306 #endif
307 #ifdef CONFIG_CMD_MMC
308 #define CONFIG_DOS_PARTITION
309 #define CONFIG_CMD_FAT
310 #define CONFIG_FAT_WRITE
311 #define CONFIG_CMD_EXT2
312
313 /*
314  * Environments on MMC
315  */
316 #ifdef CONFIG_ENV_IS_IN_MMC
317 #define CONFIG_SYS_MMC_ENV_DEV          0
318 #define CONFIG_SYS_MMC_ENV_PART         0x1
319 #define CONFIG_DYNAMIC_MMC_DEVNO
320 #endif /* CONFIG_ENV_IS_IN_MMC */
321 #else
322 #undef CONFIG_ENV_IS_IN_MMC
323 #endif /* CONFIG_CMD_MMC */
324
325 #ifdef CONFIG_ENV_IS_NOWHERE
326 #undef CONFIG_ENV_SIZE
327 #define CONFIG_ENV_SIZE                 SZ_4K
328 #endif
329
330 #ifdef CONFIG_TX6_NAND
331 #define MTDPARTS_DEFAULT                "mtdparts=" MTD_NAME ":"        \
332         xstr(CONFIG_SYS_U_BOOT_PART_SIZE)                               \
333         "@" xstr(CONFIG_SYS_NAND_U_BOOT_OFFS)                           \
334         "(u-boot),"                                                     \
335         CONFIG_SYS_ENV_PART_STR                                         \
336         "6m(linux),32m(rootfs)," CONFIG_SYS_USERFS_PART_STR ","         \
337         xstr(CONFIG_SYS_DTB_PART_SIZE)                                  \
338         "@" xstr(CONFIG_SYS_NAND_DTB_OFFSET) "(dtb),"                   \
339         xstr(CONFIG_SYS_NAND_BBT_SIZE)                                  \
340         "@" xstr(CONFIG_SYS_NAND_BBT_OFFSET) "(bbt)ro"
341 #else
342 #define MTDPARTS_DEFAULT                ""
343 #endif
344
345 #define CONFIG_SYS_SDRAM_BASE           PHYS_SDRAM_1
346 #define CONFIG_SYS_INIT_SP_ADDR         (CONFIG_SYS_SDRAM_BASE + 0x1000 - /* Fix this */ \
347                                         GENERATED_GBL_DATA_SIZE)
348
349 #endif /* __CONFIG_H */