Hannes Petermaier | fb00366 | 2014-02-07 08:07:36 +0100 | [diff] [blame] | 1 | /* |
| 2 | * tseries.h |
| 3 | * |
| 4 | * specific parts for B&R T-Series Motherboard |
| 5 | * |
| 6 | * Copyright (C) 2013 Hannes Petermaier <oe5hpm@oevsv.at> - |
| 7 | * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com |
| 8 | * |
| 9 | * SPDX-License-Identifier: GPL-2.0+ |
| 10 | */ |
| 11 | |
| 12 | #ifndef __CONFIG_TSERIES_H__ |
| 13 | #define __CONFIG_TSERIES_H__ |
| 14 | |
| 15 | #include <configs/bur_am335x_common.h> |
| 16 | /* ------------------------------------------------------------------------- */ |
| 17 | /* Clock Defines */ |
| 18 | #define V_OSCK 26000000 /* Clock output from T2 */ |
| 19 | #define V_SCLK (V_OSCK) |
| 20 | |
| 21 | #define CONFIG_POWER_TPS65217 |
| 22 | |
| 23 | /* Support both device trees and ATAGs. */ |
| 24 | #define CONFIG_OF_LIBFDT |
| 25 | #define CONFIG_CMDLINE_TAG |
| 26 | #define CONFIG_SETUP_MEMORY_TAGS |
| 27 | #define CONFIG_INITRD_TAG |
| 28 | #define CONFIG_CMD_BOOTZ |
| 29 | /*#define CONFIG_MACH_TYPE 3589*/ |
| 30 | #define CONFIG_MACH_TYPE 0xFFFFFFFF /* TODO: check with kernel*/ |
| 31 | |
| 32 | /* MMC/SD IP block */ |
| 33 | #if defined(CONFIG_EMMC_BOOT) |
| 34 | #define CONFIG_MMC |
| 35 | #define CONFIG_GENERIC_MMC |
| 36 | #define CONFIG_OMAP_HSMMC |
| 37 | #define CONFIG_CMD_MMC |
| 38 | #define CONFIG_SUPPORT_EMMC_BOOT |
| 39 | /* RAW SD card / eMMC locations. */ |
| 40 | #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x300 /*addr. 0x60000 */ |
| 41 | #define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS 0x200 /* 256 KB */ |
| 42 | #define CONFIG_SPL_MMC_SUPPORT |
| 43 | #endif /* CONFIG_EMMC_BOOT */ |
| 44 | |
| 45 | /* |
| 46 | * When we have SPI or NAND flash we expect to be making use of mtdparts, |
| 47 | * both for ease of use in U-Boot and for passing information on to |
| 48 | * the Linux kernel. |
| 49 | */ |
| 50 | #if defined(CONFIG_SPI_BOOT) || defined(CONFIG_NAND) |
| 51 | #define CONFIG_MTD_DEVICE /* Required for mtdparts */ |
| 52 | #define CONFIG_CMD_MTDPARTS |
| 53 | #endif /* CONFIG_SPI_BOOT, ... */ |
| 54 | |
| 55 | #undef CONFIG_SPL_OS_BOOT |
| 56 | #ifdef CONFIG_SPL_OS_BOOT |
| 57 | #define CONFIG_SYS_SPL_ARGS_ADDR 0x80F80000 |
| 58 | |
| 59 | /* RAW SD card / eMMC */ |
| 60 | #define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x900 /* address 0x120000 */ |
| 61 | #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x80 /* address 0x10000 */ |
| 62 | #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS 0x80 /* 64KiB */ |
| 63 | |
| 64 | /* NAND */ |
| 65 | #ifdef CONFIG_NAND |
| 66 | #define CONFIG_CMD_SPL_NAND_OFS 0x080000 /* end of u-boot */ |
| 67 | #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x140000 |
| 68 | #define CONFIG_CMD_SPL_WRITE_SIZE 0x2000 |
| 69 | #endif /* CONFIG_NAND */ |
| 70 | #endif /* CONFIG_SPL_OS_BOOT */ |
| 71 | |
| 72 | #ifdef CONFIG_NAND |
| 73 | #define CONFIG_SPL_NAND_AM33XX_BCH /* OMAP4 and later ELM support */ |
| 74 | #define CONFIG_SPL_NAND_SUPPORT |
| 75 | #define CONFIG_SPL_NAND_BASE |
| 76 | #define CONFIG_SPL_NAND_DRIVERS |
| 77 | #define CONFIG_SPL_NAND_ECC |
| 78 | #define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE |
| 79 | #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000 |
| 80 | #endif /* CONFIG_NAND */ |
| 81 | |
| 82 | /* Always 128 KiB env size */ |
| 83 | #define CONFIG_ENV_SIZE (128 << 10) |
| 84 | |
| 85 | #ifdef CONFIG_NAND |
| 86 | #define NANDARGS \ |
| 87 | "mtdids=" MTDIDS_DEFAULT "\0" \ |
| 88 | "mtdparts=" MTDPARTS_DEFAULT "\0" \ |
| 89 | "nandargs=setenv bootargs console=${console} " \ |
| 90 | "${optargs} " \ |
| 91 | "root=${nandroot} " \ |
| 92 | "rootfstype=${nandrootfstype}\0" \ |
| 93 | "nandroot=ubi0:rootfs rw ubi.mtd=8,2048\0" \ |
| 94 | "nandrootfstype=ubifs rootwait=1\0" \ |
| 95 | "nandimgsize=0x500000\0" \ |
| 96 | "nandboot=echo Booting from nand ...; " \ |
| 97 | "run nandargs; " \ |
| 98 | "nand read ${loadaddr} kernel ${nandimgsize}; " \ |
| 99 | "bootz ${loadaddr}\0" |
| 100 | #else |
| 101 | #define NANDARGS "" |
| 102 | #endif /* CONFIG_NAND */ |
| 103 | |
| 104 | #ifdef CONFIG_MMC |
| 105 | #define MMCARGS \ |
| 106 | "silent=1\0" |
| 107 | #else |
| 108 | #define MMCARGS "" |
| 109 | #endif /* CONFIG_MMC */ |
| 110 | |
| 111 | #ifndef CONFIG_SPL_BUILD |
| 112 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
| 113 | "autoload=0\0" \ |
| 114 | "loadaddr=0x80200000\0" \ |
| 115 | "bootfile=zImage\0" \ |
| 116 | "console=ttyO0,115200n8\0" \ |
| 117 | "optargs=\0" \ |
| 118 | "rootpath=/tftpboot/tseries/rootfs-small\0" \ |
| 119 | "nfsopts=nolock\0" \ |
| 120 | "netargs=setenv bootargs console=${console} " \ |
| 121 | "${optargs} " \ |
| 122 | "root=/dev/nfs " \ |
| 123 | "nfsroot=${serverip}:${rootpath},${nfsopts} rw " \ |
| 124 | "ip=dhcp\0" \ |
| 125 | "netboot=echo Booting from network ...; " \ |
| 126 | "setenv autoload no; " \ |
| 127 | "dhcp; " \ |
| 128 | "tftp ${loadaddr} ${bootfile}; " \ |
| 129 | "run netargs; " \ |
| 130 | "bootm ${loadaddr}\0" \ |
| 131 | "usbupdate=echo Updating UBOOT from USB-Stick ...; " \ |
| 132 | "usb start; " \ |
| 133 | "fatload usb 0 0x80000000 updateubootusb.img; " \ |
| 134 | "source;\0" \ |
| 135 | "netupdate=echo Updating UBOOT from Network (TFTP) ...; " \ |
| 136 | "setenv autoload 0; " \ |
| 137 | "dhcp;" \ |
| 138 | "tftp 0x80000000 updateUBOOT.img;" \ |
| 139 | "source;\0" \ |
| 140 | NANDARGS \ |
| 141 | MMCARGS |
| 142 | #endif /* !CONFIG_SPL_BUILD*/ |
| 143 | |
| 144 | #define CONFIG_BOOTCOMMAND \ |
| 145 | "run mmcboot1;" |
| 146 | #define CONFIG_BOOTDELAY 1 /* TODO: für release auf 0 setzen */ |
| 147 | |
| 148 | #ifdef CONFIG_NAND |
| 149 | /* |
| 150 | * GPMC block. We support 1 device and the physical address to |
| 151 | * access CS0 at is 0x8000000. |
| 152 | */ |
| 153 | #define CONFIG_SYS_MAX_NAND_DEVICE 1 |
| 154 | #define CONFIG_SYS_NAND_BASE 0x8000000 |
| 155 | #define CONFIG_NAND_OMAP_GPMC |
| 156 | #define CONFIG_CMD_NAND |
| 157 | /* don't change OMAP_ELM, ECCSCHEME. ROM code only supports this */ |
| 158 | #define CONFIG_NAND_OMAP_ELM |
| 159 | #define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW |
| 160 | #define GPMC_NAND_ECC_LP_x16_LAYOUT 1 |
| 161 | #define CONFIG_SYS_NAND_5_ADDR_CYCLE |
| 162 | #define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024) |
| 163 | #define CONFIG_SYS_NAND_PAGE_SIZE 2048 |
| 164 | #define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \ |
| 165 | CONFIG_SYS_NAND_PAGE_SIZE) |
| 166 | #define CONFIG_SYS_NAND_OOBSIZE 64 |
| 167 | #define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS |
| 168 | #define CONFIG_SYS_NAND_ECCPOS {2, 3, 4, 5, 6, 7, 8, 9, \ |
| 169 | 10, 11, 12, 13, 14, 15, 16, 17, \ |
| 170 | 18, 19, 20, 21, 22, 23, 24, 25, \ |
| 171 | 26, 27, 28, 29, 30, 31, 32, 33, \ |
| 172 | 34, 35, 36, 37, 38, 39, 40, 41, \ |
| 173 | 42, 43, 44, 45, 46, 47, 48, 49, \ |
| 174 | 50, 51, 52, 53, 54, 55, 56, 57, } |
| 175 | |
| 176 | #define CONFIG_SYS_NAND_ECCSIZE 512 |
| 177 | #define CONFIG_SYS_NAND_ECCBYTES 14 |
| 178 | |
| 179 | #define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE |
| 180 | #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000 |
| 181 | |
| 182 | #define MTDIDS_DEFAULT "nand0=omap2-nand.0" |
| 183 | #define MTDPARTS_DEFAULT "mtdparts=omap2-nand.0:" \ |
| 184 | "128k(SPL)," \ |
| 185 | "128k(SPL.backup1)," \ |
| 186 | "128k(SPL.backup2)," \ |
| 187 | "128k(SPL.backup3)," \ |
| 188 | "512k(u-boot)," \ |
| 189 | "128k(u-boot-spl-os)," \ |
| 190 | "128k(u-boot-env)," \ |
| 191 | "5m(kernel),"\ |
| 192 | "-(rootfs)" |
| 193 | #endif /* CONFIG_NAND */ |
| 194 | |
| 195 | /* USB configuration */ |
| 196 | #define CONFIG_USB_MUSB_DSPS |
| 197 | #define CONFIG_ARCH_MISC_INIT |
| 198 | #define CONFIG_MUSB_PIO_ONLY |
| 199 | #define CONFIG_MUSB_DISABLE_BULK_COMBINE_SPLIT |
| 200 | /* attention! not only for gadget, enables also highspeed in hostmode */ |
| 201 | #define CONFIG_USB_GADGET_DUALSPEED |
| 202 | #define CONFIG_MUSB_HOST |
| 203 | #define CONFIG_AM335X_USB0 |
| 204 | #define CONFIG_AM335X_USB0_MODE MUSB_HOST |
| 205 | #define CONFIG_AM335X_USB1 |
| 206 | #define CONFIG_AM335X_USB1_MODE MUSB_HOST |
| 207 | |
| 208 | #ifdef CONFIG_MUSB_HOST |
| 209 | #define CONFIG_CMD_USB |
| 210 | #define CONFIG_USB_STORAGE |
| 211 | #endif /* CONFIG_MUSB_HOST */ |
| 212 | |
| 213 | #if defined(CONFIG_SPI_BOOT) |
| 214 | /* McSPI IP block */ |
| 215 | #define CONFIG_SPI |
| 216 | #define CONFIG_OMAP3_SPI |
| 217 | #define CONFIG_CMD_SPI |
| 218 | #define CONFIG_CMD_SF |
| 219 | #define CONFIG_SPI_FLASH |
| 220 | #define CONFIG_SPI_FLASH_STMICRO |
| 221 | #define CONFIG_SF_DEFAULT_SPEED 24000000 |
| 222 | |
| 223 | #define CONFIG_SPL_SPI_SUPPORT |
| 224 | #define CONFIG_SPL_SPI_FLASH_SUPPORT |
| 225 | #define CONFIG_SPL_SPI_LOAD |
| 226 | #define CONFIG_SPL_SPI_BUS 0 |
| 227 | #define CONFIG_SPL_SPI_CS 0 |
| 228 | #define CONFIG_SYS_SPI_U_BOOT_OFFS 0x20000 |
| 229 | #undef CONFIG_ENV_IS_NOWHERE |
| 230 | #define CONFIG_ENV_IS_IN_SPI_FLASH |
| 231 | #define CONFIG_SYS_REDUNDAND_ENVIRONMENT |
| 232 | #define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED |
| 233 | #define CONFIG_ENV_SECT_SIZE (4 << 10) /* 4 KB sectors */ |
| 234 | #define CONFIG_ENV_OFFSET (768 << 10) /* 768 KiB in */ |
| 235 | #define CONFIG_ENV_OFFSET_REDUND (896 << 10) /* 896 KiB in */ |
| 236 | |
| 237 | #elif defined(CONFIG_EMMC_BOOT) |
| 238 | #undef CONFIG_ENV_IS_NOWHERE |
| 239 | #define CONFIG_ENV_IS_IN_MMC |
Hannes Petermaier | 8e731ed | 2014-04-08 08:39:20 +0200 | [diff] [blame] | 240 | #define CONFIG_SYS_MMC_ENV_DEV 0 |
Hannes Petermaier | fb00366 | 2014-02-07 08:07:36 +0100 | [diff] [blame] | 241 | #define CONFIG_SYS_MMC_ENV_PART 2 |
| 242 | #define CONFIG_ENV_OFFSET 0x40000 /* TODO: Adresse definieren */ |
| 243 | #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE) |
| 244 | #define CONFIG_SYS_REDUNDAND_ENVIRONMENT |
| 245 | |
| 246 | #elif defined(CONFIG_NAND) |
| 247 | #undef CONFIG_ENV_IS_NOWHERE |
| 248 | #define CONFIG_ENV_IS_IN_NAND |
| 249 | #define CONFIG_ENV_OFFSET 0x120000 /* TODO: Adresse definieren */ |
| 250 | #define CONFIG_SYS_ENV_SECT_SIZE CONFIG_ENV_SIZE |
| 251 | #else |
| 252 | #error "no storage for Environment defined!" |
| 253 | #endif |
| 254 | /* |
| 255 | * Common filesystems support. When we have removable storage we |
| 256 | * enabled a number of useful commands and support. |
| 257 | */ |
| 258 | #if defined(CONFIG_MMC) || defined(CONFIG_USB_STORAGE) |
| 259 | #define CONFIG_DOS_PARTITION |
| 260 | #define CONFIG_CMD_FAT |
| 261 | #define CONFIG_FAT_WRITE |
| 262 | #define CONFIG_CMD_FS_GENERIC |
| 263 | #endif /* CONFIG_MMC, ... */ |
| 264 | |
| 265 | #endif /* ! __CONFIG_TSERIES_H__ */ |