Merge branch 'karo-tx-uboot' into kc-merge
[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 #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_COLOR32
37 #define CONFIG_CMD_BMP
38 #define CONFIG_VIDEO_BMP_RLE8
39 #endif /* CONFIG_LCD */
40 #endif /* CONFIG_TX6_UBOOT_MFG */
41
42 /*
43  * Memory configuration options
44  */
45 #define CONFIG_NR_DRAM_BANKS            0x1             /* # 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 #elif defined(CONFIG_SYS_SDRAM_BUS_WIDTH_32)
50 #define PHYS_SDRAM_1_WIDTH              32
51 #elif defined(CONFIG_SYS_SDRAM_BUS_WIDTH_16)
52 #define PHYS_SDRAM_1_WIDTH              16
53 #else
54 #define PHYS_SDRAM_1_WIDTH              64
55 #endif
56 #define PHYS_SDRAM_1_SIZE               (SZ_512M / 32 * PHYS_SDRAM_1_WIDTH)
57 #ifdef CONFIG_SOC_MX6Q
58 #define CONFIG_SYS_SDRAM_CLK            528
59 #else
60 #define CONFIG_SYS_SDRAM_CLK            400
61 #endif
62 #define CONFIG_STACKSIZE                SZ_128K
63 #define CONFIG_SPL_STACK                (IRAM_BASE_ADDR + SZ_16K)
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_SOC_MX6Q)
73 #define CONFIG_SYS_PROMPT               "TX6Q U-Boot > "
74 #elif defined(CONFIG_SOC_MX6DL)
75 #define CONFIG_SYS_PROMPT               "TX6DL U-Boot > "
76 #elif defined(CONFIG_SOC_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 #define DEFAULT_BOOTCMD                 "run bootcmd_${boot_mode} bootm_cmd"
121 #ifndef CONFIG_TX6_UBOOT_MFG
122 #define CONFIG_BOOTFILE                 "uImage"
123 #define CONFIG_BOOTARGS                 "init=/linuxrc console=ttymxc0,115200 ro debug panic=1"
124 #define CONFIG_BOOTCOMMAND              DEFAULT_BOOTCMD
125 #else
126 #define CONFIG_BOOTCOMMAND              "set bootcmd '" DEFAULT_BOOTCMD "';" \
127         "env import " xstr(CONFIG_BOOTCMD_MFG_LOADADDR) ";run bootcmd_mfg"
128 #define CONFIG_BOOTCMD_MFG_LOADADDR     10500000
129 #define CONFIG_DELAY_ENVIRONMENT
130 #endif /* CONFIG_TX6_UBOOT_MFG */
131 #define CONFIG_LOADADDR                 18000000
132 #define CONFIG_FDTADDR                  11000000
133 #define CONFIG_SYS_LOAD_ADDR            _pfx(0x, CONFIG_LOADADDR)
134 #define CONFIG_SYS_FDT_ADDR             _pfx(0x, CONFIG_FDTADDR)
135 #ifndef CONFIG_SYS_LVDS_IF
136 #define DEFAULT_VIDEO_MODE              "VGA"
137 #else
138 #define DEFAULT_VIDEO_MODE              "HSD100PXN1"
139 #endif
140
141 /*
142  * Extra Environments
143  */
144 #ifndef CONFIG_TX6_UBOOT_MFG
145 #ifdef CONFIG_ENV_IS_NOWHERE
146 #define CONFIG_EXTRA_ENV_SETTINGS                                       \
147         "autostart=no\0"                                                \
148         "autoload=no\0"                                                 \
149         "bootdelay=-1\0"                                                \
150         "fdtaddr=" xstr(CONFIG_FDTADDR) "\0"                            \
151         "mtdids=" MTDIDS_DEFAULT "\0"                                   \
152         "mtdparts=" MTDPARTS_DEFAULT "\0"
153 #else
154 #define CONFIG_EXTRA_ENV_SETTINGS                                       \
155         "autostart=no\0"                                                \
156         "baseboard=stk5-v3\0"                                           \
157         "bootargs_jffs2=run default_bootargs;set bootargs ${bootargs}"  \
158         " root=/dev/mtdblock3 rootfstype=jffs2\0"                       \
159         "bootargs_mmc=run default_bootargs;set bootargs ${bootargs}"    \
160         MMC_ROOT_STR                                                    \
161         "bootargs_nfs=run default_bootargs;set bootargs ${bootargs}"    \
162         " root=/dev/nfs nfsroot=${nfs_server}:${nfsroot},nolock"        \
163         " ip=dhcp\0"                                                    \
164         "bootargs_ubifs=run default_bootargs;set bootargs ${bootargs}"  \
165         " ubi.mtd=rootfs root=ubi0:rootfs rootfstype=ubifs\0"           \
166         "bootcmd_jffs2=set autostart no;run bootargs_jffs2"             \
167         ";nboot linux\0"                                                \
168         "bootcmd_mmc=set autostart no;run bootargs_mmc"                 \
169         ";fatload mmc 0 ${loadaddr} uImage\0"                           \
170         CONFIG_SYS_BOOT_CMD_NAND                                        \
171         "bootcmd_net=set autoload y;set autostart n;run bootargs_nfs"   \
172         ";dhcp\0"                                                       \
173         "bootm_cmd=bootm ${loadaddr} - ${fdtaddr}\0"                    \
174         "boot_mode=" CONFIG_SYS_DEFAULT_BOOT_MODE "\0"                  \
175         "cpu_clk=800\0"                                                 \
176         "default_bootargs=set bootargs " CONFIG_BOOTARGS                \
177         " ${append_bootargs}\0"                                         \
178         EMMC_BOOT_PART_STR                                              \
179         EMMC_BOOT_ACK_STR                                               \
180         "fdtaddr=" xstr(CONFIG_FDTADDR) "\0"                            \
181         CONFIG_SYS_FDTSAVE_CMD                                          \
182         "mtdids=" MTDIDS_DEFAULT "\0"                                   \
183         "mtdparts=" MTDPARTS_DEFAULT "\0"                               \
184         "nfsroot=/tftpboot/rootfs\0"                                    \
185         "otg_mode=device\0"                                             \
186         ROOTPART_UUID_STR                                               \
187         "touchpanel=tsc2007\0"                                          \
188         "video_mode=" DEFAULT_VIDEO_MODE "\0"
189 #endif /*  CONFIG_ENV_IS_NOWHERE */
190 #endif /*  CONFIG_TX6_UBOOT_MFG */
191
192 #ifdef CONFIG_TX6_NAND
193 #define CONFIG_SYS_DEFAULT_BOOT_MODE    "nand"
194 #define CONFIG_SYS_BOOT_CMD_NAND                                        \
195         "bootcmd_nand=set autostart no;run bootargs_ubifs;nboot linux\0"
196 #define CONFIG_SYS_FDTSAVE_CMD                                          \
197         "fdtsave=fdt resize;nand erase.part dtb"                        \
198         ";nand write ${fdtaddr} dtb ${fdtsize}\0"
199 #define MTD_NAME                        "gpmi-nand"
200 #define MTDIDS_DEFAULT                  "nand0=" MTD_NAME
201 #define CONFIG_SYS_NAND_ONFI_DETECTION
202 #define MMC_ROOT_STR " root=/dev/mmcblk0p2 rootwait\0"
203 #define ROOTPART_UUID_STR               ""
204 #define EMMC_BOOT_ACK_STR               ""
205 #define EMMC_BOOT_PART_STR              ""
206 #else
207 #define CONFIG_SYS_DEFAULT_BOOT_MODE    "mmc"
208 #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1
209 #define CONFIG_SYS_BOOT_CMD_NAND        ""
210 #define CONFIG_SYS_FDTSAVE_CMD                                          \
211         "fdtsave=mmc partconf 0 ${emmc_boot_ack} ${emmc_boot_part} 1"   \
212         ";mmc write ${fdtaddr} " xstr(CONFIG_SYS_DTB_BLKNO) " 80"       \
213         ";mmc partconf 0 ${emmc_boot_ack} ${emmc_boot_part} 0\0"
214 #define MTD_NAME                        ""
215 #define MTDIDS_DEFAULT                  ""
216 #define MMC_ROOT_STR " root=PARTUUID=${rootpart_uuid} rootwait\0"
217 #define ROOTPART_UUID_STR "rootpart_uuid=0cc66cc0-02\0"
218 #define EMMC_BOOT_ACK_STR               "emmc_boot_ack=1\0"
219 #define EMMC_BOOT_PART_STR              "emmc_boot_part="       \
220         xstr(CONFIG_SYS_MMCSD_FS_BOOT_PARTITION) "\0"
221 #endif /* CONFIG_TX6_NAND */
222
223 /*
224  * Serial Driver
225  */
226 #define CONFIG_MXC_UART
227 #define CONFIG_MXC_UART_BASE            UART1_BASE
228 #define CONFIG_BAUDRATE                 115200          /* Default baud rate */
229 #define CONFIG_SYS_BAUDRATE_TABLE       { 9600, 19200, 38400, 57600, 115200, }
230 #define CONFIG_SYS_CONSOLE_INFO_QUIET
231
232 /*
233  * GPIO driver
234  */
235 #define CONFIG_MXC_GPIO
236
237 /*
238  * Ethernet Driver
239  */
240 #ifdef CONFIG_FEC_MXC
241 /* This is required for the FEC driver to work with cache enabled */
242 #define CONFIG_SYS_ARM_CACHE_WRITETHROUGH
243
244 #define IMX_FEC_BASE                    ENET_BASE_ADDR
245 #define CONFIG_FEC_XCV_TYPE             RMII
246 #endif
247
248 /*
249  * I2C Configs
250  */
251 #ifdef CONFIG_SYS_I2C
252 #define CONFIG_SYS_I2C_BASE             I2C1_BASE_ADDR
253 #define CONFIG_SYS_I2C_SPEED            400000
254 #if defined(CONFIG_TX6_REV)
255 #if CONFIG_TX6_REV == 0x1
256 #define CONFIG_SYS_I2C_SLAVE            0x3c
257 #define CONFIG_LTC3676
258 #elif CONFIG_TX6_REV == 0x2
259 #define CONFIG_SYS_I2C_SLAVE            0x32
260 #define CONFIG_RN5T618
261 #elif CONFIG_TX6_REV == 0x3
262 #define CONFIG_SYS_I2C_SLAVE            0x33
263 #define CONFIG_RN5T567
264 #else
265 #error Unsupported TX6 module revision
266 #endif
267 #endif /* CONFIG_TX6_REV */
268 /* autodetect which PMIC is present to derive TX6_REV */
269 #define CONFIG_LTC3676                  /* TX6_REV == 1 */
270 #define CONFIG_RN5T567                  /* TX6_REV == 3 */
271 #endif /* CONFIG_CMD_I2C */
272
273 #define CONFIG_ENV_OVERWRITE
274
275 /*
276  * NAND flash driver
277  */
278 #ifdef CONFIG_TX6_NAND
279 #define CONFIG_SYS_MXS_DMA_CHANNEL      4
280 #define CONFIG_SYS_MAX_FLASH_BANKS      0x1
281 #define CONFIG_SYS_NAND_MAX_CHIPS       0x1
282 #define CONFIG_SYS_MAX_NAND_DEVICE      0x1
283 #define CONFIG_SYS_NAND_BASE            0x00000000
284 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
285
286 #define CONFIG_ENV_OFFSET               (CONFIG_U_BOOT_IMG_SIZE + CONFIG_SYS_NAND_U_BOOT_OFFS)
287 #define CONFIG_ENV_SIZE                 SZ_128K
288 #define CONFIG_ENV_RANGE                (3 * CONFIG_SYS_NAND_BLOCK_SIZE)
289 #else
290 #undef CONFIG_ENV_IS_IN_NAND
291 #endif /* CONFIG_TX6_NAND */
292
293 #ifdef CONFIG_ENV_OFFSET_REDUND
294 #define CONFIG_SYS_ENV_PART_STR         xstr(CONFIG_SYS_ENV_PART_SIZE)  \
295         "(env),"                                                        \
296         xstr(CONFIG_SYS_ENV_PART_SIZE)                                  \
297         "(env2),"
298 #define CONFIG_SYS_USERFS_PART_STR      xstr(CONFIG_SYS_USERFS_PART_SIZE) "(userfs)"
299 #else
300 #define CONFIG_SYS_ENV_PART_STR         xstr(CONFIG_SYS_ENV_PART_SIZE)  \
301         "(env),"
302 #define CONFIG_SYS_USERFS_PART_STR      xstr(CONFIG_SYS_USERFS_PART_SIZE2) "(userfs)"
303 #endif /* CONFIG_ENV_OFFSET_REDUND */
304
305 /*
306  * MMC Driver
307  */
308 #ifdef CONFIG_FSL_ESDHC
309 #define CONFIG_SYS_FSL_ESDHC_ADDR       0
310 #endif
311 #ifdef CONFIG_CMD_MMC
312 #define CONFIG_CMD_FAT
313 #define CONFIG_FAT_WRITE
314 #define CONFIG_CMD_EXT2
315
316 /*
317  * Environments on MMC
318  */
319 #ifdef CONFIG_ENV_IS_IN_MMC
320 #define CONFIG_SYS_MMC_ENV_DEV          0
321 #define CONFIG_SYS_MMC_ENV_PART         0x1
322 #define CONFIG_DYNAMIC_MMC_DEVNO
323 #endif /* CONFIG_ENV_IS_IN_MMC */
324 #else
325 #undef CONFIG_ENV_IS_IN_MMC
326 #endif /* CONFIG_CMD_MMC */
327
328 #ifdef CONFIG_ENV_IS_NOWHERE
329 #undef CONFIG_ENV_SIZE
330 #define CONFIG_ENV_SIZE                 SZ_4K
331 #endif
332
333 #ifdef CONFIG_TX6_NAND
334 #define MTDPARTS_DEFAULT                "mtdparts=" MTD_NAME ":"        \
335         xstr(CONFIG_SYS_U_BOOT_PART_SIZE)                               \
336         "@" xstr(CONFIG_SYS_NAND_U_BOOT_OFFS)                           \
337         "(u-boot),"                                                     \
338         CONFIG_SYS_ENV_PART_STR                                         \
339         "6m(linux),32m(rootfs)," CONFIG_SYS_USERFS_PART_STR ","         \
340         xstr(CONFIG_SYS_DTB_PART_SIZE)                                  \
341         "@" xstr(CONFIG_SYS_NAND_DTB_OFFSET) "(dtb),"                   \
342         xstr(CONFIG_SYS_NAND_BBT_SIZE)                                  \
343         "@" xstr(CONFIG_SYS_NAND_BBT_OFFSET) "(bbt)ro"
344 #else
345 #define MTDPARTS_DEFAULT                ""
346 #endif
347
348 #define CONFIG_SYS_SDRAM_BASE           PHYS_SDRAM_1
349 #define CONFIG_SYS_INIT_SP_ADDR         (CONFIG_SYS_SDRAM_BASE + 0x1000 - /* Fix this */ \
350                                         GENERATED_GBL_DATA_SIZE)
351
352 #endif /* __CONFIG_H */