karo: reset fdtaddr to the original value due to prevent overlap with linux kernel
[karo-tx-uboot.git] / include / configs / tx51.h
1 /*
2  * Copyright (C) 2012-2014 <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 #define CONFIG_MX51                     /* must be set before including imx-regs.h */
12
13 #include <asm/sizes.h>
14 #include <asm/arch/imx-regs.h>
15
16 /*
17  * Ka-Ro TX51 board - SoC configuration
18  */
19 #define CONFIG_SYS_MX5_IOMUX_V3
20 #define CONFIG_MXC_GPIO                 /* GPIO control */
21 #define CONFIG_SYS_MX5_HCLK             24000000
22 #define CONFIG_SYS_DDR_CLKSEL           0
23 #define CONFIG_SYS_HZ                   1000    /* Ticks per second */
24 #define CONFIG_SHOW_ACTIVITY
25 #define CONFIG_DISPLAY_BOARDINFO
26 #define CONFIG_BOARD_LATE_INIT
27 #define CONFIG_BOARD_EARLY_INIT_F
28
29 #if CONFIG_SYS_CPU_CLK == 600
30 #define TX51_MOD_PREFIX                 "6"
31 #elif CONFIG_SYS_CPU_CLK == 800
32 #define TX51_MOD_PREFIX                 "8"
33 #define CONFIG_MX51_PLL_ERRATA
34 #else
35 #error Invalid CPU clock
36 #endif
37
38 /* LCD Logo and Splash screen support */
39 #define CONFIG_LCD
40 #ifdef CONFIG_LCD
41 #define CONFIG_SPLASH_SCREEN
42 #define CONFIG_SPLASH_SCREEN_ALIGN
43 #define CONFIG_VIDEO_IPUV3
44 #define CONFIG_IPUV3_CLK                133000000
45 #define CONFIG_LCD_LOGO
46 #define LCD_BPP                         LCD_COLOR24
47 #define CONFIG_CMD_BMP
48 #define CONFIG_VIDEO_BMP_RLE8
49 #endif /* CONFIG_LCD */
50
51 /*
52  * Memory configuration options
53  */
54 #define PHYS_SDRAM_1                    0x90000000      /* Base address of bank 1 */
55 #define PHYS_SDRAM_1_SIZE               SZ_128M
56 #if CONFIG_NR_DRAM_BANKS > 1
57 #define PHYS_SDRAM_2                    0x98000000      /* Base address of bank 2 */
58 #define PHYS_SDRAM_2_SIZE               SZ_128M
59 #endif
60 #define CONFIG_STACKSIZE                SZ_128K
61 #define CONFIG_SYS_MALLOC_LEN           SZ_8M
62 #define CONFIG_SYS_MEMTEST_START        PHYS_SDRAM_1    /* Memtest start address */
63 #define CONFIG_SYS_MEMTEST_END          (PHYS_SDRAM_1 + SZ_4M)  /* 4 MB RAM test */
64 #define CONFIG_SYS_SDRAM_CLK            166
65 #define CONFIG_SYS_CLKTL_CBCDR          0x01e35100
66
67 /*
68  * U-Boot general configurations
69  */
70 #define CONFIG_SYS_LONGHELP
71 #define CONFIG_SYS_PROMPT               "TX51 U-Boot > "
72 #define CONFIG_SYS_CBSIZE               2048    /* Console I/O buffer size */
73 #define CONFIG_SYS_PBSIZE \
74         (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
75                                                 /* Print buffer size */
76 #define CONFIG_SYS_MAXARGS              256     /* Max number of command args */
77 #define CONFIG_SYS_BARGSIZE             CONFIG_SYS_CBSIZE
78                                                 /* Boot argument buffer size */
79 #define CONFIG_VERSION_VARIABLE                 /* U-BOOT version */
80 #define CONFIG_AUTO_COMPLETE                    /* Command auto complete */
81 #define CONFIG_CMDLINE_EDITING                  /* Command history etc */
82
83 #define CONFIG_SYS_64BIT_VSPRINTF
84 #define CONFIG_SYS_NO_FLASH
85
86 /*
87  * Flattened Device Tree (FDT) support
88 */
89 #define CONFIG_OF_LIBFDT
90 #define CONFIG_OF_BOARD_SETUP
91
92 /*
93  * Boot Linux
94  */
95 #define xstr(s)                         str(s)
96 #define str(s)                          #s
97 #define __pfx(x, s)                     (x##s)
98 #define _pfx(x, s)                      __pfx(x, s)
99
100 #define CONFIG_CMDLINE_TAG
101 #define CONFIG_SETUP_MEMORY_TAGS
102 #define CONFIG_BOOTDELAY                3
103 #define CONFIG_ZERO_BOOTDELAY_CHECK
104 #define CONFIG_SYS_AUTOLOAD             "no"
105 #define CONFIG_BOOTFILE                 "uImage"
106 #define CONFIG_BOOTARGS                 "init=/linuxrc console=ttymxc0,115200 ro debug panic=1"
107 #define CONFIG_BOOTCOMMAND              "run bootcmd_${boot_mode} bootm_cmd"
108 #define CONFIG_LOADADDR                 94000000
109 #define CONFIG_FDTADDR                  91000000
110 #define CONFIG_SYS_LOAD_ADDR            _pfx(0x, CONFIG_LOADADDR)
111 #define CONFIG_SYS_FDT_ADDR             _pfx(0x, CONFIG_FDTADDR)
112 #define CONFIG_U_BOOT_IMG_SIZE          SZ_1M
113 #define CONFIG_HW_WATCHDOG
114
115 /*
116  * Extra Environment Settings
117  */
118 #define CONFIG_SYS_CPU_CLK_STR          xstr(CONFIG_SYS_CPU_CLK)
119
120 #define CONFIG_EXTRA_ENV_SETTINGS                                       \
121         "autostart=no\0"                                                \
122         "baseboard=stk5-v3\0"                                           \
123         "bootargs_jffs2=run default_bootargs;set bootargs ${bootargs}"  \
124         " root=/dev/mtdblock3 rootfstype=jffs2\0"                       \
125         "bootargs_mmc=run default_bootargs;set bootargs ${bootargs}"    \
126         " root=/dev/mmcblk0p2 rootwait\0"                               \
127         "bootargs_nfs=run default_bootargs;set bootargs ${bootargs}"    \
128         " root=/dev/nfs nfsroot=${nfs_server}:${nfsroot},nolock"        \
129         " ip=dhcp\0"                                                    \
130         "bootargs_ubifs=run default_bootargs;set bootargs ${bootargs}"  \
131         " ubi.mtd=rootfs root=ubi0:rootfs rootfstype=ubifs\0"           \
132         "bootcmd_jffs2=set autostart no;run bootargs_jffs2"             \
133         ";nboot linux\0"                                                \
134         "bootcmd_mmc=set autostart no;run bootargs_mmc"                 \
135         ";fatload mmc 0 ${loadaddr} uImage\0"                           \
136         "bootcmd_nand=set autostart no;run bootargs_ubifs"              \
137         ";nboot linux\0"                                                \
138         "bootcmd_net=set autoload y;set autostart n;run bootargs_nfs"   \
139         ";dhcp\0"                                                       \
140         "bootm_cmd=bootm ${loadaddr} - ${fdtaddr}\0"                    \
141         "boot_mode=nand\0"                                              \
142         "cpu_clk=" CONFIG_SYS_CPU_CLK_STR "\0"                          \
143         "default_bootargs=set bootargs " CONFIG_BOOTARGS                \
144         " ${append_bootargs}\0"                                         \
145         "fdtaddr=" xstr(CONFIG_FDTADDR) "\0"                            \
146         "fdtsave=fdt resize;nand erase.part dtb"                        \
147         ";nand write ${fdtaddr} dtb ${fdtsize}\0"                       \
148         "mtdids=" MTDIDS_DEFAULT "\0"                                   \
149         "mtdparts=" MTDPARTS_DEFAULT "\0"                               \
150         "nfsroot=/tftpboot/rootfs\0"                                    \
151         "otg_mode=device\0"                                             \
152         "touchpanel=tsc2007\0"                                          \
153         "video_mode=VGA\0"
154
155 #define MTD_NAME                        "mxc_nand"
156 #define MTDIDS_DEFAULT                  "nand0=" MTD_NAME
157 #define CONFIG_FDT_FIXUP_PARTITIONS
158
159 /*
160  * U-Boot Commands
161  */
162 #include <config_cmd_default.h>
163 #define CONFIG_CMD_CACHE
164 #define CONFIG_CMD_MMC
165 #define CONFIG_CMD_NAND
166 #define CONFIG_CMD_MTDPARTS
167 #define CONFIG_CMD_BOOTCE
168 #define CONFIG_CMD_TIME
169 #define CONFIG_CMD_MEMTEST
170
171 /*
172  * Serial Driver
173  */
174 #define CONFIG_MXC_UART
175 #define CONFIG_MXC_UART_BASE            UART1_BASE
176 #define CONFIG_MXC_GPIO
177 #define CONFIG_BAUDRATE                 115200          /* Default baud rate */
178 #define CONFIG_SYS_BAUDRATE_TABLE       { 9600, 19200, 38400, 57600, 115200, }
179 #define CONFIG_SYS_CONSOLE_INFO_QUIET
180
181 /*
182  * Ethernet Driver
183  */
184 #define CONFIG_FEC_MXC
185 #ifdef CONFIG_FEC_MXC
186 #define IMX_FEC_BASE                    FEC_BASE_ADDR
187 #define CONFIG_FEC_MXC_PHYADDR          0x1f
188 #define CONFIG_PHYLIB
189 #define CONFIG_PHY_SMSC
190 #define CONFIG_MII
191 #define CONFIG_FEC_XCV_TYPE             MII100
192 #define CONFIG_GET_FEC_MAC_ADDR_FROM_IIM
193 #define CONFIG_CMD_MII
194 #define CONFIG_CMD_DHCP
195 #define CONFIG_CMD_PING
196 /* Add for working with "strict" DHCP server */
197 #define CONFIG_BOOTP_SUBNETMASK
198 #define CONFIG_BOOTP_GATEWAY
199 #define CONFIG_BOOTP_DNS
200 #endif
201
202 /*
203  * NAND flash driver
204  */
205 #ifdef CONFIG_CMD_NAND
206 #define CONFIG_MTD_DEVICE
207 #define CONFIG_ENV_IS_IN_NAND
208 #define CONFIG_NAND_MXC
209 #define CONFIG_MXC_NAND_REGS_BASE       NFC_BASE_ADDR_AXI
210 #define CONFIG_MXC_NAND_IP_REGS_BASE    NFC_BASE_ADDR
211 #define CONFIG_MXC_NAND_HWECC
212 #define CONFIG_CMD_NAND_TRIMFFS
213 #define CONFIG_SYS_NAND_MAX_CHIPS       1
214 #define CONFIG_SYS_MAX_NAND_DEVICE      1
215 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
216 #define CONFIG_SYS_NAND_USE_FLASH_BBT
217 #ifdef CONFIG_ENV_IS_IN_NAND
218 #define CONFIG_ENV_OVERWRITE
219 #define CONFIG_ENV_OFFSET               CONFIG_U_BOOT_IMG_SIZE
220 #define CONFIG_ENV_SIZE                 0x20000 /* 128 KiB */
221 #define CONFIG_ENV_RANGE                0x60000
222 #endif
223 #define CONFIG_SYS_NAND_BASE            0x00000000
224 #define CONFIG_CMD_ROMUPDATE
225 #endif /* CONFIG_CMD_NAND */
226
227 /*
228  * MMC Driver
229  */
230 #ifdef CONFIG_CMD_MMC
231 #ifndef CONFIG_ENV_IS_IN_NAND
232 #define CONFIG_ENV_IS_IN_MMC
233 #endif
234 #define CONFIG_MMC
235 #define CONFIG_GENERIC_MMC
236 #define CONFIG_FSL_ESDHC
237 #define CONFIG_SYS_FSL_ESDHC_ADDR       0
238
239 #define CONFIG_DOS_PARTITION
240 #define CONFIG_CMD_FAT
241 #define CONFIG_FAT_WRITE
242 #define CONFIG_CMD_EXT2
243
244 /*
245  * Environments on MMC
246  */
247 #ifdef CONFIG_ENV_IS_IN_MMC
248 #define CONFIG_SYS_MMC_ENV_DEV          0
249 #define CONFIG_ENV_OVERWRITE
250 /* Associated with the MMC layout defined in mmcops.c */
251 #define CONFIG_ENV_OFFSET               SZ_1K
252 #define CONFIG_ENV_SIZE                 (SZ_128K - CONFIG_ENV_OFFSET)
253 #define CONFIG_DYNAMIC_MMC_DEVNO
254 #endif /* CONFIG_ENV_IS_IN_MMC */
255 #endif /* CONFIG_CMD_MMC */
256
257 #ifdef CONFIG_ENV_OFFSET_REDUND
258 #define MTDPARTS_DEFAULT                "mtdparts=" MTD_NAME ":"        \
259         "1m(u-boot),"                                                   \
260         xstr(CONFIG_ENV_RANGE)                                          \
261         "(env),"                                                        \
262         xstr(CONFIG_ENV_RANGE)                                          \
263         "(env2),6m(linux),32m(rootfs),89344k(userfs),512k@0x7f00000(dtb),512k@0x7f80000(bbt)ro"
264 #else
265 #define MTDPARTS_DEFAULT                "mtdparts=" MTD_NAME ":"        \
266         "1m(u-boot),"                                                   \
267         xstr(CONFIG_ENV_RANGE)                                          \
268         "(env),6m(linux),32m(rootfs),89728k(userfs),512k@0x7f00000(dtb),512k@0x7f80000(bbt)ro"
269 #endif
270
271 #define CONFIG_SYS_SDRAM_BASE           PHYS_SDRAM_1
272 #define CONFIG_SYS_INIT_SP_ADDR         (CONFIG_SYS_SDRAM_BASE + 0x1000 - /* Fix this */ \
273                                         GENERATED_GBL_DATA_SIZE)
274
275 #ifdef CONFIG_CMD_IIM
276 #define CONFIG_FSL_IIM
277 #endif
278
279 #endif /* __CONFIG_H */