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