Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Heiko Schocher | 6b3943f | 2016-06-07 08:55:45 +0200 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2013 Siemens Schweiz AG |
| 4 | * (C) Heiko Schocher, DENX Software Engineering, hs@denx.de. |
| 5 | * |
| 6 | * Based on: |
| 7 | * U-Boot file:/include/configs/am335x_evm.h |
| 8 | * |
| 9 | * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ |
Heiko Schocher | 6b3943f | 2016-06-07 08:55:45 +0200 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #ifndef __CONFIG_ETAMIN_H |
| 13 | #define __CONFIG_ETAMIN_H |
| 14 | |
| 15 | #include "siemens-am33x-common.h" |
| 16 | /* NAND specific changes for etamin due to different page size */ |
| 17 | #undef CONFIG_SYS_NAND_PAGE_SIZE |
| 18 | #undef CONFIG_SYS_NAND_OOBSIZE |
| 19 | #undef CONFIG_SYS_NAND_BLOCK_SIZE |
| 20 | #undef CONFIG_SYS_NAND_ECCPOS |
| 21 | #undef CONFIG_SYS_NAND_U_BOOT_OFFS |
| 22 | #undef CONFIG_SYS_ENV_SECT_SIZE |
Heiko Schocher | 6b3943f | 2016-06-07 08:55:45 +0200 | [diff] [blame] | 23 | #undef CONFIG_NAND_OMAP_ECCSCHEME |
| 24 | #define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH16_CODE_HW |
| 25 | |
Heiko Schocher | 6b3943f | 2016-06-07 08:55:45 +0200 | [diff] [blame] | 26 | #define CONFIG_SYS_ENV_SECT_SIZE (512 << 10) /* 512 KiB */ |
| 27 | #define CONFIG_SYS_NAND_PAGE_SIZE 4096 |
| 28 | #define CONFIG_SYS_NAND_OOBSIZE 224 |
| 29 | #define CONFIG_SYS_NAND_BLOCK_SIZE (128 * CONFIG_SYS_NAND_PAGE_SIZE) |
| 30 | #define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, \ |
| 31 | 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, \ |
| 32 | 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, \ |
| 33 | 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, \ |
| 34 | 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, \ |
| 35 | 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, \ |
| 36 | 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, \ |
| 37 | 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, \ |
| 38 | 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, \ |
| 39 | 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, \ |
| 40 | 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, \ |
| 41 | 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, \ |
| 42 | 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, \ |
| 43 | 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, \ |
| 44 | 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, \ |
| 45 | 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, \ |
| 46 | 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, \ |
| 47 | 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, \ |
| 48 | 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, \ |
| 49 | 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, \ |
| 50 | 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, \ |
| 51 | } |
| 52 | |
| 53 | #undef CONFIG_SYS_NAND_ECCSIZE |
| 54 | #undef CONFIG_SYS_NAND_ECCBYTES |
| 55 | #define CONFIG_SYS_NAND_ECCSIZE 512 |
| 56 | #define CONFIG_SYS_NAND_ECCBYTES 26 |
| 57 | |
| 58 | #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x200000 |
| 59 | |
| 60 | #define CONFIG_SYS_NAND_MAX_CHIPS 1 |
| 61 | |
| 62 | #undef CONFIG_SYS_MAX_NAND_DEVICE |
| 63 | #define CONFIG_SYS_MAX_NAND_DEVICE 3 |
| 64 | #define CONFIG_SYS_NAND_BASE2 (0x18000000) /* physical address */ |
| 65 | #define CONFIG_SYS_NAND_BASE_LIST {CONFIG_SYS_NAND_BASE, \ |
| 66 | CONFIG_SYS_NAND_BASE2} |
| 67 | |
| 68 | #define CONFIG_SYS_NAND_ONFI_DETECTION |
Heiko Schocher | 6b3943f | 2016-06-07 08:55:45 +0200 | [diff] [blame] | 69 | #define DDR_PLL_FREQ 303 |
Heiko Schocher | 6b3943f | 2016-06-07 08:55:45 +0200 | [diff] [blame] | 70 | |
| 71 | /* FWD Button = 27 |
| 72 | * SRV Button = 87 */ |
| 73 | #define BOARD_DFU_BUTTON_GPIO 27 |
| 74 | #define GPIO_LAN9303_NRST 88 /* GPIO2_24 = gpio88 */ |
| 75 | /* In dfu mode keep led1 on */ |
| 76 | #define CONFIG_ENV_SETTINGS_BUTTONS_AND_LEDS \ |
| 77 | "button_dfu0=27\0" \ |
| 78 | "button_dfu1=87\0" \ |
| 79 | "led0=3,0,1\0" \ |
| 80 | "led1=4,0,0\0" \ |
| 81 | "led2=5,0,1\0" \ |
| 82 | "led3=87,0,1\0" \ |
| 83 | "led4=60,0,1\0" \ |
| 84 | "led5=63,0,1\0" |
| 85 | |
Heiko Schocher | 6b3943f | 2016-06-07 08:55:45 +0200 | [diff] [blame] | 86 | /* Physical Memory Map */ |
| 87 | #define CONFIG_MAX_RAM_BANK_SIZE (1024 << 20) /* 1GB */ |
| 88 | |
| 89 | /* I2C Configuration */ |
| 90 | #define CONFIG_SYS_I2C_SPEED 100000 |
| 91 | |
| 92 | #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 |
| 93 | #define EEPROM_ADDR_DDR3 0x90 |
| 94 | #define EEPROM_ADDR_CHIP 0x120 |
| 95 | |
Heiko Schocher | 6b3943f | 2016-06-07 08:55:45 +0200 | [diff] [blame] | 96 | #define CONFIG_PHY_SMSC |
| 97 | |
| 98 | #define CONFIG_FACTORYSET |
| 99 | |
| 100 | /* use both define to compile a SPL compliance test */ |
| 101 | /* |
| 102 | #define CONFIG_SPL_CMT |
| 103 | #define CONFIG_SPL_CMT_DEBUG |
| 104 | */ |
| 105 | |
| 106 | /* nedded by compliance test in read mode */ |
| 107 | #if defined(CONFIG_SPL_CMT) |
| 108 | #define CONFIG_SYS_DCACHE_OFF |
| 109 | #endif |
| 110 | |
Heiko Schocher | 6b3943f | 2016-06-07 08:55:45 +0200 | [diff] [blame] | 111 | /* Define own nand partitions */ |
Heiko Schocher | 6b3943f | 2016-06-07 08:55:45 +0200 | [diff] [blame] | 112 | #define CONFIG_ENV_RANGE (4 * CONFIG_SYS_ENV_SECT_SIZE) |
| 113 | |
| 114 | |
| 115 | |
Heiko Schocher | 6b3943f | 2016-06-07 08:55:45 +0200 | [diff] [blame] | 116 | #undef COMMON_ENV_DFU_ARGS |
| 117 | #define COMMON_ENV_DFU_ARGS "dfu_args=run bootargs_defaults;" \ |
| 118 | "setenv bootargs ${bootargs};" \ |
| 119 | "mtdparts default;" \ |
| 120 | "draco_led 1;" \ |
| 121 | "dfu 0 mtd 0;" \ |
| 122 | "draco_led 0;\0" \ |
| 123 | |
| 124 | #undef DFU_ALT_INFO_NAND_V2 |
| 125 | #define DFU_ALT_INFO_NAND_V2 \ |
| 126 | "spl mtddev;" \ |
| 127 | "spl.backup1 mtddev;" \ |
| 128 | "spl.backup2 mtddev;" \ |
| 129 | "spl.backup3 mtddev;" \ |
| 130 | "u-boot mtddev;" \ |
| 131 | "u-boot.env0 mtddev;" \ |
| 132 | "u-boot.env1 mtddev;" \ |
| 133 | "rootfs mtddevubi" \ |
| 134 | |
Heiko Schocher | 6b3943f | 2016-06-07 08:55:45 +0200 | [diff] [blame] | 135 | #undef CONFIG_ENV_SETTINGS_NAND_V2 |
| 136 | #define CONFIG_ENV_SETTINGS_NAND_V2 \ |
| 137 | "nand_active_ubi_vol=rootfs_a\0" \ |
| 138 | "rootfs_name=rootfs\0" \ |
| 139 | "kernel_name=uImage\0"\ |
| 140 | "nand_root_fs_type=ubifs rootwait=1\0" \ |
| 141 | "nand_args=run bootargs_defaults;" \ |
| 142 | "mtdparts default;" \ |
| 143 | "setenv ${partitionset_active} true;" \ |
| 144 | "if test -n ${A}; then " \ |
| 145 | "setenv nand_active_ubi_vol ${rootfs_name}_a;" \ |
| 146 | "fi;" \ |
| 147 | "if test -n ${B}; then " \ |
| 148 | "setenv nand_active_ubi_vol ${rootfs_name}_b;" \ |
| 149 | "fi;" \ |
| 150 | "setenv nand_root ubi0:${nand_active_ubi_vol} rw " \ |
| 151 | "ubi.mtd=rootfs,${ubi_off};" \ |
| 152 | "setenv bootargs ${bootargs} " \ |
| 153 | "root=${nand_root} noinitrd ${mtdparts} " \ |
| 154 | "rootfstype=${nand_root_fs_type} ip=${ip_method} " \ |
| 155 | "console=ttyMTD,mtdoops console=ttyO0,115200n8 mtdoops.mtddev" \ |
| 156 | "=mtdoops\0" \ |
| 157 | COMMON_ENV_DFU_ARGS \ |
| 158 | "dfu_alt_info=" DFU_ALT_INFO_NAND_V2 "\0" \ |
| 159 | COMMON_ENV_NAND_BOOT \ |
| 160 | "ubi part rootfs ${ubi_off};" \ |
| 161 | "ubifsmount ubi0:${nand_active_ubi_vol};" \ |
| 162 | "ubifsload ${kloadaddr} boot/${kernel_name};" \ |
| 163 | "ubifsload ${loadaddr} boot/${dtb_name}.dtb;" \ |
| 164 | "bootm ${kloadaddr} - ${loadaddr}\0" \ |
| 165 | "nand_boot_backup=ubifsload ${loadaddr} boot/am335x-draco.dtb;" \ |
| 166 | "bootm ${kloadaddr} - ${loadaddr}\0" \ |
| 167 | COMMON_ENV_NAND_CMDS |
| 168 | |
| 169 | #ifndef CONFIG_SPL_BUILD |
| 170 | |
| 171 | #define CONFIG_NAND_CS_INIT |
| 172 | #define ETAMIN_NAND_GPMC_CONFIG1 0x00000800 |
| 173 | #define ETAMIN_NAND_GPMC_CONFIG2 0x001e1e00 |
| 174 | #define ETAMIN_NAND_GPMC_CONFIG3 0x001e1e00 |
| 175 | #define ETAMIN_NAND_GPMC_CONFIG4 0x16051807 |
| 176 | #define ETAMIN_NAND_GPMC_CONFIG5 0x00151e1e |
| 177 | #define ETAMIN_NAND_GPMC_CONFIG6 0x16000f80 |
| 178 | #define CONFIG_MTD_CONCAT |
| 179 | |
| 180 | /* Default env settings */ |
| 181 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
| 182 | "hostname=etamin\0" \ |
| 183 | "ubi_off=4096\0"\ |
| 184 | "nand_img_size=0x400000\0" \ |
| 185 | "optargs=\0" \ |
| 186 | "preboot=draco_led 0\0" \ |
| 187 | CONFIG_ENV_SETTINGS_BUTTONS_AND_LEDS \ |
| 188 | CONFIG_ENV_SETTINGS_V2 \ |
| 189 | CONFIG_ENV_SETTINGS_NAND_V2 |
| 190 | |
| 191 | #ifndef CONFIG_RESTORE_FLASH |
| 192 | |
| 193 | #define CONFIG_BOOTCOMMAND \ |
| 194 | "if dfubutton; then " \ |
| 195 | "run dfu_start; " \ |
| 196 | "reset; " \ |
| 197 | "fi;" \ |
| 198 | "run nand_boot;" \ |
| 199 | "run nand_boot_backup;" \ |
| 200 | "reset;" |
| 201 | |
| 202 | |
| 203 | #else |
| 204 | #define CONFIG_BOOTCOMMAND \ |
| 205 | "setenv autoload no; " \ |
| 206 | "dhcp; " \ |
| 207 | "if tftp 80000000 debrick.scr; then " \ |
| 208 | "source 80000000; " \ |
| 209 | "fi" |
| 210 | #endif |
| 211 | #endif /* CONFIG_SPL_BUILD */ |
| 212 | #endif /* ! __CONFIG_ETAMIN_H */ |