Marcin Niestroj | 20315d2 | 2017-01-25 09:53:08 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 Grinn - http://grinn-global.com/ |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | |
| 7 | #ifndef __CONFIG_CHILIBOARD_H |
| 8 | #define __CONFIG_CHILIBOARD_H |
| 9 | |
Marcin Niestroj | 20315d2 | 2017-01-25 09:53:08 +0100 | [diff] [blame] | 10 | #include <configs/ti_am335x_common.h> |
| 11 | |
| 12 | #define CONFIG_CONS_INDEX 1 |
| 13 | |
| 14 | #ifndef CONFIG_SPL_BUILD |
| 15 | # define CONFIG_TIMESTAMP |
Marcin Niestroj | 20315d2 | 2017-01-25 09:53:08 +0100 | [diff] [blame] | 16 | #endif |
| 17 | |
| 18 | /* Clock Defines */ |
| 19 | #define V_OSCK 24000000 /* Clock output from T2 */ |
| 20 | #define V_SCLK (V_OSCK) |
| 21 | |
| 22 | #define NANDARGS \ |
Tom Rini | 5ad8e11 | 2017-10-22 17:55:07 -0400 | [diff] [blame] | 23 | "mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \ |
| 24 | "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \ |
Marcin Niestroj | 20315d2 | 2017-01-25 09:53:08 +0100 | [diff] [blame] | 25 | "nandargs=setenv bootargs console=${console} ${optargs} " \ |
| 26 | "${mtdparts} " \ |
| 27 | "root=${nandroot} " \ |
| 28 | "rootfstype=${nandrootfstype}\0" \ |
| 29 | "nandroot=ubi0:rootfs rw ubi.mtd=NAND.file-system\0" \ |
| 30 | "nandrootfstype=ubifs rootwait=1\0" \ |
| 31 | "nandboot=echo Booting from nand ...; " \ |
| 32 | "run nandargs; " \ |
| 33 | "nand read ${fdt_addr} NAND.u-boot-spl-os; " \ |
| 34 | "nand read ${loadaddr} NAND.kernel; " \ |
| 35 | "bootz ${loadaddr} - ${fdt_addr}\0" |
| 36 | |
| 37 | #define CONFIG_BOOTCOMMAND \ |
| 38 | "run mmcboot; " \ |
| 39 | "run nandboot; " \ |
| 40 | "run netboot" |
| 41 | |
| 42 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
| 43 | "loadaddr=0x82000000\0" \ |
| 44 | "fdt_addr=0x87800000\0" \ |
| 45 | "boot_fdt=try\0" \ |
| 46 | "console=ttyO0,115200n8\0" \ |
| 47 | "image=zImage\0" \ |
Michal Oleszczyk | 49bc147 | 2017-10-17 14:06:33 +0200 | [diff] [blame] | 48 | "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \ |
Marcin Niestroj | 20315d2 | 2017-01-25 09:53:08 +0100 | [diff] [blame] | 49 | "ip_dyn=yes\0" \ |
| 50 | "optargs=\0" \ |
| 51 | "loadbootscript=" \ |
| 52 | "load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ |
| 53 | "bootscript=echo Running bootscript from mmc ...; " \ |
| 54 | "source\0" \ |
| 55 | "loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} " \ |
| 56 | "${boot_dir}/${image}\0" \ |
| 57 | "loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} " \ |
| 58 | "${boot_dir}/${fdt_file}\0" \ |
| 59 | "mmcdev=0\0" \ |
| 60 | "mmcpart=1\0" \ |
| 61 | "mmcroot=/dev/mmcblk0p2 rootwait rw\0" \ |
| 62 | "mmcargs=setenv bootargs console=${console},${baudrate} ${optargs} " \ |
| 63 | "${mtdparts} " \ |
| 64 | "root=${mmcroot}\0" \ |
| 65 | "mmcloados=run mmcargs; " \ |
| 66 | "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ |
| 67 | "if run loadfdt; then " \ |
| 68 | "bootz ${loadaddr} - ${fdt_addr}; " \ |
| 69 | "else " \ |
| 70 | "if test ${boot_fdt} = try; then " \ |
| 71 | "bootz; " \ |
| 72 | "else " \ |
| 73 | "echo WARN: Cannot load the DT; " \ |
| 74 | "fi; " \ |
| 75 | "fi; " \ |
| 76 | "else " \ |
| 77 | "bootz; " \ |
| 78 | "fi;\0" \ |
| 79 | "mmcboot=mmc dev ${mmcdev}; " \ |
| 80 | "if mmc rescan; then " \ |
| 81 | "echo SD/MMC found on device ${mmcdev};" \ |
| 82 | "if run loadimage; then " \ |
| 83 | "run mmcloados;" \ |
| 84 | "fi;" \ |
| 85 | "fi;\0" \ |
| 86 | "netargs=setenv bootargs console=${console},${baudrate} ${optargs} " \ |
| 87 | "${mtdparts} " \ |
| 88 | "root=/dev/nfs " \ |
| 89 | "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ |
| 90 | "netboot=echo Booting from net ...; " \ |
| 91 | "run netargs; " \ |
| 92 | "if test ${ip_dyn} = yes; then " \ |
| 93 | "setenv get_cmd dhcp; " \ |
| 94 | "else " \ |
| 95 | "setenv get_cmd tftp; " \ |
| 96 | "fi; " \ |
| 97 | "${get_cmd} ${image}; " \ |
| 98 | "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ |
| 99 | "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ |
| 100 | "bootz ${loadaddr} - ${fdt_addr}; " \ |
| 101 | "else " \ |
| 102 | "if test ${boot_fdt} = try; then " \ |
| 103 | "bootz; " \ |
| 104 | "else " \ |
| 105 | "echo WARN: Cannot load the DT; " \ |
| 106 | "fi; " \ |
| 107 | "fi; " \ |
| 108 | "else " \ |
| 109 | "bootz; " \ |
| 110 | "fi;\0" \ |
| 111 | NANDARGS |
| 112 | |
| 113 | /* NS16550 Configuration */ |
| 114 | #define CONFIG_SYS_NS16550_COM1 0x44e09000 /* UART0 */ |
| 115 | #define CONFIG_SYS_NS16550_COM2 0x48022000 /* UART1 */ |
| 116 | #define CONFIG_SYS_NS16550_COM3 0x48024000 /* UART2 */ |
| 117 | #define CONFIG_SYS_NS16550_COM4 0x481a6000 /* UART3 */ |
| 118 | #define CONFIG_SYS_NS16550_COM5 0x481a8000 /* UART4 */ |
| 119 | #define CONFIG_SYS_NS16550_COM6 0x481aa000 /* UART5 */ |
Marcin Niestroj | 20315d2 | 2017-01-25 09:53:08 +0100 | [diff] [blame] | 120 | |
| 121 | /* PMIC support */ |
| 122 | #define CONFIG_POWER_TPS65217 |
| 123 | |
| 124 | /* SPL */ |
| 125 | /* Bootcount using the RTC block */ |
Marcin Niestroj | 20315d2 | 2017-01-25 09:53:08 +0100 | [diff] [blame] | 126 | #define CONFIG_BOOTCOUNT_AM33XX |
| 127 | #define CONFIG_SYS_BOOTCOUNT_BE |
| 128 | |
Marcin Niestroj | 20315d2 | 2017-01-25 09:53:08 +0100 | [diff] [blame] | 129 | /* NAND: device related configs */ |
| 130 | #define CONFIG_SYS_NAND_5_ADDR_CYCLE |
| 131 | #define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \ |
| 132 | CONFIG_SYS_NAND_PAGE_SIZE) |
| 133 | #define CONFIG_SYS_NAND_PAGE_SIZE 2048 |
| 134 | #define CONFIG_SYS_NAND_OOBSIZE 64 |
| 135 | #define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024) |
| 136 | /* NAND: driver related configs */ |
Marcin Niestroj | 20315d2 | 2017-01-25 09:53:08 +0100 | [diff] [blame] | 137 | #define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS |
| 138 | #define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, \ |
| 139 | 10, 11, 12, 13, 14, 15, 16, 17, \ |
| 140 | 18, 19, 20, 21, 22, 23, 24, 25, \ |
| 141 | 26, 27, 28, 29, 30, 31, 32, 33, \ |
| 142 | 34, 35, 36, 37, 38, 39, 40, 41, \ |
| 143 | 42, 43, 44, 45, 46, 47, 48, 49, \ |
| 144 | 50, 51, 52, 53, 54, 55, 56, 57, } |
| 145 | |
| 146 | #define CONFIG_SYS_NAND_ECCSIZE 512 |
| 147 | #define CONFIG_SYS_NAND_ECCBYTES 14 |
| 148 | #define CONFIG_SYS_NAND_ONFI_DETECTION |
| 149 | #define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW |
Marcin Niestroj | 20315d2 | 2017-01-25 09:53:08 +0100 | [diff] [blame] | 150 | #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x000c0000 |
| 151 | /* NAND: SPL related configs */ |
Marcin Niestroj | 20315d2 | 2017-01-25 09:53:08 +0100 | [diff] [blame] | 152 | |
| 153 | /* USB configuration */ |
Marcin Niestroj | 20315d2 | 2017-01-25 09:53:08 +0100 | [diff] [blame] | 154 | #define CONFIG_ARCH_MISC_INIT |
Marcin Niestroj | 20315d2 | 2017-01-25 09:53:08 +0100 | [diff] [blame] | 155 | #define CONFIG_USB_MUSB_DISABLE_BULK_COMBINE_SPLIT |
| 156 | #define CONFIG_AM335X_USB1 |
| 157 | #define CONFIG_AM335X_USB1_MODE MUSB_HOST |
| 158 | |
| 159 | /* |
| 160 | * Disable MMC DM for SPL build and can be re-enabled after adding |
| 161 | * DM support in SPL |
| 162 | */ |
| 163 | #ifdef CONFIG_SPL_BUILD |
| 164 | #undef CONFIG_DM_MMC |
Marcin Niestroj | 20315d2 | 2017-01-25 09:53:08 +0100 | [diff] [blame] | 165 | #undef CONFIG_TIMER |
Marcin Niestroj | 20315d2 | 2017-01-25 09:53:08 +0100 | [diff] [blame] | 166 | #endif |
| 167 | |
| 168 | #if defined(CONFIG_ENV_IS_IN_NAND) |
| 169 | #define CONFIG_ENV_OFFSET 0x001c0000 |
| 170 | #define CONFIG_ENV_OFFSET_REDUND 0x001e0000 |
| 171 | #define CONFIG_ENV_SIZE SZ_128K |
| 172 | #define CONFIG_SYS_ENV_SECT_SIZE CONFIG_SYS_NAND_BLOCK_SIZE |
| 173 | #else |
Marcin Niestroj | 20315d2 | 2017-01-25 09:53:08 +0100 | [diff] [blame] | 174 | #define CONFIG_SYS_MMC_ENV_DEV 0 |
| 175 | #define CONFIG_ENV_OFFSET SZ_128K |
| 176 | #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE) |
| 177 | #define CONFIG_ENV_SIZE SZ_8K |
| 178 | #define CONFIG_SYS_REDUNDAND_ENVIRONMENT |
| 179 | #endif |
| 180 | |
| 181 | /* Network. */ |
Marcin Niestroj | 20315d2 | 2017-01-25 09:53:08 +0100 | [diff] [blame] | 182 | #define CONFIG_PHY_SMSC |
| 183 | |
| 184 | #endif /* ! __CONFIG_CHILIBOARD_H */ |