1 /*
2  * Common part of configuration settings for the AT91 SAMA5 board.
3  *
4  * Copyright (C) 2015 Atmel Corporation
5  *		      Josh Wu <josh.wu@atmel.com>
6  *
7  * SPDX-License-Identifier:	GPL-2.0+
8  */
9 
10 #ifndef __AT91_SAMA5_COMMON_H
11 #define __AT91_SAMA5_COMMON_H
12 
13 #include <asm/hardware.h>
14 
15 #define CONFIG_SYS_TEXT_BASE		0x26f00000
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 #ifndef CONFIG_SPL_BUILD
24 #define CONFIG_SKIP_LOWLEVEL_INIT
25 #endif
26 
27 #define CONFIG_ENV_VARS_UBOOT_CONFIG
28 
29 /* general purpose I/O */
30 #ifndef CONFIG_DM_GPIO
31 #define CONFIG_AT91_GPIO
32 #endif
33 
34 
35 /*
36  * BOOTP options
37  */
38 #define CONFIG_BOOTP_BOOTFILESIZE
39 #define CONFIG_BOOTP_BOOTPATH
40 #define CONFIG_BOOTP_GATEWAY
41 #define CONFIG_BOOTP_HOSTNAME
42 
43 /*
44  * Command line configuration.
45  */
46 
47 #ifdef CONFIG_SYS_USE_MMC
48 
49 #ifdef CONFIG_ENV_IS_IN_MMC
50 /* Use raw reserved sectors to save environment */
51 #define CONFIG_ENV_OFFSET		0x2000
52 #define CONFIG_ENV_SIZE			0x1000
53 #define CONFIG_SYS_MMC_ENV_DEV		0
54 #else
55 /* u-boot env in sd/mmc card */
56 #define FAT_ENV_INTERFACE	"mmc"
57 #define FAT_ENV_DEVICE_AND_PART	"0"
58 #define FAT_ENV_FILE		"uboot.env"
59 #define CONFIG_ENV_SIZE		0x4000
60 #endif
61 
62 #define CONFIG_BOOTCOMMAND	"if test ! -n ${dtb_name}; then "	\
63 				    "setenv dtb_name at91-${board_name}.dtb; " \
64 				"fi; "					\
65 				"fatload mmc 0:1 0x21000000 ${dtb_name}; " \
66 				"fatload mmc 0:1 0x22000000 zImage; "	\
67 				"bootz 0x22000000 - 0x21000000"
68 #define CONFIG_BOOTARGS							\
69 	"console=ttyS0,115200 earlyprintk "				\
70 	"root=/dev/mmcblk0p2 rw rootwait"
71 #else
72 #define CONFIG_BOOTARGS							\
73 	"console=ttyS0,115200 earlyprintk "				\
74 	"mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro,"		\
75 	"256K(env),256k(env_redundant),256k(spare),"			\
76 	"512k(dtb),6M(kernel)ro,-(rootfs) "				\
77 	"rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs"
78 
79 #ifdef CONFIG_SYS_USE_NANDFLASH
80 /* u-boot env in nand flash */
81 #define CONFIG_ENV_OFFSET		0xc0000
82 #define CONFIG_ENV_OFFSET_REDUND	0x100000
83 #define CONFIG_ENV_SIZE			0x20000
84 #define CONFIG_BOOTCOMMAND		"nand read 0x21000000 0x180000 0x80000;"	\
85 					"nand read 0x22000000 0x200000 0x600000;"	\
86 					"bootz 0x22000000 - 0x21000000"
87 #elif CONFIG_SYS_USE_SERIALFLASH
88 /* u-boot env in serial flash, by default is bus 0 and cs 0 */
89 #define CONFIG_ENV_OFFSET		0x6000
90 #define CONFIG_ENV_SIZE			0x2000
91 #define CONFIG_ENV_SECT_SIZE		0x1000
92 #define CONFIG_BOOTCOMMAND		"sf probe 0; "				\
93 					"sf read 0x21000000 0x60000 0xc000; "	\
94 					"sf read 0x22000000 0x6c000 0x394000; "	\
95 					"bootz 0x22000000 - 0x21000000"
96 #endif
97 
98 #endif
99 
100 #define CONFIG_SYS_CBSIZE		256
101 #define CONFIG_SYS_MAXARGS		16
102 #define CONFIG_SYS_LONGHELP
103 #define CONFIG_CMDLINE_EDITING
104 #define CONFIG_AUTO_COMPLETE
105 
106 /* Size of malloc() pool */
107 #define CONFIG_SYS_MALLOC_LEN		(4 * 1024 * 1024)
108 
109 #endif
110