configs: Migrate CMD_NAND*
[platform/kernel/u-boot.git] / include / configs / baltos.h
1 /*
2  * am335x_evm.h
3  *
4  * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation version 2.
9  *
10  * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11  * kind, whether express or implied; without even the implied warranty
12  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  */
15
16 #ifndef __CONFIG_BALTOS_H
17 #define __CONFIG_BALTOS_H
18
19 #include <linux/sizes.h>
20 #include <configs/ti_am335x_common.h>
21
22 #define CONFIG_MACH_TYPE                MACH_TYPE_AM335XEVM
23
24 /* Clock Defines */
25 #define V_OSCK                          24000000  /* Clock output from T2 */
26 #define V_SCLK                          (V_OSCK)
27
28 /* Custom script for NOR */
29 #define CONFIG_SYS_LDSCRIPT             "board/vscom/baltos/u-boot.lds"
30
31 /* Always 128 KiB env size */
32 #define CONFIG_ENV_SIZE                 (128 << 10)
33
34 /* FIT support */
35 #define CONFIG_SYS_BOOTM_LEN         SZ_64M
36
37 /* UBI Support */
38 #define CONFIG_MTD_PARTITIONS
39 #define CONFIG_MTD_DEVICE
40
41 /* I2C configuration */
42 #undef CONFIG_SYS_OMAP24_I2C_SPEED
43 #define CONFIG_SYS_OMAP24_I2C_SPEED 1000
44
45 #ifdef CONFIG_NAND
46 #define CONFIG_SYS_NAND_U_BOOT_OFFS     0x00080000
47 #ifdef CONFIG_SPL_OS_BOOT
48 #define CONFIG_CMD_SPL_NAND_OFS 0x00080000 /* os parameters */
49 #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x00200000 /* kernel offset */
50 #define CONFIG_CMD_SPL_WRITE_SIZE       0x2000
51 #endif
52 #define NANDARGS \
53         "mtdids=" MTDIDS_DEFAULT "\0" \
54         "mtdparts=" MTDPARTS_DEFAULT "\0" \
55         "nandargs=setenv bootargs console=${console} " \
56                 "${optargs} " \
57                 "${mtdparts} " \
58                 "root=${nandroot} " \
59                 "rootfstype=${nandrootfstype}\0" \
60         "nandroot=ubi0:rootfs rw ubi.mtd=5\0" \
61         "nandrootfstype=ubifs rootwait=1\0" \
62         "nandboot=echo Booting from nand ...; " \
63                 "run nandargs; " \
64                 "setenv loadaddr 0x84000000; " \
65                 "ubi part UBI; " \
66                 "ubifsmount ubi0:kernel; " \
67                 "ubifsload $loadaddr kernel-fit.itb;" \
68                 "ubifsumount; " \
69                 "bootm ${loadaddr}#conf${board_name}; " \
70                 "if test $? -ne 0; then echo Using default FIT config; " \
71                 "bootm ${loadaddr}; fi;\0"
72 #else
73 #define NANDARGS ""
74 #endif
75
76 #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
77
78 #ifndef CONFIG_SPL_BUILD
79 #define CONFIG_EXTRA_ENV_SETTINGS \
80         DEFAULT_LINUX_BOOT_ENV \
81         "boot_fdt=try\0" \
82         "bootpart=0:2\0" \
83         "bootdir=/boot\0" \
84         "bootfile=zImage\0" \
85         "fdtfile=undefined\0" \
86         "console=ttyO0,115200n8\0" \
87         "partitions=" \
88                 "uuid_disk=${uuid_gpt_disk};" \
89                 "name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}\0" \
90         "optargs=\0" \
91         "mmcdev=0\0" \
92         "mmcroot=/dev/mmcblk0p2 ro\0" \
93         "usbroot=/dev/sda2 ro\0" \
94         "mmcrootfstype=ext4 rootwait\0" \
95         "usbrootfstype=ext4 rootwait\0" \
96         "rootpath=/export/rootfs\0" \
97         "nfsopts=nolock\0" \
98         "static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \
99                 "::off\0" \
100         "ramroot=/dev/ram0 rw\0" \
101         "ramrootfstype=ext2\0" \
102         "mmcargs=setenv bootargs console=${console} " \
103                 "${optargs} " \
104                 "${mtdparts} " \
105                 "root=${mmcroot} " \
106                 "rootfstype=${mmcrootfstype}\0" \
107         "usbargs=setenv bootargs console=${console} " \
108                 "${optargs} " \
109                 "${mtdparts} " \
110                 "root=${usbroot} " \
111                 "rootfstype=${usbrootfstype}\0" \
112         "spiroot=/dev/mtdblock4 rw\0" \
113         "spirootfstype=jffs2\0" \
114         "spisrcaddr=0xe0000\0" \
115         "spiimgsize=0x362000\0" \
116         "spibusno=0\0" \
117         "spiargs=setenv bootargs console=${console} " \
118                 "${optargs} " \
119                 "root=${spiroot} " \
120                 "rootfstype=${spirootfstype}\0" \
121         "netargs=setenv bootargs console=${console} " \
122                 "${optargs} " \
123                 "root=/dev/nfs " \
124                 "nfsroot=${serverip}:${rootpath},${nfsopts} rw " \
125                 "ip=dhcp\0" \
126         "bootenv=uEnv.txt\0" \
127         "loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
128         "usbloadbootenv=load usb 0:1 ${loadaddr} ${bootenv}\0" \
129         "importbootenv=echo Importing environment from mmc ...; " \
130                 "env import -t $loadaddr $filesize\0" \
131         "usbimportbootenv=echo Importing environment from USB ...; " \
132                 "env import -t $loadaddr $filesize\0" \
133         "ramargs=setenv bootargs console=${console} " \
134                 "${optargs} " \
135                 "root=${ramroot} " \
136                 "rootfstype=${ramrootfstype}\0" \
137         "loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \
138         "loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
139         "usbloadimage=load usb 0:1 ${loadaddr} kernel-fit.itb\0" \
140         "loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
141         "usbloados=run usbargs; " \
142                 "bootm ${loadaddr}#conf${board_name}; " \
143                 "if test $? -ne 0; then " \
144                         "echo Using default FIT configuration; " \
145                         "bootm ${loadaddr}; " \
146                 "fi;\0" \
147         "mmcloados=run mmcargs; " \
148                 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
149                         "if run loadfdt; then " \
150                                 "bootz ${loadaddr} - ${fdtaddr}; " \
151                         "else " \
152                                 "if test ${boot_fdt} = try; then " \
153                                         "bootz; " \
154                                 "else " \
155                                         "echo WARN: Cannot load the DT; " \
156                                 "fi; " \
157                         "fi; " \
158                 "else " \
159                         "bootz; " \
160                 "fi;\0" \
161         "usbboot=usb reset; " \
162                 "if usb storage; then " \
163                         "echo USB drive found;" \
164                         "if run usbloadbootenv; then " \
165                                 "echo Loaded environment from ${bootenv};" \
166                                 "run usbimportbootenv;" \
167                         "fi;" \
168                         "if test -n $uenvcmd; then " \
169                                 "echo Running uenvcmd ...;" \
170                                 "run uenvcmd;" \
171                         "fi;" \
172                         "if run usbloadimage; then " \
173                                 "run usbloados;" \
174                         "fi;" \
175                 "fi;\0" \
176         "mmcboot=mmc dev ${mmcdev}; " \
177                 "if mmc rescan; then " \
178                         "echo SD/MMC found on device ${mmcdev};" \
179                         "if run loadbootenv; then " \
180                                 "echo Loaded environment from ${bootenv};" \
181                                 "run importbootenv;" \
182                         "fi;" \
183                         "if test -n $uenvcmd; then " \
184                                 "echo Running uenvcmd ...;" \
185                                 "run uenvcmd;" \
186                         "fi;" \
187                         "if run loadimage; then " \
188                                 "run mmcloados;" \
189                         "fi;" \
190                 "fi;\0" \
191         "spiboot=echo Booting from spi ...; " \
192                 "run spiargs; " \
193                 "sf probe ${spibusno}:0; " \
194                 "sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; " \
195                 "bootz ${loadaddr}\0" \
196         "netboot=echo Booting from network ...; " \
197                 "setenv autoload no; " \
198                 "dhcp; " \
199                 "tftp ${loadaddr} ${bootfile}; " \
200                 "tftp ${fdtaddr} ${fdtfile}; " \
201                 "run netargs; " \
202                 "bootz ${loadaddr} - ${fdtaddr}\0" \
203         "ramboot=echo Booting from ramdisk ...; " \
204                 "run ramargs; " \
205                 "bootz ${loadaddr} ${rdaddr} ${fdtaddr}\0" \
206         "findfdt=setenv fdtfile am335x-baltos.dtb\0" \
207         NANDARGS
208         /*DFUARGS*/
209 #endif
210
211 #define CONFIG_BOOTCOMMAND \
212         "run findfdt; " \
213         "run usbboot;" \
214         "run mmcboot;" \
215         "setenv mmcdev 1; " \
216         "setenv bootpart 1:2; " \
217         "run mmcboot;" \
218         "run nandboot;"
219
220 /* NS16550 Configuration */
221 #define CONFIG_SYS_NS16550_COM1         0x44e09000      /* Base EVM has UART0 */
222 #define CONFIG_SYS_NS16550_COM2         0x48022000      /* UART1 */
223 #define CONFIG_SYS_NS16550_COM3         0x48024000      /* UART2 */
224 #define CONFIG_SYS_NS16550_COM4         0x481a6000      /* UART3 */
225 #define CONFIG_SYS_NS16550_COM5         0x481a8000      /* UART4 */
226 #define CONFIG_SYS_NS16550_COM6         0x481aa000      /* UART5 */
227
228 #define CONFIG_ENV_EEPROM_IS_ON_I2C
229 #define CONFIG_SYS_I2C_EEPROM_ADDR      0x50    /* Main EEPROM */
230 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN  2
231
232 /* PMIC support */
233 #define CONFIG_POWER_TPS65910
234
235 /* SPL */
236 #ifndef CONFIG_NOR_BOOT
237 /* Bootcount using the RTC block */
238 #define CONFIG_BOOTCOUNT_LIMIT
239 #define CONFIG_BOOTCOUNT_AM33XX
240
241 /* USB gadget RNDIS */
242
243 /* General network SPL, both CPSW and USB gadget RNDIS */
244 #define CONFIG_SPL_NET_VCI_STRING       "AM335x U-Boot SPL"*/
245
246 #define CONFIG_SPL_LDSCRIPT             "arch/arm/mach-omap2/u-boot-spl.lds"
247
248 #ifdef CONFIG_NAND
249 #define CONFIG_NAND_OMAP_GPMC
250 #define CONFIG_NAND_OMAP_GPMC_PREFETCH
251 #define CONFIG_NAND_OMAP_ELM
252 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
253 #define CONFIG_SYS_NAND_PAGE_COUNT      (CONFIG_SYS_NAND_BLOCK_SIZE / \
254                                          CONFIG_SYS_NAND_PAGE_SIZE)
255 #define CONFIG_SYS_NAND_PAGE_SIZE       2048
256 #define CONFIG_SYS_NAND_OOBSIZE         64
257 #define CONFIG_SYS_NAND_BLOCK_SIZE      (128*1024)
258 #define CONFIG_SYS_NAND_BAD_BLOCK_POS   NAND_LARGE_BADBLOCK_POS
259 #define CONFIG_SYS_NAND_ECCPOS          { 2, 3, 4, 5, 6, 7, 8, 9, \
260                                          10, 11, 12, 13, 14, 15, 16, 17, \
261                                          18, 19, 20, 21, 22, 23, 24, 25, \
262                                          26, 27, 28, 29, 30, 31, 32, 33, \
263                                          34, 35, 36, 37, 38, 39, 40, 41, \
264                                          42, 43, 44, 45, 46, 47, 48, 49, \
265                                          50, 51, 52, 53, 54, 55, 56, 57, }
266
267 #define CONFIG_SYS_NAND_ECCSIZE         512
268 #define CONFIG_SYS_NAND_ECCBYTES        14
269 #define CONFIG_SYS_NAND_ONFI_DETECTION
270 #define CONFIG_NAND_OMAP_ECCSCHEME      OMAP_ECC_BCH8_CODE_HW
271 #define CONFIG_SYS_NAND_U_BOOT_START    CONFIG_SYS_TEXT_BASE
272 #endif
273 #endif
274
275 /*
276  * USB configuration.  We enable MUSB support, both for host and for
277  * gadget.  We set USB0 as peripheral and USB1 as host, based on the
278  * board schematic and physical port wired to each.  Then for host we
279  * add mass storage support and for gadget we add both RNDIS ethernet
280  * and DFU.
281  */
282 #define CONFIG_USB_MUSB_DSPS
283 #define CONFIG_USB_MUSB_PIO_ONLY
284 #define CONFIG_USB_MUSB_DISABLE_BULK_COMBINE_SPLIT
285 #define CONFIG_AM335X_USB0
286 #define CONFIG_AM335X_USB0_MODE MUSB_HOST
287 #define CONFIG_AM335X_USB1
288 #define CONFIG_AM335X_USB1_MODE MUSB_OTG
289
290 #ifdef CONFIG_USB_MUSB_GADGET
291 #define CONFIG_USB_ETHER
292 #define CONFIG_USB_ETH_RNDIS
293 #define CONFIG_USBNET_HOST_ADDR "de:ad:be:af:00:00"
294 #endif /* CONFIG_USB_MUSB_GADGET */
295
296 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_USBETH_SUPPORT)
297 /* disable host part of MUSB in SPL */
298 /* disable EFI partitions and partition UUID support */
299 /*
300  * Disable CPSW SPL support so we fit within the 101KiB limit.
301  */
302 #endif
303
304 /* Network. */
305 #define CONFIG_PHY_GIGE
306 #define CONFIG_PHYLIB
307 #define CONFIG_PHY_ADDR                 0
308 #define CONFIG_PHY_SMSC
309 #define CONFIG_MII
310 #define CONFIG_PHY_ATHEROS
311
312 /* NAND support */
313 #ifdef CONFIG_NAND
314 #define GPMC_NAND_ECC_LP_x8_LAYOUT      1
315 #if !defined(CONFIG_SPI_BOOT) && !defined(CONFIG_NOR_BOOT)
316 #define MTDIDS_DEFAULT                  "nand0=omap2-nand.0"
317 #define MTDPARTS_DEFAULT                "mtdparts=omap2-nand.0:128k(SPL)," \
318                                         "128k(SPL.backup1)," \
319                                         "128k(SPL.backup2)," \
320                                         "128k(SPL.backup3)," \
321                                         "1920k(u-boot)," \
322                                         "-(UBI)"
323 #endif
324 #endif
325
326 #endif  /* ! __CONFIG_BALTOS_H */