xref: /openbmc/u-boot/include/configs/etamin.h (revision 3ebd892f)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * (C) Copyright 2013 Siemens Schweiz AG
4  * (C) Heiko Schocher, DENX Software Engineering, hs@denx.de.
5  *
6  * Based on:
7  * U-Boot file:/include/configs/am335x_evm.h
8  *
9  * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
10  */
11 
12 #ifndef __CONFIG_ETAMIN_H
13 #define __CONFIG_ETAMIN_H
14 
15 #include "siemens-am33x-common.h"
16 /* NAND specific changes for etamin due to different page size */
17 #undef CONFIG_SYS_NAND_PAGE_SIZE
18 #undef CONFIG_SYS_NAND_OOBSIZE
19 #undef CONFIG_SYS_NAND_BLOCK_SIZE
20 #undef CONFIG_SYS_NAND_ECCPOS
21 #undef CONFIG_SYS_NAND_U_BOOT_OFFS
22 #undef CONFIG_SYS_ENV_SECT_SIZE
23 #undef CONFIG_ENV_OFFSET
24 #undef CONFIG_NAND_OMAP_ECCSCHEME
25 #define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_BCH16_CODE_HW
26 
27 #define CONFIG_ENV_OFFSET       0x980000
28 #define CONFIG_SYS_ENV_SECT_SIZE       (512 << 10)     /* 512 KiB */
29 #define CONFIG_SYS_NAND_PAGE_SIZE       4096
30 #define CONFIG_SYS_NAND_OOBSIZE         224
31 #define CONFIG_SYS_NAND_BLOCK_SIZE      (128 * CONFIG_SYS_NAND_PAGE_SIZE)
32 #define CONFIG_SYS_NAND_ECCPOS	{ 2, 3, 4, 5, 6, 7, 8, 9, \
33 				10, 11, 12, 13, 14, 15, 16, 17, 18, 19, \
34 				20, 21, 22, 23, 24, 25, 26, 27, 28, 29, \
35 				30, 31, 32, 33, 34, 35, 36, 37, 38, 39, \
36 				40, 41, 42, 43, 44, 45, 46, 47, 48, 49, \
37 				50, 51, 52, 53, 54, 55, 56, 57, 58, 59, \
38 				60, 61, 62, 63, 64, 65, 66, 67, 68, 69, \
39 				70, 71, 72, 73, 74, 75, 76, 77, 78, 79, \
40 				80, 81, 82, 83, 84, 85, 86, 87, 88, 89, \
41 				90, 91, 92, 93, 94, 95, 96, 97, 98, 99, \
42 			100, 101, 102, 103, 104, 105, 106, 107, 108, 109, \
43 			110, 111, 112, 113, 114, 115, 116, 117, 118, 119, \
44 			120, 121, 122, 123, 124, 125, 126, 127, 128, 129, \
45 			130, 131, 132, 133, 134, 135, 136, 137, 138, 139, \
46 			140, 141, 142, 143, 144, 145, 146, 147, 148, 149, \
47 			150, 151, 152, 153, 154, 155, 156, 157, 158, 159, \
48 			160, 161, 162, 163, 164, 165, 166, 167, 168, 169, \
49 			170, 171, 172, 173, 174, 175, 176, 177, 178, 179, \
50 			180, 181, 182, 183, 184, 185, 186, 187, 188, 189, \
51 			190, 191, 192, 193, 194, 195, 196, 197, 198, 199, \
52 			200, 201, 202, 203, 204, 205, 206, 207, 208, 209, \
53 			}
54 
55 #undef CONFIG_SYS_NAND_ECCSIZE
56 #undef CONFIG_SYS_NAND_ECCBYTES
57 #define CONFIG_SYS_NAND_ECCSIZE 512
58 #define CONFIG_SYS_NAND_ECCBYTES 26
59 
60 #define CONFIG_SYS_NAND_U_BOOT_OFFS     0x200000
61 
62 #define CONFIG_SYS_NAND_MAX_CHIPS       1
63 
64 #undef CONFIG_SYS_MAX_NAND_DEVICE
65 #define CONFIG_SYS_MAX_NAND_DEVICE      3
66 #define CONFIG_SYS_NAND_BASE2           (0x18000000)    /* physical address */
67 #define CONFIG_SYS_NAND_BASE_LIST       {CONFIG_SYS_NAND_BASE, \
68 					CONFIG_SYS_NAND_BASE2}
69 
70 #define CONFIG_SYS_NAND_ONFI_DETECTION
71 #define DDR_PLL_FREQ	303
72 
73 /* FWD Button = 27
74  * SRV Button = 87 */
75 #define BOARD_DFU_BUTTON_GPIO	27
76 #define GPIO_LAN9303_NRST	88	/* GPIO2_24 = gpio88 */
77 /* In dfu mode keep led1 on */
78 #define CONFIG_ENV_SETTINGS_BUTTONS_AND_LEDS \
79 	"button_dfu0=27\0" \
80 	"button_dfu1=87\0" \
81 	"led0=3,0,1\0" \
82 	"led1=4,0,0\0" \
83 	"led2=5,0,1\0" \
84 	"led3=87,0,1\0" \
85 	"led4=60,0,1\0" \
86 	"led5=63,0,1\0"
87 
88 /* Physical Memory Map */
89 #define CONFIG_MAX_RAM_BANK_SIZE       (1024 << 20)    /* 1GB */
90 
91 /* I2C Configuration */
92 #define CONFIG_SYS_I2C_SPEED		100000
93 
94 #define CONFIG_SYS_I2C_EEPROM_ADDR              0x50
95 #define EEPROM_ADDR_DDR3 0x90
96 #define EEPROM_ADDR_CHIP 0x120
97 
98 #undef CONFIG_MII
99 #define CONFIG_PHY_SMSC
100 
101 #define CONFIG_FACTORYSET
102 
103 /* use both define to compile a SPL compliance test  */
104 /*
105 #define CONFIG_SPL_CMT
106 #define CONFIG_SPL_CMT_DEBUG
107 */
108 
109 /* nedded by compliance test in read mode */
110 #if defined(CONFIG_SPL_CMT)
111 #define CONFIG_SYS_DCACHE_OFF
112 #endif
113 
114 /* Define own nand partitions */
115 #define CONFIG_ENV_OFFSET_REDUND	0xB80000
116 #define CONFIG_ENV_SIZE_REDUND		CONFIG_ENV_SIZE
117 #define CONFIG_ENV_RANGE		(4 * CONFIG_SYS_ENV_SECT_SIZE)
118 
119 
120 
121 #undef COMMON_ENV_DFU_ARGS
122 #define COMMON_ENV_DFU_ARGS	"dfu_args=run bootargs_defaults;" \
123 				"setenv bootargs ${bootargs};" \
124 				"mtdparts default;" \
125 				"draco_led 1;" \
126 				"dfu 0 mtd 0;" \
127 				"draco_led 0;\0" \
128 
129 #undef DFU_ALT_INFO_NAND_V2
130 #define DFU_ALT_INFO_NAND_V2 \
131 	"spl mtddev;" \
132 	"spl.backup1 mtddev;" \
133 	"spl.backup2 mtddev;" \
134 	"spl.backup3 mtddev;" \
135 	"u-boot mtddev;" \
136 	"u-boot.env0 mtddev;" \
137 	"u-boot.env1 mtddev;" \
138 	"rootfs mtddevubi" \
139 
140 #undef CONFIG_ENV_SETTINGS_NAND_V2
141 #define CONFIG_ENV_SETTINGS_NAND_V2 \
142 	"nand_active_ubi_vol=rootfs_a\0" \
143 	"rootfs_name=rootfs\0" \
144 	"kernel_name=uImage\0"\
145 	"nand_root_fs_type=ubifs rootwait=1\0" \
146 	"nand_args=run bootargs_defaults;" \
147 		"mtdparts default;" \
148 		"setenv ${partitionset_active} true;" \
149 		"if test -n ${A}; then " \
150 			"setenv nand_active_ubi_vol ${rootfs_name}_a;" \
151 		"fi;" \
152 		"if test -n ${B}; then " \
153 			"setenv nand_active_ubi_vol ${rootfs_name}_b;" \
154 		"fi;" \
155 		"setenv nand_root ubi0:${nand_active_ubi_vol} rw " \
156 		"ubi.mtd=rootfs,${ubi_off};" \
157 		"setenv bootargs ${bootargs} " \
158 		"root=${nand_root} noinitrd ${mtdparts} " \
159 		"rootfstype=${nand_root_fs_type} ip=${ip_method} " \
160 		"console=ttyMTD,mtdoops console=ttyO0,115200n8 mtdoops.mtddev" \
161 		"=mtdoops\0" \
162 	COMMON_ENV_DFU_ARGS \
163 		"dfu_alt_info=" DFU_ALT_INFO_NAND_V2 "\0" \
164 	COMMON_ENV_NAND_BOOT \
165 		"ubi part rootfs ${ubi_off};" \
166 		"ubifsmount ubi0:${nand_active_ubi_vol};" \
167 		"ubifsload ${kloadaddr} boot/${kernel_name};" \
168 		"ubifsload ${loadaddr} boot/${dtb_name}.dtb;" \
169 		"bootm ${kloadaddr} - ${loadaddr}\0" \
170 	"nand_boot_backup=ubifsload ${loadaddr} boot/am335x-draco.dtb;" \
171 		"bootm ${kloadaddr} - ${loadaddr}\0" \
172 	COMMON_ENV_NAND_CMDS
173 
174 #ifndef CONFIG_SPL_BUILD
175 
176 #define CONFIG_NAND_CS_INIT
177 #define ETAMIN_NAND_GPMC_CONFIG1	0x00000800
178 #define ETAMIN_NAND_GPMC_CONFIG2	0x001e1e00
179 #define ETAMIN_NAND_GPMC_CONFIG3	0x001e1e00
180 #define ETAMIN_NAND_GPMC_CONFIG4	0x16051807
181 #define ETAMIN_NAND_GPMC_CONFIG5	0x00151e1e
182 #define ETAMIN_NAND_GPMC_CONFIG6	0x16000f80
183 #define CONFIG_MTD_CONCAT
184 
185 /* Default env settings */
186 #define CONFIG_EXTRA_ENV_SETTINGS \
187 	"hostname=etamin\0" \
188 	"ubi_off=4096\0"\
189 	"nand_img_size=0x400000\0" \
190 	"optargs=\0" \
191 	"preboot=draco_led 0\0" \
192 	CONFIG_ENV_SETTINGS_BUTTONS_AND_LEDS \
193 	CONFIG_ENV_SETTINGS_V2 \
194 	CONFIG_ENV_SETTINGS_NAND_V2
195 
196 #ifndef CONFIG_RESTORE_FLASH
197 
198 #define CONFIG_BOOTCOMMAND \
199 "if dfubutton; then " \
200 	"run dfu_start; " \
201 	"reset; " \
202 "fi;" \
203 "run nand_boot;" \
204 "run nand_boot_backup;" \
205 "reset;"
206 
207 
208 #else
209 #define CONFIG_BOOTCOMMAND			\
210 	"setenv autoload no; "			\
211 	"dhcp; "				\
212 	"if tftp 80000000 debrick.scr; then "	\
213 		"source 80000000; "		\
214 	"fi"
215 #endif
216 #endif	/* CONFIG_SPL_BUILD */
217 #endif	/* ! __CONFIG_ETAMIN_H */
218