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