1 /* 2 * am43xx_evm.h 3 * 4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/ 5 * 6 * SPDX-License-Identifier: GPL-2.0+ 7 */ 8 9 #ifndef __CONFIG_AM43XX_EVM_H 10 #define __CONFIG_AM43XX_EVM_H 11 12 #define CONFIG_BOARD_LATE_INIT 13 #define CONFIG_ARCH_CPU_INIT 14 #define CONFIG_SYS_CACHELINE_SIZE 32 15 #define CONFIG_MAX_RAM_BANK_SIZE (1024 << 21) /* 2GB */ 16 #define CONFIG_SYS_TIMERBASE 0x48040000 /* Use Timer2 */ 17 18 #include <asm/arch/omap.h> 19 20 /* NS16550 Configuration */ 21 #define CONFIG_SYS_NS16550_CLK 48000000 22 #if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_DM_SERIAL) 23 #define CONFIG_SYS_NS16550_SERIAL 24 #define CONFIG_SYS_NS16550_REG_SIZE (-4) 25 #endif 26 27 /* I2C Configuration */ 28 #define CONFIG_CMD_EEPROM 29 #define CONFIG_ENV_EEPROM_IS_ON_I2C 30 #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* Main EEPROM */ 31 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2 32 33 /* Power */ 34 #define CONFIG_POWER 35 #define CONFIG_POWER_I2C 36 #define CONFIG_POWER_TPS65218 37 #define CONFIG_POWER_TPS62362 38 39 /* SPL defines. */ 40 #define CONFIG_SPL_TEXT_BASE CONFIG_ISW_ENTRY_ADDR 41 #define CONFIG_SPL_MAX_SIZE (NON_SECURE_SRAM_END - \ 42 CONFIG_PUB_ROM_DATA_SIZE - \ 43 CONFIG_SPL_TEXT_BASE) 44 #define CONFIG_SYS_SPL_ARGS_ADDR (CONFIG_SYS_SDRAM_BASE + \ 45 (128 << 20)) 46 #define CONFIG_SPL_POWER_SUPPORT 47 #define CONFIG_SPL_YMODEM_SUPPORT 48 49 /* Enabling L2 Cache */ 50 #define CONFIG_SYS_L2_PL310 51 #define CONFIG_SYS_PL310_BASE 0x48242000 52 #define CONFIG_SYS_CACHELINE_SIZE 32 53 54 /* 55 * Since SPL did pll and ddr initialization for us, 56 * we don't need to do it twice. 57 */ 58 #if !defined(CONFIG_SPL_BUILD) && !defined(CONFIG_QSPI_BOOT) 59 #define CONFIG_SKIP_LOWLEVEL_INIT 60 #endif 61 62 /* 63 * When building U-Boot such that there is no previous loader 64 * we need to call board_early_init_f. This is taken care of in 65 * s_init when we have SPL used. 66 */ 67 #if !defined(CONFIG_SKIP_LOWLEVEL_INIT) && !defined(CONFIG_SPL) 68 #define CONFIG_BOARD_EARLY_INIT_F 69 #endif 70 71 /* Now bring in the rest of the common code. */ 72 #include <configs/ti_armv7_omap.h> 73 74 /* Always 64 KiB env size */ 75 #define CONFIG_ENV_SIZE (64 << 10) 76 77 #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG 78 79 /* Clock Defines */ 80 #define V_OSCK 24000000 /* Clock output from T2 */ 81 #define V_SCLK (V_OSCK) 82 83 /* NS16550 Configuration */ 84 #define CONFIG_SYS_NS16550_COM1 0x44e09000 /* Base EVM has UART0 */ 85 86 #define CONFIG_ENV_IS_IN_FAT 87 #define FAT_ENV_INTERFACE "mmc" 88 #define FAT_ENV_DEVICE_AND_PART "0:1" 89 #define FAT_ENV_FILE "uboot.env" 90 #define CONFIG_FAT_WRITE 91 92 #define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/omap-common/u-boot-spl.lds" 93 94 /* SPL USB Support */ 95 #ifdef CONFIG_SPL_USB_HOST_SUPPORT 96 #define CONFIG_SPL_USB_SUPPORT 97 #endif 98 99 #if defined(CONFIG_SPL_USB_HOST_SUPPORT) || !defined(CONFIG_SPL_BUILD) 100 #define CONFIG_SYS_USB_FAT_BOOT_PARTITION 1 101 #define CONFIG_USB_HOST 102 #define CONFIG_USB_XHCI_DWC3 103 #define CONFIG_USB_XHCI_OMAP 104 #define CONFIG_USB_STORAGE 105 #define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 2 106 107 #define CONFIG_OMAP_USB_PHY 108 #define CONFIG_AM437X_USB2PHY2_HOST 109 #endif 110 111 #if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_USBETH_SUPPORT) 112 #undef CONFIG_USB_DWC3_PHY_OMAP 113 #undef CONFIG_USB_DWC3_OMAP 114 #undef CONFIG_USB_DWC3 115 #undef CONFIG_USB_DWC3_GADGET 116 117 #undef CONFIG_USB_GADGET_DOWNLOAD 118 #undef CONFIG_USB_GADGET_VBUS_DRAW 119 #undef CONFIG_G_DNL_MANUFACTURER 120 #undef CONFIG_G_DNL_VENDOR_NUM 121 #undef CONFIG_G_DNL_PRODUCT_NUM 122 #undef CONFIG_USB_GADGET_DUALSPEED 123 #endif 124 125 /* 126 * Disable MMC DM for SPL build and can be re-enabled after adding 127 * DM support in SPL 128 */ 129 #ifdef CONFIG_SPL_BUILD 130 #undef CONFIG_DM_MMC 131 #undef CONFIG_DM_SPI 132 #undef CONFIG_DM_SPI_FLASH 133 #undef CONFIG_TIMER 134 #endif 135 136 #ifndef CONFIG_SPL_BUILD 137 /* USB Device Firmware Update support */ 138 #define CONFIG_USB_FUNCTION_DFU 139 #define CONFIG_DFU_RAM 140 141 #define CONFIG_DFU_MMC 142 #define DFU_ALT_INFO_MMC \ 143 "dfu_alt_info_mmc=" \ 144 "boot part 0 1;" \ 145 "rootfs part 0 2;" \ 146 "MLO fat 0 1;" \ 147 "spl-os-args fat 0 1;" \ 148 "spl-os-image fat 0 1;" \ 149 "u-boot.img fat 0 1;" \ 150 "uEnv.txt fat 0 1\0" 151 152 #define DFU_ALT_INFO_EMMC \ 153 "dfu_alt_info_emmc=" \ 154 "MLO raw 0x100 0x100 mmcpart 0;" \ 155 "u-boot.img raw 0x300 0x1000 mmcpart 0\0" 156 157 #define CONFIG_DFU_RAM 158 #define DFU_ALT_INFO_RAM \ 159 "dfu_alt_info_ram=" \ 160 "kernel ram 0x80200000 0x4000000;" \ 161 "fdt ram 0x80f80000 0x80000;" \ 162 "ramdisk ram 0x81000000 0x4000000\0" 163 164 #define CONFIG_DFU_SF 165 #define DFU_ALT_INFO_QSPI \ 166 "dfu_alt_info_qspi=" \ 167 "u-boot.bin raw 0x0 0x080000;" \ 168 "u-boot.backup raw 0x080000 0x080000;" \ 169 "u-boot-spl-os raw 0x100000 0x010000;" \ 170 "u-boot-env raw 0x110000 0x010000;" \ 171 "u-boot-env.backup raw 0x120000 0x010000;" \ 172 "kernel raw 0x130000 0x800000\0" 173 174 #define DFUARGS \ 175 "dfu_bufsiz=0x10000\0" \ 176 DFU_ALT_INFO_MMC \ 177 DFU_ALT_INFO_EMMC \ 178 DFU_ALT_INFO_RAM \ 179 DFU_ALT_INFO_QSPI 180 #else 181 #define DFUARGS 182 #endif 183 184 #ifdef CONFIG_QSPI_BOOT 185 #ifndef CONFIG_SYS_TEXT_BASE 186 #define CONFIG_SYS_TEXT_BASE CONFIG_ISW_ENTRY_ADDR 187 #endif 188 #undef CONFIG_ENV_IS_IN_FAT 189 #define CONFIG_ENV_IS_IN_SPI_FLASH 190 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT 191 #define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED 192 #define CONFIG_ENV_SECT_SIZE (64 << 10) /* 64 KB sectors */ 193 #define CONFIG_ENV_OFFSET 0x110000 194 #define CONFIG_ENV_OFFSET_REDUND 0x120000 195 #ifdef MTDIDS_DEFAULT 196 #undef MTDIDS_DEFAULT 197 #endif 198 #ifdef MTDPARTS_DEFAULT 199 #undef MTDPARTS_DEFAULT 200 #endif 201 #define MTDPARTS_DEFAULT "mtdparts=qspi.0:512k(QSPI.u-boot)," \ 202 "512k(QSPI.u-boot.backup)," \ 203 "512k(QSPI.u-boot-spl-os)," \ 204 "64k(QSPI.u-boot-env)," \ 205 "64k(QSPI.u-boot-env.backup)," \ 206 "8m(QSPI.kernel)," \ 207 "-(QSPI.file-system)" 208 #endif 209 210 /* SPI */ 211 #undef CONFIG_OMAP3_SPI 212 #define CONFIG_TI_SPI_MMAP 213 #define CONFIG_QSPI_SEL_GPIO 48 214 #define CONFIG_SF_DEFAULT_SPEED 48000000 215 #define CONFIG_SF_DEFAULT_MODE SPI_MODE_3 216 #define CONFIG_QSPI_QUAD_SUPPORT 217 #define CONFIG_TI_EDMA3 218 219 /* Enhance our eMMC support / experience. */ 220 #define CONFIG_CMD_GPT 221 #define CONFIG_EFI_PARTITION 222 223 #ifndef CONFIG_SPL_BUILD 224 #define CONFIG_EXTRA_ENV_SETTINGS \ 225 DEFAULT_LINUX_BOOT_ENV \ 226 DEFAULT_MMC_TI_ARGS \ 227 "fdtfile=undefined\0" \ 228 "bootpart=0:2\0" \ 229 "bootdir=/boot\0" \ 230 "bootfile=zImage\0" \ 231 "console=ttyO0,115200n8\0" \ 232 "partitions=" \ 233 "uuid_disk=${uuid_gpt_disk};" \ 234 "name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}\0" \ 235 "optargs=\0" \ 236 "usbroot=/dev/sda2 rw\0" \ 237 "usbrootfstype=ext4 rootwait\0" \ 238 "usbdev=0\0" \ 239 "ramroot=/dev/ram0 rw\0" \ 240 "ramrootfstype=ext2\0" \ 241 "usbargs=setenv bootargs console=${console} " \ 242 "${optargs} " \ 243 "root=${usbroot} " \ 244 "rootfstype=${usbrootfstype}\0" \ 245 "ramargs=setenv bootargs console=${console} " \ 246 "${optargs} " \ 247 "root=${ramroot} " \ 248 "rootfstype=${ramrootfstype}\0" \ 249 "loadramdisk=load ${devtype} ${devnum} ${rdaddr} ramdisk.gz\0" \ 250 "loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \ 251 "loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \ 252 "mmcboot=mmc dev ${mmcdev}; " \ 253 "setenv devnum ${mmcdev}; " \ 254 "setenv devtype mmc; " \ 255 "if mmc rescan; then " \ 256 "echo SD/MMC found on device ${devnum};" \ 257 "if run loadimage; then " \ 258 "run loadfdt; " \ 259 "echo Booting from mmc${mmcdev} ...; " \ 260 "run args_mmc; " \ 261 "bootz ${loadaddr} - ${fdtaddr}; " \ 262 "fi;" \ 263 "fi;\0" \ 264 "usbboot=" \ 265 "setenv devnum ${usbdev}; " \ 266 "setenv devtype usb; " \ 267 "usb start ${usbdev}; " \ 268 "if usb dev ${usbdev}; then " \ 269 "if run loadbootenv; then " \ 270 "echo Loaded environment from ${bootenv};" \ 271 "run importbootenv;" \ 272 "fi;" \ 273 "if test -n $uenvcmd; then " \ 274 "echo Running uenvcmd ...;" \ 275 "run uenvcmd;" \ 276 "fi;" \ 277 "if run loadimage; then " \ 278 "run loadfdt; " \ 279 "echo Booting from usb ${usbdev}...; " \ 280 "run usbargs;" \ 281 "bootz ${loadaddr} - ${fdtaddr}; " \ 282 "fi;" \ 283 "fi\0" \ 284 "fi;" \ 285 "usb stop ${usbdev};\0" \ 286 "findfdt="\ 287 "if test $board_name = AM43EPOS; then " \ 288 "setenv fdtfile am43x-epos-evm.dtb; fi; " \ 289 "if test $board_name = AM43__GP; then " \ 290 "setenv fdtfile am437x-gp-evm.dtb; fi; " \ 291 "if test $board_name = AM43XXHS; then " \ 292 "setenv fdtfile am437x-gp-evm.dtb; fi; " \ 293 "if test $board_name = AM43__SK; then " \ 294 "setenv fdtfile am437x-sk-evm.dtb; fi; " \ 295 "if test $board_name = AM43_IDK; then " \ 296 "setenv fdtfile am437x-idk-evm.dtb; fi; " \ 297 "if test $fdtfile = undefined; then " \ 298 "echo WARNING: Could not determine device tree; fi; \0" \ 299 NANDARGS \ 300 NETARGS \ 301 DFUARGS \ 302 303 #define CONFIG_BOOTCOMMAND \ 304 "run findfdt; " \ 305 "run envboot;" \ 306 "run mmcboot;" \ 307 "run usbboot;" \ 308 NANDBOOT \ 309 310 #endif 311 312 #ifndef CONFIG_SPL_BUILD 313 /* CPSW Ethernet */ 314 #define CONFIG_MII 315 #define CONFIG_BOOTP_DEFAULT 316 #define CONFIG_BOOTP_DNS 317 #define CONFIG_BOOTP_DNS2 318 #define CONFIG_BOOTP_SEND_HOSTNAME 319 #define CONFIG_BOOTP_GATEWAY 320 #define CONFIG_BOOTP_SUBNETMASK 321 #define CONFIG_NET_RETRY_COUNT 10 322 #define CONFIG_PHY_GIGE 323 #endif 324 325 #define CONFIG_DRIVER_TI_CPSW 326 #define CONFIG_PHYLIB 327 #define PHY_ANEG_TIMEOUT 8000 /* PHY needs longer aneg time at 1G */ 328 329 #define CONFIG_SPL_ENV_SUPPORT 330 #define CONFIG_SPL_NET_VCI_STRING "AM43xx U-Boot SPL" 331 332 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_ETH_SUPPORT) 333 #undef CONFIG_ENV_IS_IN_FAT 334 #define CONFIG_ENV_IS_NOWHERE 335 #define CONFIG_SPL_NET_SUPPORT 336 #endif 337 338 #define CONFIG_SYS_RX_ETH_BUFFER 64 339 340 /* NAND support */ 341 #ifdef CONFIG_NAND 342 /* NAND: device related configs */ 343 #define CONFIG_SYS_NAND_PAGE_SIZE 4096 344 #define CONFIG_SYS_NAND_OOBSIZE 224 345 #define CONFIG_SYS_NAND_BLOCK_SIZE (256*1024) 346 #define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \ 347 CONFIG_SYS_NAND_PAGE_SIZE) 348 #define CONFIG_SYS_NAND_5_ADDR_CYCLE 349 /* NAND: driver related configs */ 350 #define CONFIG_NAND_OMAP_GPMC 351 #define CONFIG_NAND_OMAP_ELM 352 #define CONFIG_SYS_NAND_ONFI_DETECTION 353 #define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH16_CODE_HW 354 #define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS 355 #define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, \ 356 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, \ 357 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, \ 358 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, \ 359 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, \ 360 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, \ 361 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, \ 362 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, \ 363 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, \ 364 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, \ 365 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, \ 366 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, \ 367 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, \ 368 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, \ 369 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, \ 370 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, \ 371 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, \ 372 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, \ 373 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, \ 374 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, \ 375 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, \ 376 } 377 #define CONFIG_SYS_NAND_ECCSIZE 512 378 #define CONFIG_SYS_NAND_ECCBYTES 26 379 #define MTDIDS_DEFAULT "nand0=nand.0" 380 #define MTDPARTS_DEFAULT "mtdparts=nand.0:" \ 381 "256k(NAND.SPL)," \ 382 "256k(NAND.SPL.backup1)," \ 383 "256k(NAND.SPL.backup2)," \ 384 "256k(NAND.SPL.backup3)," \ 385 "512k(NAND.u-boot-spl-os)," \ 386 "1m(NAND.u-boot)," \ 387 "256k(NAND.u-boot-env)," \ 388 "256k(NAND.u-boot-env.backup1)," \ 389 "7m(NAND.kernel)," \ 390 "-(NAND.file-system)" 391 #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x00180000 392 /* NAND: SPL related configs */ 393 #ifdef CONFIG_SPL_NAND_SUPPORT 394 #define CONFIG_SPL_NAND_AM33XX_BCH 395 #endif 396 /* NAND: SPL falcon mode configs */ 397 #ifdef CONFIG_SPL_OS_BOOT 398 #define CONFIG_CMD_SPL_NAND_OFS 0x00100000 /* os parameters */ 399 #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x00300000 /* kernel offset */ 400 #define CONFIG_CMD_SPL_WRITE_SIZE CONFIG_SYS_NAND_BLOCK_SIZE 401 #endif 402 #define NANDARGS \ 403 "mtdids=" MTDIDS_DEFAULT "\0" \ 404 "mtdparts=" MTDPARTS_DEFAULT "\0" \ 405 "nandargs=setenv bootargs console=${console} " \ 406 "${optargs} " \ 407 "root=${nandroot} " \ 408 "rootfstype=${nandrootfstype}\0" \ 409 "nandroot=ubi0:rootfs rw ubi.mtd=NAND.file-system,4096\0" \ 410 "nandrootfstype=ubifs rootwait=1\0" \ 411 "nandboot=echo Booting from nand ...; " \ 412 "run nandargs; " \ 413 "nand read ${fdtaddr} NAND.u-boot-spl-os; " \ 414 "nand read ${loadaddr} NAND.kernel; " \ 415 "bootz ${loadaddr} - ${fdtaddr}\0" 416 #define NANDBOOT "run nandboot; " 417 #else /* !CONFIG_NAND */ 418 #define NANDARGS 419 #define NANDBOOT 420 #endif /* CONFIG_NAND */ 421 422 #endif /* __CONFIG_AM43XX_EVM_H */ 423