Convert CONFIG_SPL_FAT_SUPPORT to Kconfig
[platform/kernel/u-boot.git] / include / configs / tqma6.h
1 /*
2  * Copyright (C) 2013, 2014 Markus Niebel <Markus.Niebel@tq-group.com>
3  *
4  * Configuration settings for the TQ Systems TQMa6<Q,S> module.
5  *
6  * SPDX-License-Identifier:     GPL-2.0+
7  */
8
9 #ifndef __CONFIG_H
10 #define __CONFIG_H
11
12 #include <linux/kconfig.h>
13 /* SPL */
14 /* #if defined(CONFIG_SPL_BUILD) */
15
16 #define CONFIG_SPL_MMC_SUPPORT
17 #define CONFIG_SPL_SPI_SUPPORT
18
19 /* common IMX6 SPL configuration */
20 #include "imx6_spl.h"
21
22 /* #endif */
23
24 /* place code in last 4 MiB of RAM */
25 #if defined(CONFIG_MX6DL) || defined(CONFIG_MX6S)
26 #define CONFIG_SYS_TEXT_BASE            0x2fc00000
27 #elif defined(CONFIG_MX6Q) || defined(CONFIG_MX6D)
28 #define CONFIG_SYS_TEXT_BASE            0x4fc00000
29 #endif
30
31 #include "mx6_common.h"
32
33 #if defined(CONFIG_MX6DL) || defined(CONFIG_MX6S)
34 #define PHYS_SDRAM_SIZE                 (512u * SZ_1M)
35 #elif defined(CONFIG_MX6Q) || defined(CONFIG_MX6D)
36 #define PHYS_SDRAM_SIZE                 (1024u * SZ_1M)
37 #endif
38
39 #define CONFIG_BOARD_EARLY_INIT_F
40 #define CONFIG_BOARD_LATE_INIT
41
42 #define CONFIG_MXC_UART
43
44 /* SPI */
45 #define CONFIG_MXC_SPI
46
47 /* SPI Flash */
48
49 #define TQMA6_SPI_FLASH_SECTOR_SIZE     SZ_64K
50
51 #define CONFIG_SF_DEFAULT_BUS   0
52 #define CONFIG_SF_DEFAULT_CS    0
53 #define CONFIG_SF_DEFAULT_SPEED 50000000
54 #define CONFIG_SF_DEFAULT_MODE  (SPI_MODE_0)
55
56 /* I2C Configs */
57 #define CONFIG_SYS_I2C
58 #define CONFIG_SYS_I2C_MXC
59 #define CONFIG_SYS_I2C_MXC_I2C1         /* enable I2C bus 1 */
60 #define CONFIG_SYS_I2C_MXC_I2C2         /* enable I2C bus 2 */
61 #define CONFIG_SYS_I2C_MXC_I2C3         /* enable I2C bus 3 */
62 #define CONFIG_I2C_MULTI_BUS
63 #define CONFIG_SYS_I2C_SPEED            100000
64
65 /* I2C SYSMON (LM75) */
66 #define CONFIG_DTT_LM75
67 #define CONFIG_DTT_MAX_TEMP             70
68 #define CONFIG_DTT_MIN_TEMP             -30
69 #define CONFIG_DTT_HYSTERESIS   3
70 #define CONFIG_CMD_DTT
71
72 /* I2C EEPROM (M24C64) */
73 #define CONFIG_SYS_I2C_EEPROM_ADDR                      0x50
74 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN                  2
75 #define CONFIG_SYS_I2C_EEPROM_PAGE_WRITE_BITS           5 /* 32 Bytes */
76 #define CONFIG_SYS_I2C_EEPROM_PAGE_WRITE_DELAY_MS       20
77 #define CONFIG_CMD_EEPROM
78
79 #define CONFIG_POWER
80 #define CONFIG_POWER_I2C
81 #define CONFIG_POWER_PFUZE100
82 #define CONFIG_POWER_PFUZE100_I2C_ADDR  0x08
83 #define TQMA6_PFUZE100_I2C_BUS          2
84
85 /* MMC Configs */
86 #define CONFIG_SYS_FSL_ESDHC_ADDR       0
87
88 /* USB Configs */
89 #define CONFIG_USB_EHCI
90 #define CONFIG_USB_EHCI_MX6
91 #define CONFIG_USB_HOST_ETHER
92 #define CONFIG_USB_ETHER_SMSC95XX
93 #define CONFIG_MXC_USB_PORTSC   (PORT_PTS_UTMI | PORT_PTS_PTW)
94 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
95 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET        /* For OTG port */
96
97 #define CONFIG_FEC_MXC
98 #define IMX_FEC_BASE                    ENET_BASE_ADDR
99 #define CONFIG_PHYLIB
100 #define CONFIG_MII
101
102 #define CONFIG_ARP_TIMEOUT              200UL
103 /* Network config - Allow larger/faster download for TFTP/NFS */
104 #define CONFIG_IP_DEFRAG
105 #define CONFIG_TFTP_BLOCKSIZE   4096
106 #define CONFIG_NFS_READ_SIZE    4096
107
108 /* Command definition */
109 #define CONFIG_CMD_BMODE
110
111 #define CONFIG_ENV_SIZE                 (SZ_8K)
112 /* Size of malloc() pool */
113 #define CONFIG_SYS_MALLOC_LEN           (CONFIG_ENV_SIZE + 2 * SZ_1M)
114
115 #if defined(CONFIG_TQMA6X_MMC_BOOT)
116
117 #define CONFIG_ENV_IS_IN_MMC
118 #define TQMA6_UBOOT_OFFSET              SZ_1K
119 #define TQMA6_UBOOT_SECTOR_START        0x2
120 #define TQMA6_UBOOT_SECTOR_COUNT        0x7fe
121
122 #define CONFIG_ENV_OFFSET               SZ_1M
123 #define CONFIG_SYS_MMC_ENV_DEV          0
124
125 #define TQMA6_FDT_OFFSET                (2 * SZ_1M)
126 #define TQMA6_FDT_SECTOR_START          0x1000
127 #define TQMA6_FDT_SECTOR_COUNT          0x800
128
129 #define TQMA6_KERNEL_SECTOR_START       0x2000
130 #define TQMA6_KERNEL_SECTOR_COUNT       0x2000
131
132 #define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS                                       \
133         "uboot_start="__stringify(TQMA6_UBOOT_SECTOR_START)"\0"                \
134         "uboot_size="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0"                 \
135         "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0"                    \
136         "fdt_size="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0"                     \
137         "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0"              \
138         "kernel_size="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0"               \
139         "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0"                       \
140         "loadimage=mmc dev ${mmcdev}; "                                        \
141                 "mmc read ${loadaddr} ${kernel_start} ${kernel_size};\0"       \
142         "loadfdt=mmc dev ${mmcdev}; "                                          \
143                 "mmc read ${fdt_addr} ${fdt_start} ${fdt_size};\0"             \
144         "update_uboot=if tftp ${uboot}; then "                                 \
145                 "if itest ${filesize} > 0; then "                              \
146                         "mmc dev ${mmcdev}; mmc rescan; "                      \
147                         "setexpr blkc ${filesize} / 0x200; "                   \
148                         "setexpr blkc ${blkc} + 1; "                           \
149                         "if itest ${blkc} <= ${uboot_size}; then "             \
150                                 "mmc write ${loadaddr} ${uboot_start} "        \
151                                         "${blkc}; "                            \
152                         "fi; "                                                 \
153                 "fi; fi; "                                                     \
154                 "setenv filesize; setenv blkc \0"                              \
155         "update_kernel=run kernel_name; "                                      \
156                 "if tftp ${kernel}; then "                                     \
157                         "if itest ${filesize} > 0; then "                      \
158                                 "mmc dev ${mmcdev}; mmc rescan; "              \
159                                 "setexpr blkc ${filesize} / 0x200; "           \
160                                 "setexpr blkc ${blkc} + 1; "                   \
161                                 "if itest ${blkc} <= ${kernel_size}; then "    \
162                                         "mmc write ${loadaddr} "               \
163                                                 "${kernel_start} ${blkc}; "    \
164                                 "fi; "                                         \
165                         "fi; "                                                 \
166                 "fi; "                                                         \
167                 "setenv filesize; setenv blkc \0"                              \
168         "update_fdt=if tftp ${fdt_file}; then "                                \
169                 "if itest ${filesize} > 0; then "                              \
170                         "mmc dev ${mmcdev}; mmc rescan; "                      \
171                         "setexpr blkc ${filesize} / 0x200; "                   \
172                         "setexpr blkc ${blkc} + 1; "                           \
173                         "if itest ${blkc} <= ${fdt_size}; then "               \
174                                 "mmc write ${loadaddr} ${fdt_start} ${blkc}; " \
175                         "fi; "                                                 \
176                 "fi; fi; "                                                     \
177                 "setenv filesize; setenv blkc \0"                              \
178
179 #define CONFIG_BOOTCOMMAND \
180         "run mmcboot; run netboot; run panicboot"
181
182 #elif defined(CONFIG_TQMA6X_SPI_BOOT)
183
184 #define TQMA6_UBOOT_OFFSET              0x400
185 #define TQMA6_UBOOT_SECTOR_START        0x0
186 /* max u-boot size: 512k */
187 #define TQMA6_UBOOT_SECTOR_SIZE         TQMA6_SPI_FLASH_SECTOR_SIZE
188 #define TQMA6_UBOOT_SECTOR_COUNT        0x8
189 #define TQMA6_UBOOT_SIZE                (TQMA6_UBOOT_SECTOR_SIZE * \
190                                          TQMA6_UBOOT_SECTOR_COUNT)
191
192 #define CONFIG_ENV_IS_IN_SPI_FLASH
193 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
194 #define CONFIG_ENV_OFFSET               (TQMA6_UBOOT_SIZE)
195 #define CONFIG_ENV_SECT_SIZE            TQMA6_SPI_FLASH_SECTOR_SIZE
196 #define CONFIG_ENV_OFFSET_REDUND        (CONFIG_ENV_OFFSET + \
197                                          CONFIG_ENV_SECT_SIZE)
198
199 #define CONFIG_ENV_SPI_BUS              (CONFIG_SF_DEFAULT_BUS)
200 #define CONFIG_ENV_SPI_CS               (CONFIG_SF_DEFAULT_CS)
201 #define CONFIG_ENV_SPI_MAX_HZ           (CONFIG_SF_DEFAULT_SPEED)
202 #define CONFIG_ENV_SPI_MODE             (CONFIG_SF_DEFAULT_MODE)
203
204 #define TQMA6_FDT_OFFSET                (CONFIG_ENV_OFFSET_REDUND + \
205                                          CONFIG_ENV_SECT_SIZE)
206 #define TQMA6_FDT_SECT_SIZE             (TQMA6_SPI_FLASH_SECTOR_SIZE)
207
208 #define TQMA6_FDT_SECTOR_START          0x0a /* 8 Sector u-boot, 2 Sector env */
209 #define TQMA6_FDT_SECTOR_COUNT          0x01
210
211 #define TQMA6_KERNEL_SECTOR_START       0x10
212 #define TQMA6_KERNEL_SECTOR_COUNT       0x60
213
214 #define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS                                       \
215         "mmcblkdev=0\0"                                                        \
216         "uboot_offset="__stringify(TQMA6_UBOOT_OFFSET)"\0"                     \
217         "uboot_sectors="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0"              \
218         "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0"                    \
219         "fdt_sectors="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0"                  \
220         "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0"              \
221         "kernel_sectors="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0"            \
222         "update_uboot=if tftp ${uboot}; then "                                 \
223                 "if itest ${filesize} > 0; then "                              \
224                         "setexpr blkc ${filesize} + "                          \
225                                 __stringify(TQMA6_UBOOT_OFFSET) "; "           \
226                         "setexpr size ${uboot_sectors} * "                     \
227                                 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; "   \
228                         "if itest ${blkc} <= ${size}; then "                   \
229                                 "sf probe; "                                   \
230                                 "sf erase 0 ${size}; "                         \
231                                 "sf write ${loadaddr} ${uboot_offset} "        \
232                                         "${filesize}; "                        \
233                         "fi; "                                                 \
234                 "fi; fi; "                                                     \
235                 "setenv filesize 0; setenv blkc; setenv size \0"               \
236         "update_kernel=run kernel_name; if tftp ${kernel}; then "              \
237                 "if itest ${filesize} > 0; then "                              \
238                         "setexpr size ${kernel_sectors} * "                    \
239                                 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; "   \
240                         "setexpr offset ${kernel_start} * "                    \
241                                 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; "   \
242                         "if itest ${filesize} <= ${size}; then "               \
243                                 "sf probe; "                                   \
244                                 "sf erase ${offset} ${size}; "                 \
245                                 "sf write ${loadaddr} ${offset} "              \
246                                         "${filesize}; "                        \
247                         "fi; "                                                 \
248                 "fi; fi; "                                                     \
249                 "setenv filesize 0; setenv size ; setenv offset\0"             \
250         "update_fdt=if tftp ${fdt_file}; then "                                \
251                 "if itest ${filesize} > 0; then "                              \
252                         "setexpr size ${fdt_sectors} * "                       \
253                                 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; "   \
254                         "setexpr offset ${fdt_start} * "                       \
255                                 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; "   \
256                         "if itest ${filesize} <= ${size}; then "               \
257                                 "sf probe; "                                   \
258                                 "sf erase ${offset} ${size}; "                 \
259                                 "sf write ${loadaddr} ${offset} "              \
260                                         "${filesize}; "                        \
261                         "fi; "                                                 \
262                 "fi; fi; "                                                     \
263                 "setenv filesize 0; setenv size ; setenv offset\0"             \
264         "loadimage=sf probe; "                                                 \
265                 "setexpr size ${kernel_sectors} * "                            \
266                         __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; "           \
267                 "setexpr offset ${kernel_start} * "                            \
268                         __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; "           \
269                 "sf read ${loadaddr} ${offset} ${size}; "                      \
270                 "setenv size ; setenv offset\0"                                \
271         "loadfdt=sf probe; "                                                   \
272                 "setexpr size ${fdt_sectors} * "                               \
273                         __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; "           \
274                 "setexpr offset ${fdt_start} * "                               \
275                         __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; "           \
276                 "sf read ${${fdt_addr}} ${offset} ${size}; "                   \
277                 "setenv size ; setenv offset\0"                                \
278
279 #define CONFIG_BOOTCOMMAND                                                     \
280         "sf probe; run mmcboot; run netboot; run panicboot"                    \
281
282 #else
283
284 #error "need to define boot source"
285
286 #endif
287
288 /* 128 MiB offset as in ARM related docu for linux suggested */
289 #define TQMA6_FDT_ADDRESS               0x18000000
290
291 #define CONFIG_EXTRA_ENV_SETTINGS                                              \
292         "board=tqma6\0"                                                        \
293         "uimage=uImage\0"                                                      \
294         "zimage=zImage\0"                                                      \
295         "boot_type=bootz\0"                                                    \
296         "kernel_name=if test \"${boot_type}\" != bootz; then "                 \
297                 "setenv kernel ${uimage}; "                                    \
298                 "else setenv kernel ${zimage}; fi\0"                           \
299         "uboot=u-boot.imx\0"                                                   \
300         "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0"                               \
301         "fdt_addr="__stringify(TQMA6_FDT_ADDRESS)"\0"                          \
302         "console=" CONFIG_CONSOLE_DEV "\0"                                     \
303         "fdt_high=0xffffffff\0"                                                \
304         "initrd_high=0xffffffff\0"                                             \
305         "addtty=setenv bootargs ${bootargs} console=${console},${baudrate}\0"  \
306         "addfb=setenv bootargs ${bootargs} "                                   \
307                 "imx-fbdev.legacyfb_depth=32 consoleblank=0\0"                 \
308         "mmcpart=2\0"                                                          \
309         "mmcblkdev=0\0"                                                        \
310         "mmcargs=run addmmc addtty addfb\0"                                    \
311         "addmmc=setenv bootargs ${bootargs} "                                  \
312                 "root=/dev/mmcblk${mmcblkdev}p${mmcpart} rw rootwait\0"        \
313         "mmcboot=echo Booting from mmc ...; "                                  \
314                 "setenv bootargs; "                                            \
315                 "run mmcargs; "                                                \
316                 "run loadimage; "                                              \
317                 "if run loadfdt; then "                                        \
318                         "echo boot device tree kernel ...; "                   \
319                         "${boot_type} ${loadaddr} - ${fdt_addr}; "             \
320                 "else "                                                        \
321                         "${boot_type}; "                                       \
322                 "fi;\0"                                                        \
323                 "setenv bootargs \0"                                           \
324         "netdev=eth0\0"                                                        \
325         "rootpath=/srv/nfs/tqma6\0"                                            \
326         "ipmode=static\0"                                                      \
327         "netargs=run addnfs addip addtty addfb\0"                              \
328         "addnfs=setenv bootargs ${bootargs} "                                  \
329                 "root=/dev/nfs rw "                                            \
330                 "nfsroot=${serverip}:${rootpath},v3,tcp;\0"                    \
331         "addip_static=setenv bootargs ${bootargs} "                            \
332                 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:"            \
333                 "${hostname}:${netdev}:off\0"                                  \
334         "addip_dynamic=setenv bootargs ${bootargs} ip=dhcp\0"                  \
335         "addip=if test \"${ipmode}\" != static; then "                         \
336                 "run addip_dynamic; else run addip_static; fi\0"               \
337         "set_getcmd=if test \"${ipmode}\" != static; then "                    \
338                 "setenv getcmd dhcp; setenv autoload yes; "                    \
339                 "else setenv getcmd tftp; setenv autoload no; fi\0"            \
340         "netboot=echo Booting from net ...; "                                  \
341                 "run kernel_name; "                                            \
342                 "run set_getcmd; "                                             \
343                 "setenv bootargs; "                                            \
344                 "run netargs; "                                                \
345                 "if ${getcmd} ${kernel}; then "                                \
346                         "if ${getcmd} ${fdt_addr} ${fdt_file}; then "          \
347                                 "${boot_type} ${loadaddr} - ${fdt_addr}; "     \
348                         "fi; "                                                 \
349                 "fi; "                                                         \
350                 "echo ... failed\0"                                            \
351         "panicboot=echo No boot device !!! reset\0"                            \
352         TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS                                      \
353
354 #define CONFIG_STACKSIZE                (128u * SZ_1K)
355
356 /* Physical Memory Map */
357 #define CONFIG_NR_DRAM_BANKS            1
358 #define PHYS_SDRAM                      MMDC0_ARB_BASE_ADDR
359
360 #define CONFIG_SYS_SDRAM_BASE           PHYS_SDRAM
361 #define CONFIG_SYS_INIT_RAM_ADDR        IRAM_BASE_ADDR
362 #define CONFIG_SYS_INIT_RAM_SIZE        IRAM_SIZE
363
364 #define CONFIG_SYS_INIT_SP_OFFSET \
365         (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
366 #define CONFIG_SYS_INIT_SP_ADDR \
367         (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
368
369 /*
370  * All the defines above are for the TQMa6 SoM
371  *
372  * Now include the baseboard specific configuration
373  */
374 #ifdef CONFIG_MBA6
375 #include "tqma6_mba6.h"
376 #elif CONFIG_WRU4
377 #include "tqma6_wru4.h"
378 #else
379 #error "No baseboard for the TQMa6 defined!"
380 #endif
381
382 /* Support at least the sensor on TQMa6 SOM */
383 #if !defined(CONFIG_DTT_SENSORS)
384 #define CONFIG_DTT_SENSORS              { 0 }
385 #endif
386
387 #endif /* __CONFIG_H */