u-boot/include/configs/am335x_nmhw21.h

258 lines
8.3 KiB
C

/*
* am335x_nmhw21.h
*
* Copyright (C) 2018-2019 NetModule AG - http://www.netmodule.com/
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation version 2.
*
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
* kind, whether express or implied; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __CONFIG_AM335X_NMHW21_H
#define __CONFIG_AM335X_NMHW21_H
#include <configs/ti_am335x_common.h>
#undef CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC
#undef CONFIG_HW_WATCHDOG
#undef CONFIG_OMPAP_WATCHDOG
#undef CONFIG_SPL_WATCHDOG_SUPPORT
#ifndef CONFIG_SPL_BUILD
# define CONFIG_TIMESTAMP
# define CONFIG_LZO
#endif
#define CONFIG_SYS_BOOTM_LEN (16 << 20)
#define MACH_TYPE_TIAM335EVM 3589 /* Until the next sync */
#define CONFIG_MACH_TYPE MACH_TYPE_TIAM335EVM
#define CONFIG_BOARD_LATE_INIT
/* Clock Defines */
#define V_OSCK 0 /* 0 means detect from sysboot1 config */
#define V_SCLK (V_OSCK)
#include <config_distro_bootcmd.h>
/* Dynamic override for PHY_ANEG_TIMEOUT value */
#ifndef CONFIG_SPL_BUILD
# ifndef __ASSEMBLER__
int eth_phy_timeout(void);
# endif
#endif
#define PHY_ANEG_TIMEOUT eth_phy_timeout()
#define PHY_ANEG_DEFAULT_TIMEOUT 5000
#define CONFIG_ARP_TIMEOUT 200
#undef CONFIG_NET_RETRY_COUNT
#define CONFIG_NET_RETRY_COUNT 5
#define CONFIG_BOOTP_MAY_FAIL
#define CONFIG_BOOTCOUNT_LIMIT
#define CONFIG_BOOTCOUNT_AM33XX
#ifndef CONFIG_SPL_BUILD
/*
* Memory map for booting Linux
*
* 0x80000000 63MB KERNEL_ADDR (kernel_addr), kernel execution address
* 0x83F00000 1MB FDT_ADDR (fdt_addr_r), device tree loading address if not included in kernel
* 0x84000000 126MB RD_ADDR (ramdisk_addr_r), ramdisc loading address
* 0x8BE00000 2MB PXE_ADDR (pxefile_addr_r), pxe configuration file (pxe get command)
* 0x8C000000 1MB LOAD_ADDR (load_addr), loading address for generic files
* 0x8C100000 63MB KERNEL_ADDR_R (kernel_addr_r), kernel loading address (will be relocated to kernel_addr)
* 0x90000000 256MB <>, Free space 512MB systems
* 0xA0000000 512MB <>, Free space, 1GB systems only
* 0xC0000000 End of RAM
*/
#define KERNEL_ADDR "0x80000000"
#define FDT_ADDR "0x83F00000"
#define RD_ADDR "0x84000000"
#define PXE_ADDR "0x8BE00000"
#define LOAD_ADDR "0x8C000000"
#define KERNEL_ADDR_R "0x8C100000"
/*
* Avoid copying ramdisc and dtb above 512MB, as it breaks Linux boot.
* -1 means "do not copy" to high address, use in place.
*/
#define INITRD_HIGH_ADDR "0xffffffff"
#define FDT_HIGH_ADDR "0xffffffff"
#define CONFIG_EXTRA_ENV_SETTINGS \
"fdt_image=am335x-nmhw21-prod1.dtb\0" \
"fdt_addr_r=" FDT_ADDR "\0" \
"fdt_high=" FDT_HIGH_ADDR "\0" \
"initrd_high=" INITRD_HIGH_ADDR "\0" \
"kernel_addr=" KERNEL_ADDR "\0" \
"kernel_addr_r=" KERNEL_ADDR_R "\0" \
"load_addr=" LOAD_ADDR "\0" \
"pxefile_addr_r=" PXE_ADDR "\0" \
"ramdisk_addr_r=" RD_ADDR "\0" \
"defaultconsole=ttyS2\0" \
"fdt_skip_update=yes\0" \
"ethprime=cpsw\0" \
"ethopts=ti_cpsw.rx_packet_max=1526\0" \
"bootcmd_otenv=ext4load mmc 1:1 $load_addr /boot/loader/uEnv.txt; " \
"env import -t $load_addr $filesize\0" \
"bootcmd_ostree=setenv bootargs $bootargs root=/dev/ram0 console=$defaultconsole,115200 panic=1 $ethopts rw ostree_root=/dev/mmcblk1p1;" \
"ext4load mmc 1:1 $kernel_addr_r /boot$kernel_image; " \
"ext4load mmc 1:1 $ramdisk_addr_r /boot$ramdisk_image; " \
"bootm $kernel_addr_r $ramdisk_addr_r\0" \
"bootcmd_ostree_fb=setenv bootargs $bootargs2 root=/dev/ram0 console=$defaultconsole,115200 panic=1 $ethopts rw ostree_root=/dev/mmcblk1p1; " \
"ext4load mmc 1:1 $kernel_addr_r /boot$kernel_image2; " \
"ext4load mmc 1:1 $ramdisk_addr_r /boot$ramdisk_image2; " \
"bootm $kernel_addr_r $ramdisk_addr_r\0" \
"bootcmd=run bootcmd_otenv; " \
"if test $bootcount < 3; then " \
"echo \"Booting ostree...\"; " \
"run bootcmd_ostree; fi; " \
"if test $bootcount > 6 || test ! -n $kernel_image2; then " \
"echo \"Booting recovery...\"; " \
"run recovery; fi; " \
"if test -n $kernel_image2; then " \
"echo \"Booting ostree fallback system...\"; " \
"run bootcmd_ostree_fb; fi\0" \
"bootdelay=0\0" \
"bootcount=1\0" \
"ipaddr=192.168.1.1\0" \
"serverip=192.168.1.254\0" \
"tftptimeout=2000\0" \
"tftptimeoutcountmax=5\0" \
"bootpretryperiod=10000\0" \
"autoload=false\0" \
"tftp_recovery=tftpboot $kernel_addr recovery-image; tftpboot $fdt_addr_r recovery-dtb; " \
"setenv bootargs rdinit=/etc/preinit console=$defaultconsole,115200 " \
"debug ethopts; " \
"bootz $kernel_addr - $fdt_addr_r\0" \
"pxe_recovery=mdio up $ethprime && dhcp && pxe get && pxe boot\0" \
"recovery=run pxe_recovery || setenv ipaddr $ipaddr; setenv serverip $serverip; run tftp_recovery\0" \
/* setenv ipaddr and serverip is necessary, because dhclient can destroy the IPs internally */
#endif
#define CONFIG_ZERO_BOOTDELAY_CHECK
/* UART Configuration */
#define CONFIG_SYS_NS16550_COM1 0x44e09000 /* UART0: XModem Boot */
#define CONFIG_SYS_NS16550_COM2 0x48022000 /* UART1: Unused, see note below */
#define CONFIG_SYS_NS16550_COM3 0x48024000 /* UART2: eMMC Boot, User UART */
/* NOTE: NS16550 definitions are cumulative, need to set COM2 to have COM3 */
#define CONFIG_I2C
#define CONFIG_I2C_MULTI_BUS
#define CONFIG_CMD_EEPROM
#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* Main EEPROM */
#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
#define CONFIG_SYS_I2C_SPEED 100000
#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 4
#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 50 /* TODO: Can this be reduced to 20ms */
/* Put Environment in eMMC */
#define CONFIG_ENV_OFFSET (512 * 128) /* @ 512*256 SPL starts */
#define CONFIG_ENV_SIZE (4 * 1024)
#define CONFIG_ENV_IS_IN_MMC
#define CONFIG_SYS_MMC_ENV_DEV 1
#undef CONFIG_SPL_ENV_SUPPORT
#undef CONFIG_SPL_NAND_SUPPORT
#undef CONFIG_SPL_ONENAND_SUPPORT
/* We need to disable SPI to not confuse the eeprom env driver */
/* SPI IP Block */
#define CONFIG_OMAP3_SPI /* Already define in ti_armv7_omap.h, included by ti_am335x_common.h */
#define CONFIG_SJA1105_SPI_BUS 1 /* bus 1 = spi1 = McSPI2 */
#define CONFIG_SJA1105_SPI_CS 1 /* SJA1105 uses CS1~ */
#undef CONFIG_SPI
#undef CONFIG_SPI_BOOT
#undef CONFIG_SPL_OS_BOOT
#define CONFIG_SPL_YMODEM_SUPPORT
#define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/am33xx/u-boot-spl.lds"
#define CONFIG_SUPPORT_EMMC_BOOT
/*
* USB configuration. We enable MUSB support, both for host and for
* gadget. We set USB0 as peripheral and USB1 as host, based on the
* board schematic and physical port wired to each. Then for host we
* add mass storage support and for gadget we add both RNDIS ethernet
* and DFU.
*/
#define CONFIG_USB_MUSB_DSPS
#define CONFIG_ARCH_MISC_INIT
#define CONFIG_USB_MUSB_PIO_ONLY
#define CONFIG_USB_MUSB_DISABLE_BULK_COMBINE_SPLIT
#define CONFIG_AM335X_USB0
#define CONFIG_AM335X_USB0_MODE MUSB_HOST
/* To support eMMC booting */
#define CONFIG_STORAGE_EMMC
#define CONFIG_FASTBOOT_FLASH_MMC_DEV 1
#ifdef CONFIG_USB_MUSB_HOST
#define CONFIG_USB_STORAGE
#endif
#ifdef CONFIG_USB_MUSB_GADGET
/* Removing USB gadget and can be enabled adter adding support usb DM */
#ifndef CONFIG_DM_ETH
#define CONFIG_USB_ETHER
#define CONFIG_USB_ETH_RNDIS
#define CONFIG_USBNET_HOST_ADDR "de:ad:be:af:00:00"
#endif /* CONFIG_DM_ETH */
#endif /* CONFIG_USB_MUSB_GADGET */
/*
* Disable MMC DM for SPL build and can be re-enabled after adding
* DM support in SPL
*/
#ifdef CONFIG_SPL_BUILD
#undef CONFIG_DM_MMC
#undef CONFIG_TIMER
#endif
#if defined(CONFIG_SPL_BUILD)
/* Remove other SPL modes. */
#undef CONFIG_SPL_NAND_SUPPORT
#define CONFIG_ENV_IS_NOWHERE
#undef CONFIG_PARTITION_UUIDS
#undef CONFIG_EFI_PARTITION
#endif
/* Network. */
#define CONFIG_PHYLIB
#define CONFIG_PHY_SMSC
#define CONFIG_CMD_MEMTEST
#define CONFIG_SYS_MEMTEST_START 0x84000000
#define CONFIG_SYS_MEMTEST_END 0x87900000
#define CONFIG_CMD_PXE
#define CONFIG_OF_BOARD_SETUP
#define CONFIG_JTAG_MARKER_SPL 0x402FFF00
#define CONFIG_JTAG_MARKER_UBOOT 0x807FFF00
/* SPL command is not needed */
#undef CONFIG_CMD_SPL
/* Never enable ISO it is broken and can lead to a crash */
#undef CONFIG_ISO_PARTITION
#endif /* ! __CONFIG_AM335X_NMHW21_H */