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