karo: configs: set 'baseboard' variable in 'noenv' U-Boot
[karo-tx-uboot.git] / include / configs / txa5.h
1 /*
2  * Copyright (C) 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/kconfig.h>
12 #include <linux/sizes.h>
13 #include <asm/hardware.h>
14
15 #define CONFIG_SYS_TEXT_BASE            0x20100000
16
17 /* ARM asynchronous clock */
18 #define CONFIG_SYS_AT91_SLOW_CLOCK      32768
19 #define CONFIG_SYS_AT91_MAIN_CLOCK      12000000 /* from 12 MHz crystal */
20
21 #define CONFIG_ARCH_CPU_INIT
22
23 #define CONFIG_SKIP_LOWLEVEL_INIT
24 #define CONFIG_BOARD_LATE_INIT
25 #define CONFIG_BOARD_EARLY_INIT_F
26 #define CONFIG_DISPLAY_CPUINFO
27
28 #define CONFIG_SYS_GENERIC_BOARD
29
30 /* general purpose I/O */
31 #define CONFIG_AT91_GPIO
32
33 /* serial console */
34 #define CONFIG_ATMEL_USART
35 #define CONFIG_USART_BASE               ATMEL_BASE_USART0
36 #define CONFIG_USART_ID                 ATMEL_ID_USART0
37 #define CONFIG_SYS_CONSOLE_INFO_QUIET
38
39 #define xstr(s)                         str(s)
40 #define str(s)                          #s
41 #define __pfx(x, s)                     (x##s)
42 #define _pfx(x, s)                      __pfx(x, s)
43
44 /* SDRAM */
45 #define CONFIG_NR_DRAM_BANKS            1
46 #define CONFIG_SYS_SDRAM_BASE           ATMEL_BASE_DDRCS
47 #define CONFIG_SYS_SDRAM_SIZE           0x20000000
48
49 #define CONFIG_SYS_INIT_SP_ADDR \
50         (CONFIG_SYS_SDRAM_BASE + SZ_4K - GENERATED_GBL_DATA_SIZE)
51
52 #define CONFIG_CMDLINE_TAG
53 #define CONFIG_SETUP_MEMORY_TAGS
54 #define CONFIG_BOOTDELAY                3
55 #define CONFIG_ZERO_BOOTDELAY_CHECK
56 #define CONFIG_SYS_AUTOLOAD             "no"
57 #define CONFIG_BOOTFILE                 "uImage"
58 #define CONFIG_BOOTARGS                 "init=/linuxrc console=ttyS0,115200 ro debug panic=1"
59 #define CONFIG_BOOTCOMMAND              "run bootcmd_${boot_mode} bootm_cmd"
60 #define CONFIG_LOADADDR                 22000000 /* load address */
61 #define CONFIG_FDTADDR                  21000000
62 #define CONFIG_SYS_LOAD_ADDR            _pfx(0x, CONFIG_LOADADDR)
63 #define CONFIG_SYS_FDT_ADDR             _pfx(0x, CONFIG_FDTADDR)
64 #define CONFIG_U_BOOT_IMG_SIZE          SZ_1M
65
66 /* NAND flash */
67 #ifdef CONFIG_TXA5_NAND
68 #define CONFIG_SYS_MAX_NAND_DEVICE      0x1
69 /* our ALE is AD21 */
70 #define CONFIG_SYS_NAND_MASK_ALE        (1 << 21)
71 /* our CLE is AD22 */
72 #define CONFIG_SYS_NAND_MASK_CLE        (1 << 22)
73 #define CONFIG_SYS_NAND_ONFI_DETECTION
74 /* PMECC & PMERRLOC */
75 #define CONFIG_ATMEL_NAND_HWECC
76 #define CONFIG_ATMEL_NAND_HW_PMECC
77 #ifdef CONFIG_ENV_IS_IN_NAND
78 #define CONFIG_SYS_NAND_U_BOOT_OFFS     SZ_128K
79 #define CONFIG_ENV_OVERWRITE
80 #define CONFIG_ENV_OFFSET               (CONFIG_U_BOOT_IMG_SIZE + CONFIG_SYS_NAND_U_BOOT_OFFS)
81 #define CONFIG_ENV_SIZE                 SZ_128K
82 #define CONFIG_ENV_RANGE                0x60000
83 #endif /* CONFIG_ENV_IS_IN_NAND */
84 #define CONFIG_SYS_NAND_BASE            ATMEL_BASE_CS3
85 #define CONFIG_SYS_NAND_SIZE            SZ_128M
86 #define NAND_BASE                       CONFIG_SYS_NAND_BASE
87 #endif /* CONFIG_CMD_NAND */
88
89 /* MMC */
90 #ifdef CONFIG_MMC
91 #define CONFIG_GENERIC_MMC
92 #define CONFIG_GENERIC_ATMEL_MCI
93 #define ATMEL_BASE_MMCI                 ATMEL_BASE_MCI1
94
95 #define CONFIG_CMD_FAT
96 #define CONFIG_FAT_WRITE
97 #define CONFIG_CMD_EXT2
98 #endif
99
100 /* Ethernet Hardware */
101 #define CONFIG_MACB
102 #define CONFIG_RMII
103 #define CONFIG_NET_RETRY_COUNT          20
104 #define CONFIG_MACB_SEARCH_PHY
105
106 /* LCD */
107 /* #define CONFIG_LCD */
108 #ifdef CONFIG_LCD
109 #ifndef __ASSEMBLY__
110 extern int lcd_output_bpp;
111 #endif
112 #define LCD_BPP                         LCD_COLOR16
113 #define LCD_OUTPUT_BPP                  lcd_output_bpp
114 #define CONFIG_LCD_LOGO
115 #define CONFIG_ATMEL_HLCD
116 #define CONFIG_ATMEL_LCD_RGB565
117 #define CONFIG_CMD_BMP
118 #define CONFIG_VIDEO_BMP_RLE8
119 #endif
120
121 #ifdef CONFIG_TXA5_NAND
122 #define CONFIG_SYS_DEFAULT_BOOT_MODE    "nand"
123 #define CONFIG_SYS_BOOT_CMD_NAND                                        \
124         "bootcmd_nand=setenv autostart no;run bootargs_ubifs;nboot linux\0"
125 #define CONFIG_SYS_FDTSAVE_CMD                                          \
126         "fdtsave=fdt resize;nand erase.part dtb"                        \
127         ";nand write ${fdtaddr} dtb ${fdtsize}\0"
128 #define MTD_NAME                        "atmel_nand"
129 #define MTDIDS_DEFAULT                  "nand0=" MTD_NAME
130 #ifdef CONFIG_ENV_OFFSET_REDUND
131 #define MTDPARTS_DEFAULT                "mtdparts=" MTD_NAME ":"        \
132         "128k(u-boot-spl),"                                             \
133         "1m(u-boot),"                                                   \
134         xstr(CONFIG_ENV_RANGE)                                          \
135         "(env),"                                                        \
136         xstr(CONFIG_ENV_RANGE)                                          \
137         "(env2),6m(linux),32m(rootfs),89216k(userfs),512k@0x7f00000(dtb),512k@0x7f80000(bbt)ro"
138 #else
139 #define MTDPARTS_DEFAULT                "mtdparts=" MTD_NAME ":"        \
140         "128k(u-boot-spl),"                                             \
141         "1m(u-boot),"                                                   \
142         xstr(CONFIG_ENV_RANGE)                                          \
143         "(env),6m(linux),32m(rootfs),89600k(userfs),512k@0x7f00000(dtb),512k@0x7f80000(bbt)ro"
144 #endif
145
146 #define MMC_ROOT_STR " root=/dev/mmcblk0p2 rootwait\0"
147 #define ROOTPART_UUID_STR ""
148
149 #else /* CONFIG_TXA5_NAND */
150 /* bootstrap + u-boot + env in sd card */
151 #define CONFIG_SYS_FDTSAVE_CMD                                          \
152         "fdtsave=mmc open 0 1;mmc write ${fdtaddr} "                    \
153         xstr(CONFIG_SYS_DTB_BLKNO) " 80;mmc close 0 1\0"
154 #define MMC_ROOT_STR " root=PARTUUID=${rootpart_uuid} rootwait\0"
155 #define ROOTPART_UUID_STR "rootpart_uuid=0cc66cc0-02\0"
156 #define MTD_NAME                        ""
157 #define MTDIDS_DEFAULT                  ""
158 #define MTDPARTS_DEFAULT                ""
159 #define CONFIG_SYS_DEFAULT_BOOT_MODE    "mmc"
160 #define CONFIG_SYS_BOOT_CMD_NAND        ""
161 #define CONFIG_SYS_FDTSAVE_CMD                                          \
162         "fdtsave=mmc open 0 1;mmc write ${fdtaddr} "                    \
163         xstr(CONFIG_SYS_DTB_BLKNO) " 80;mmc close 0 1\0"
164 #define MMC_ROOT_STR " root=PARTUUID=${rootpart_uuid} rootwait\0"
165 #define ROOTPART_UUID_STR "rootpart_uuid=0cc66cc0-02\0"
166 #ifdef CONFIG_ENV_IS_IN_MMC
167 #define CONFIG_ENV_SIZE                 SZ_128K
168 #define CONFIG_SYS_MMC_ENV_DEV          0
169 #define CONFIG_SYS_MMC_ENV_PART         0x1
170 #define CONFIG_DYNAMIC_MMC_DEVNO
171 #endif /* CONFIG_ENV_IS_IN_MMC */
172 #endif /* CONFIG_TXA5_NAND */
173
174 /*
175  * Extra Environment Settings
176  */
177 #ifdef CONFIG_ENV_IS_NOWHERE
178 #define CONFIG_EXTRA_ENV_SETTINGS                                       \
179         "autostart=no\0"                                                \
180         "autoload=no\0"                                                 \
181         "baseboard=stk5-v3\0"                                           \
182         "bootdelay=-1\0"                                                \
183         "fdtaddr=" xstr(CONFIG_FDTADDR) "\0"                            \
184         "mtdids=" MTDIDS_DEFAULT "\0"                                   \
185         "mtdparts=" MTDPARTS_DEFAULT "\0"
186 #else
187 #define CONFIG_EXTRA_ENV_SETTINGS                                       \
188         "autostart=no\0"                                                \
189         "baseboard=stk5-v3\0"                                           \
190         "bootargs_jffs2=run default_bootargs"                           \
191         ";setenv bootargs ${bootargs}"                                  \
192         " root=/dev/mtdblock4 rootfstype=jffs2\0"                       \
193         "bootargs_mmc=run default_bootargs;setenv bootargs ${bootargs}" \
194         MMC_ROOT_STR                                                    \
195         "bootargs_nfs=run default_bootargs;setenv bootargs ${bootargs}" \
196         " root=/dev/nfs nfsroot=${nfs_server}:${nfsroot},nolock"        \
197         " ip=dhcp\0"                                                    \
198         "bootargs_ubifs=run default_bootargs"                           \
199         ";setenv bootargs ${bootargs}"                                  \
200         " ubi.mtd=rootfs root=ubi0:rootfs rootfstype=ubifs\0"           \
201         "bootcmd_jffs2=setenv autostart no;run bootargs_jffs2"          \
202         ";nboot linux\0"                                                \
203         "bootcmd_mmc=setenv autostart no;run bootargs_mmc"              \
204         ";fatload mmc 0 ${loadaddr} uImage\0"                           \
205         CONFIG_SYS_BOOT_CMD_NAND                                        \
206         "bootcmd_net=setenv autoload y;setenv autostart n"              \
207         ";run bootargs_nfs"                                             \
208         ";dhcp\0"                                                       \
209         "bootm_cmd=bootm ${loadaddr} - ${fdtaddr}\0"                    \
210         "boot_mode=" CONFIG_SYS_DEFAULT_BOOT_MODE "\0"                  \
211         "default_bootargs=setenv bootargs " CONFIG_BOOTARGS             \
212         " ${append_bootargs}\0"                                         \
213         "fdtaddr=" xstr(CONFIG_FDTADDR) "\0"                            \
214         CONFIG_SYS_FDTSAVE_CMD                                          \
215         "mtdids=" MTDIDS_DEFAULT "\0"                                   \
216         "mtdparts=" MTDPARTS_DEFAULT "\0"                               \
217         "nfsroot=/tftpboot/rootfs\0"                                    \
218         "otg_mode=device\0"                                             \
219         ROOTPART_UUID_STR                                               \
220         "touchpanel=tsc2007\0"                                          \
221         "video_mode=VGA\0"
222 #endif /*  CONFIG_ENV_IS_NOWHERE */
223
224
225 #define CONFIG_BAUDRATE                 115200
226
227 #define CONFIG_SYS_LONGHELP
228 #define CONFIG_SYS_CBSIZE               2048
229 #define CONFIG_SYS_PBSIZE \
230         (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
231 #define CONFIG_SYS_MAXARGS              256
232 #define CONFIG_SYS_BARGSIZE             CONFIG_SYS_CBSIZE
233
234 #define CONFIG_VERSION_VARIABLE         /* U-BOOT version */
235 #define CONFIG_AUTO_COMPLETE
236 #define CONFIG_CMDLINE_EDITING
237
238 #define CONFIG_SYS_64BIT_VSPRINTF
239
240 /* Size of malloc() pool */
241 #define CONFIG_SYS_MALLOC_LEN           SZ_4M
242 #define CONFIG_SYS_MEMTEST_START        CONFIG_SYS_SDRAM_BASE   /* Memtest start address */
243 #define CONFIG_SYS_MEMTEST_END          (CONFIG_SYS_MEMTEST_START + SZ_4M)
244
245 #endif