1 /* 2 * (C) Copyright 2016 3 * Heiko Schocher, DENX Software Engineering, hs@denx.de. 4 * 5 * Based on: 6 * am335x_evm.h 7 * 8 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ 9 * 10 * SPDX-License-Identifier: GPL-2.0+ 11 */ 12 13 #ifndef __CONFIG_AM335X_SHC_H 14 #define __CONFIG_AM335X_SHC_H 15 16 #include <configs/ti_am335x_common.h> 17 18 /* settings we don;t want on this board */ 19 #undef CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC 20 #undef CONFIG_CMD_EXT4 21 #undef CONFIG_CMD_EXT4_WRITE 22 #undef CONFIG_CMD_MMC_SPI 23 #undef CONFIG_CMD_SPI 24 25 #define CONFIG_CMD_CACHE 26 27 #ifndef CONFIG_SPL_BUILD 28 # define CONFIG_TIMESTAMP 29 # define CONFIG_LZO 30 #endif 31 32 #define CONFIG_SYS_BOOTM_LEN (16 << 20) 33 34 #define MACH_TYPE_BOSCH_SHC_B 9001 35 #define MACH_TYPE_BOSCH_SHC_B2 9002 36 #define MACH_TYPE_BOSCH_SHC_C 9003 37 #define MACH_TYPE_BOSCH_SHC_C2 9004 38 #define MACH_TYPE_BOSCH_SHC_C3 9005 39 #define MACH_TYPE_BOSCH_SHC 9006 40 #ifdef CONFIG_B_SAMPLE 41 # define CONFIG_MACH_TYPE MACH_TYPE_BOSCH_SHC_B 42 #elif defined CONFIG_B2_SAMPLE 43 # define CONFIG_MACH_TYPE MACH_TYPE_BOSCH_SHC_B2 44 #elif defined CONFIG_C_SAMPLE 45 # define CONFIG_MACH_TYPE MACH_TYPE_BOSCH_SHC_C 46 #elif defined CONFIG_C2_SAMPLE 47 # define CONFIG_MACH_TYPE MACH_TYPE_BOSCH_SHC_C2 48 #elif defined CONFIG_C3_SAMPLE 49 # define CONFIG_MACH_TYPE MACH_TYPE_BOSCH_SHC_C3 50 #elif defined CONFIG_SERIES 51 # define CONFIG_MACH_TYPE MACH_TYPE_BOSCH_SHC 52 #endif /* #ifdef CONFIG_B_SAMPLE */ 53 54 #define CONFIG_BOARD_LATE_INIT 55 56 /* Clock Defines */ 57 #define V_OSCK 24000000 /* Clock output from T2 */ 58 #define V_SCLK (V_OSCK) 59 60 #define CONFIG_ENV_IS_IN_MMC 1 61 62 /* 63 * in case of SD Card or Network boot we want to have a possibility to 64 * debrick the shc, therefore do not read environment from eMMC 65 */ 66 #if defined(CONFIG_SHC_SDBOOT) || defined(CONFIG_SHC_NETBOOT) 67 #define CONFIG_SYS_MMC_ENV_DEV 0 68 #else 69 #define CONFIG_SYS_MMC_ENV_DEV 1 70 #endif 71 72 /* 73 * Info when using boot partitions: As environment resides within first 74 * 128 kB, MLO must start at 128 kB == 0x20000 75 * ENV at MMC Boot0 Partition - 0/Undefined=user, 1=boot0, 2=boot1, 76 * 4..7=general0..3 77 */ 78 #define CONFIG_ENV_SIZE 0x1000 /* 4 KB */ 79 #define CONFIG_ENV_OFFSET 0x7000 /* 28 kB */ 80 81 #define CONFIG_HSMMC2_8BIT 82 83 #define CONFIG_ENV_OFFSET_REDUND 0x9000 /* 36 kB */ 84 #define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE 85 86 /* Enhance our eMMC support / experience. */ 87 #define CONFIG_CMD_GPT 88 #define CONFIG_EFI_PARTITION 89 #ifdef CONFIG_SPL_BUILD 90 #undef CONFIG_ISO_PARTITION 91 #endif 92 #ifndef CONFIG_SHC_ICT 93 /* 94 * In builds other than ICT, reset to retry after timeout 95 * Define a timeout after which a stopped bootloader continues autoboot 96 * (only works with CONFIG_RESET_TO_RETRY) 97 */ 98 # define CONFIG_BOOT_RETRY_TIME 30 99 # define CONFIG_RESET_TO_RETRY 100 #endif 101 102 #define CONFIG_ENV_VARS_UBOOT_CONFIG 103 #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG 104 105 #ifndef CONFIG_SPL_BUILD 106 #define CONFIG_EXTRA_ENV_SETTINGS \ 107 "loadaddr=0x80200000\0" \ 108 "kloadaddr=0x84000000\0" \ 109 "fdtaddr=0x85000000\0" \ 110 "fdt_high=0xffffffff\0" \ 111 "rdaddr=0x81000000\0" \ 112 "bootfile=uImage\0" \ 113 "fdtfile=am335x-shc.dtb\0" \ 114 "verify=no\0" \ 115 "serverip=10.55.152.184\0" \ 116 "rootpath=/srv/nfs/shc-rootfs\0" \ 117 "console=ttyO0,115200n8\0" \ 118 "optargs=quiet\0" \ 119 "mmcdev=1\0" \ 120 "harakiri=0\0" \ 121 "mmcpart=2\0" \ 122 "active_root=root1\0" \ 123 "inactive_root=root2\0" \ 124 "mmcrootfstype=ext4 rootwait\0" \ 125 "nfsopts=nolock\0" \ 126 "static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \ 127 "::off\0" \ 128 "ip_method=none\0" \ 129 "bootargs_defaults=setenv bootargs " \ 130 "console=${console} " \ 131 "${optargs}\0" \ 132 "mmcargs=run bootargs_defaults;" \ 133 "setenv bootargs ${bootargs} " \ 134 "root=${mmcroot} " \ 135 "rootfstype=${mmcrootfstype} ip=${ip_method}\0" \ 136 "netargs=setenv bootargs console=${console} " \ 137 "${optargs} " \ 138 "root=/dev/nfs " \ 139 "nfsroot=${serverip}:${rootpath},${nfsopts} rw " \ 140 "ip=dhcp\0" \ 141 "bootenv=uEnv.txt\0" \ 142 "loadbootenv=if fatload mmc ${mmcdev} ${loadaddr} ${bootenv}; then " \ 143 "echo Loaded environment from ${bootenv}; " \ 144 "run importbootenv; " \ 145 "fi;\0" \ 146 "importbootenv=echo Importing environment variables from uEnv.txt ...; " \ 147 "env import -t $loadaddr $filesize\0" \ 148 "loaduimagefat=fatload mmc ${mmcdev} ${kloadaddr} ${bootfile}\0" \ 149 "loaduimage=ext2load mmc ${mmcdev}:${mmcpart} ${kloadaddr} /boot/${bootfile}\0" \ 150 "loadfdt=ext2load mmc ${mmcdev}:${mmcpart} ${fdtaddr} /boot/${fdtfile}\0" \ 151 "netloaduimage=tftp ${loadaddr} ${bootfile}\0" \ 152 "netloadfdt=tftp ${fdtaddr} ${fdtfile}\0" \ 153 "mmcboot=echo Booting Linux from ${mmcdevice} ...; " \ 154 "run mmcargs; " \ 155 "if run loadfdt; then " \ 156 "echo device tree detected; " \ 157 "bootm ${kloadaddr} - ${fdtaddr}; " \ 158 "else " \ 159 "bootm ${kloadaddr}; " \ 160 "fi; \0" \ 161 "netboot=echo Booting from network ...; " \ 162 "setenv autoload no; " \ 163 "dhcp; " \ 164 "run netloaduimage; " \ 165 "run netargs; " \ 166 "echo NFS path: ${serverip}:${rootpath};" \ 167 "if run netloadfdt; then " \ 168 "echo device tree detected; " \ 169 "bootm ${loadaddr} - ${fdtaddr}; " \ 170 "else " \ 171 "bootm ${loadaddr}; " \ 172 "fi; \0" \ 173 "emmc_erase=if test ${harakiri} = 1 ; then echo erase emmc ...; setenv mmcdev 1; mmc erase 0 200; reset; fi; \0" \ 174 "mmcpart_gp=mmcpart gp 1 40; \0" \ 175 "mmcpart_enhance=mmcpart enhance 0 64; \0" \ 176 "mmcpart_rel_write=mmcpart rel_write 1f; \0" \ 177 "mmcpart_commit=mmcpart commit 1; \0" \ 178 "mmc_hw_part=run mmcpart_gp; run mmcpart_enhance; run mmcpart_rel_write; run mmcpart_commit; \0" \ 179 "led_success=gpio set 22; \0" \ 180 "fusecmd=mmc dev 1; if mmcpart iscommitted; then echo HW Partitioning already committed; mmcpart list; else run mmc_hw_part; fi; run led_success; \0" \ 181 "uenv_exec=if test -n $uenvcmd; then " \ 182 "echo Running uenvcmd ...; " \ 183 "run uenvcmd; " \ 184 "fi;\0" \ 185 "sd_setup=echo SD/MMC-Card detected on device 0; " \ 186 "setenv mmcdevice SD; " \ 187 "setenv mmcdev 0; " \ 188 "setenv mmcpart 2; " \ 189 "setenv mmcroot /dev/mmcblk${mmcdev}p${mmcpart};\0" \ 190 "emmc_setup=echo eMMC detected on device 1; " \ 191 "setenv mmcdevice eMMC; " \ 192 "setenv mmcdev 1; " \ 193 "run emmc_erase; " \ 194 "if test ${active_root} = root2; then " \ 195 "echo Active root is partition 6 (root2); " \ 196 "setenv mmcpart 6; " \ 197 "else " \ 198 "echo Active root is partition 5 (root1); " \ 199 "setenv mmcpart 5; " \ 200 "fi; " \ 201 "setenv mmcroot /dev/mmcblk${mmcdev}p${mmcpart};\0" 202 #endif /* #ifndef CONFIG_SPL_BUILD */ 203 204 #if defined CONFIG_SHC_NETBOOT 205 /* Network Boot */ 206 # define CONFIG_BOOTCOMMAND \ 207 "run fusecmd; " \ 208 "if run netboot; then " \ 209 "echo Booting from network; " \ 210 "else " \ 211 "echo ERROR: Cannot boot from network!; " \ 212 "panic; " \ 213 "fi; " 214 215 #elif defined CONFIG_SHC_SDBOOT /* !defined CONFIG_SHC_NETBOOT */ 216 /* SD-Card Boot */ 217 # define CONFIG_BOOTCOMMAND \ 218 "if mmc dev 0; mmc rescan; then " \ 219 "run sd_setup; " \ 220 "else " \ 221 "echo ERROR: SD/MMC-Card not detected!; " \ 222 "panic; " \ 223 "fi; " \ 224 "if run loaduimage; then " \ 225 "echo Bootable SD/MMC-Card inserted, booting from it!; " \ 226 "run mmcboot; " \ 227 "else " \ 228 "echo ERROR: Unable to load uImage from SD/MMC-Card!; " \ 229 "panic; " \ 230 "fi; " 231 232 #elif defined CONFIG_SHC_ICT 233 /* ICT adapter boots only u-boot and does HW partitioning */ 234 # define CONFIG_BOOTCOMMAND \ 235 "if mmc dev 0; mmc rescan; then " \ 236 "run sd_setup; " \ 237 "else " \ 238 "echo ERROR: SD/MMC-Card not detected!; " \ 239 "panic; " \ 240 "fi; " \ 241 "run fusecmd; " 242 243 #else /* !defined CONFIG_SHC_NETBOOT, !defined CONFIG_SHC_SDBOOT */ 244 /* Regular Boot from internal eMMC */ 245 # define CONFIG_BOOTCOMMAND \ 246 "if mmc dev 1; mmc rescan; then " \ 247 "run emmc_setup; " \ 248 "else " \ 249 "echo ERROR: eMMC device not detected!; " \ 250 "panic; " \ 251 "fi; " \ 252 "if run loaduimage; then " \ 253 "run mmcboot; " \ 254 "else " \ 255 "echo ERROR Unable to load uImage from eMMC!; " \ 256 "echo Performing Rollback!; " \ 257 "setenv _active_ ${active_root}; " \ 258 "setenv _inactive_ ${inactive_root}; " \ 259 "setenv active_root ${_inactive_}; " \ 260 "setenv inactive_root ${_active_}; " \ 261 "saveenv; " \ 262 "reset; " \ 263 "fi; " 264 265 #endif /* Regular Boot */ 266 267 /* NS16550 Configuration */ 268 #define CONFIG_SYS_NS16550_COM1 0x44e09000 /* UART0 */ 269 #define CONFIG_SYS_NS16550_COM2 0x48022000 /* UART1 */ 270 #define CONFIG_SYS_NS16550_COM3 0x48024000 /* UART2 */ 271 #define CONFIG_SYS_NS16550_COM4 0x481a6000 /* UART3 */ 272 #define CONFIG_SYS_NS16550_COM5 0x481a8000 /* UART4 */ 273 #define CONFIG_SYS_NS16550_COM6 0x481aa000 /* UART5 */ 274 #define CONFIG_BAUDRATE 115200 275 #define CONFIG_CONS_INDEX 1 276 277 /* PMIC support */ 278 #define CONFIG_POWER_TPS65217 279 280 /* SPL */ 281 282 #define CONFIG_SPL_LDSCRIPT "arch/arm/mach-omap2/am33xx/u-boot-spl.lds" 283 284 #ifndef CONFIG_SPL_USBETH_SUPPORT 285 #define CONFIG_FASTBOOT_FLASH_MMC_DEV 1 286 #endif 287 288 /* 289 * Disable MMC DM for SPL build and can be re-enabled after adding 290 * DM support in SPL 291 */ 292 #ifdef CONFIG_SPL_BUILD 293 #undef CONFIG_DM_MMC 294 #undef CONFIG_TIMER 295 #endif 296 297 #define CONFIG_CMD_DHCP 298 #define CONFIG_CMD_PING 299 #define CONFIG_DRIVER_TI_CPSW 300 #define CONFIG_MII 301 #define CONFIG_BOOTP_DEFAULT 302 #define CONFIG_BOOTP_DNS 303 #define CONFIG_BOOTP_DNS2 304 #define CONFIG_BOOTP_SEND_HOSTNAME 305 #define CONFIG_BOOTP_GATEWAY 306 #define CONFIG_BOOTP_SUBNETMASK 307 #define CONFIG_NET_RETRY_COUNT 10 308 #define CONFIG_NET_MULTI 309 #define CONFIG_PHY_GIGE 310 #define CONFIG_PHYLIB 311 #define CONFIG_PHY_ADDR 0 312 #define CONFIG_PHY_SMSC 313 314 /* I2C configuration */ 315 #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* Main EEPROM */ 316 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2 317 #define CONFIG_SYS_I2C_SPEED 400000 318 #define CONFIG_SYS_I2C_SLAVE 1 319 320 #define CONFIG_SHOW_BOOT_PROGRESS 321 322 #if defined CONFIG_SHC_NETBOOT 323 #ifdef CONFIG_SPL_BUILD 324 #define CONFIG_ENV_IS_NOWHERE 325 #undef CONFIG_ENV_IS_IN_MMC 326 #endif 327 #endif 328 #endif /* ! __CONFIG_AM335X_SHC_H */ 329