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