Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
| 3 | * Copyright 2020 Hitachi Power Grids. All rights reserved. |
| 4 | */ |
| 5 | |
| 6 | #ifndef __CONFIG_PG_WCOM_LS102XA_H |
| 7 | #define __CONFIG_PG_WCOM_LS102XA_H |
| 8 | |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 9 | /* include common defines/options for all Keymile boards */ |
| 10 | #include "keymile-common.h" |
| 11 | |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 12 | #define CONFIG_SYS_INIT_RAM_ADDR OCRAM_BASE_ADDR |
| 13 | #define CONFIG_SYS_INIT_RAM_SIZE OCRAM_SIZE |
| 14 | |
Aleksandar Gerasimovski | 68a8998 | 2021-06-08 14:19:08 +0000 | [diff] [blame] | 15 | #define CONFIG_PRAM ((CONFIG_KM_PNVRAM + \ |
| 16 | CONFIG_KM_PHRAM + \ |
| 17 | CONFIG_KM_RESERVED_PRAM) >> 10) |
| 18 | |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 19 | #define PHYS_SDRAM 0x80000000 |
| 20 | #define PHYS_SDRAM_SIZE (1u * 1024 * 1024 * 1024) |
| 21 | |
| 22 | #define CONFIG_SYS_DDR_SDRAM_BASE 0x80000000UL |
| 23 | #define CONFIG_SYS_SDRAM_BASE CONFIG_SYS_DDR_SDRAM_BASE |
| 24 | |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 25 | #define SPD_EEPROM_ADDRESS 0x54 |
| 26 | |
Aleksandar Gerasimovski | bece73e | 2021-06-08 14:17:34 +0000 | [diff] [blame] | 27 | /* POST memory regions test */ |
| 28 | #define CONFIG_POST (CONFIG_SYS_POST_MEM_REGIONS) |
| 29 | #define CONFIG_POST_EXTERNAL_WORD_FUNCS |
| 30 | |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 31 | /* |
| 32 | * IFC Definitions |
| 33 | */ |
| 34 | /* NOR Flash Definitions */ |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 35 | #define CONFIG_SYS_FLASH_BASE 0x60000000 |
| 36 | #define CONFIG_SYS_FLASH_BASE_PHYS CONFIG_SYS_FLASH_BASE |
| 37 | |
| 38 | #define CONFIG_SYS_NOR0_CSPR_EXT (0x0) |
| 39 | #define CONFIG_SYS_NOR0_CSPR (CSPR_PHYS_ADDR(CONFIG_SYS_FLASH_BASE_PHYS) | \ |
| 40 | CSPR_PORT_SIZE_16 | \ |
| 41 | CSPR_TE | \ |
| 42 | CSPR_MSEL_NOR | \ |
| 43 | CSPR_V) |
| 44 | #define CONFIG_SYS_NOR_AMASK IFC_AMASK(64 * 1024 * 1024) |
| 45 | |
| 46 | #define CONFIG_SYS_NOR_CSOR (CSOR_NOR_AVD_TGL_PGM_EN | \ |
| 47 | CSOR_NOR_ADM_SHIFT(0x4) | \ |
| 48 | CSOR_NOR_NOR_MODE_ASYNC_NOR | \ |
| 49 | CSOR_NOR_TRHZ_20 | \ |
| 50 | CSOR_NOR_BCTLD) |
| 51 | #define CONFIG_SYS_NOR_FTIM0 (FTIM0_NOR_TACSE(0x1) | \ |
| 52 | FTIM0_NOR_TEADC(0x7) | \ |
| 53 | FTIM0_NOR_TAVDS(0x0) | \ |
| 54 | FTIM0_NOR_TEAHC(0x1)) |
| 55 | #define CONFIG_SYS_NOR_FTIM1 (FTIM1_NOR_TACO(0x1) | \ |
| 56 | FTIM1_NOR_TRAD_NOR(0x21) | \ |
| 57 | FTIM1_NOR_TSEQRAD_NOR(0x21)) |
| 58 | #define CONFIG_SYS_NOR_FTIM2 (FTIM2_NOR_TCS(0x1) | \ |
| 59 | FTIM2_NOR_TCH(0x1) | \ |
| 60 | FTIM2_NOR_TWPH(0x6) | \ |
| 61 | FTIM2_NOR_TWP(0xb)) |
| 62 | #define CONFIG_SYS_NOR_FTIM3 0 |
| 63 | |
| 64 | #define CONFIG_SYS_FLASH_QUIET_TEST |
| 65 | #define CONFIG_FLASH_SHOW_PROGRESS 45 /* count down from 45/5: 9..1 */ |
| 66 | |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 67 | #define CONFIG_SYS_MAX_FLASH_SECT 512 /* sectors per device */ |
| 68 | #define CONFIG_SYS_FLASH_ERASE_TOUT 60000 /* Flash Erase Timeout (ms) */ |
| 69 | #define CONFIG_SYS_FLASH_WRITE_TOUT 500 /* Flash Write Timeout (ms) */ |
| 70 | |
| 71 | #define CONFIG_SYS_FLASH_EMPTY_INFO |
| 72 | #define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE_PHYS } |
| 73 | |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 74 | #define CONFIG_SYS_WRITE_SWAPPED_DATA |
| 75 | |
| 76 | #define CONFIG_SYS_CSPR0_EXT CONFIG_SYS_NOR0_CSPR_EXT |
| 77 | #define CONFIG_SYS_CSPR0 CONFIG_SYS_NOR0_CSPR |
| 78 | #define CONFIG_SYS_AMASK0 CONFIG_SYS_NOR_AMASK |
| 79 | #define CONFIG_SYS_CSOR0 CONFIG_SYS_NOR_CSOR |
| 80 | #define CONFIG_SYS_CS0_FTIM0 CONFIG_SYS_NOR_FTIM0 |
| 81 | #define CONFIG_SYS_CS0_FTIM1 CONFIG_SYS_NOR_FTIM1 |
| 82 | #define CONFIG_SYS_CS0_FTIM2 CONFIG_SYS_NOR_FTIM2 |
| 83 | #define CONFIG_SYS_CS0_FTIM3 CONFIG_SYS_NOR_FTIM3 |
| 84 | |
| 85 | /* NAND Flash Definitions */ |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 86 | #define CONFIG_SYS_NAND_BASE 0x68000000 |
| 87 | #define CONFIG_SYS_NAND_BASE_PHYS CONFIG_SYS_NAND_BASE |
| 88 | |
| 89 | #define CONFIG_SYS_NAND_CSPR_EXT (0x0) |
| 90 | #define CONFIG_SYS_NAND_CSPR (CSPR_PHYS_ADDR(CONFIG_SYS_NAND_BASE) | \ |
| 91 | CSPR_PORT_SIZE_8 | \ |
| 92 | CSPR_TE | \ |
| 93 | CSPR_MSEL_NAND | \ |
| 94 | CSPR_V) |
| 95 | #define CONFIG_SYS_NAND_AMASK IFC_AMASK(64 * 1024) |
| 96 | #define CONFIG_SYS_NAND_CSOR (CSOR_NAND_ECC_ENC_EN \ |
| 97 | | CSOR_NAND_ECC_DEC_EN \ |
| 98 | | CSOR_NAND_ECC_MODE_4 \ |
| 99 | | CSOR_NAND_RAL_3 \ |
| 100 | | CSOR_NAND_PGS_2K \ |
| 101 | | CSOR_NAND_SPRZ_64 \ |
| 102 | | CSOR_NAND_PB(64) \ |
| 103 | | CSOR_NAND_TRHZ_40 \ |
| 104 | | CSOR_NAND_BCTLD) |
| 105 | |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 106 | #define CONFIG_SYS_NAND_FTIM0 (FTIM0_NAND_TCCST(0x3) | \ |
| 107 | FTIM0_NAND_TWP(0x8) | \ |
| 108 | FTIM0_NAND_TWCHT(0x3) | \ |
| 109 | FTIM0_NAND_TWH(0x5)) |
| 110 | #define CONFIG_SYS_NAND_FTIM1 (FTIM1_NAND_TADLE(0x1e) | \ |
| 111 | FTIM1_NAND_TWBE(0x1e) | \ |
| 112 | FTIM1_NAND_TRR(0x6) | \ |
| 113 | FTIM1_NAND_TRP(0x8)) |
| 114 | #define CONFIG_SYS_NAND_FTIM2 (FTIM2_NAND_TRAD(0x9) | \ |
| 115 | FTIM2_NAND_TREH(0x5) | \ |
| 116 | FTIM2_NAND_TWHRE(0x3c)) |
| 117 | #define CONFIG_SYS_NAND_FTIM3 (FTIM3_NAND_TWW(0x1e)) |
| 118 | |
| 119 | #define CONFIG_SYS_CSPR1_EXT CONFIG_SYS_NAND_CSPR_EXT |
| 120 | #define CONFIG_SYS_CSPR1 CONFIG_SYS_NAND_CSPR |
| 121 | #define CONFIG_SYS_AMASK1 CONFIG_SYS_NAND_AMASK |
| 122 | #define CONFIG_SYS_CSOR1 CONFIG_SYS_NAND_CSOR |
| 123 | #define CONFIG_SYS_CS1_FTIM0 CONFIG_SYS_NAND_FTIM0 |
| 124 | #define CONFIG_SYS_CS1_FTIM1 CONFIG_SYS_NAND_FTIM1 |
| 125 | #define CONFIG_SYS_CS1_FTIM2 CONFIG_SYS_NAND_FTIM2 |
| 126 | #define CONFIG_SYS_CS1_FTIM3 CONFIG_SYS_NAND_FTIM3 |
| 127 | |
| 128 | #define CONFIG_SYS_MAX_NAND_DEVICE 1 |
| 129 | #define CONFIG_SYS_NAND_BASE_LIST { CONFIG_SYS_NAND_BASE } |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 130 | |
| 131 | /* QRIO FPGA Definitions */ |
| 132 | #define CONFIG_SYS_QRIO_BASE 0x70000000 |
| 133 | #define CONFIG_SYS_QRIO_BASE_PHYS CONFIG_SYS_QRIO_BASE |
| 134 | |
| 135 | #define CONFIG_SYS_CSPR2_EXT (0x00) |
| 136 | #define CONFIG_SYS_CSPR2 (CSPR_PHYS_ADDR(CONFIG_SYS_QRIO_BASE) | \ |
| 137 | CSPR_PORT_SIZE_8 | \ |
| 138 | CSPR_TE | \ |
| 139 | CSPR_MSEL_GPCM | \ |
| 140 | CSPR_V) |
| 141 | #define CONFIG_SYS_AMASK2 IFC_AMASK(64 * 1024) |
| 142 | #define CONFIG_SYS_CSOR2 (CSOR_GPCM_ADM_SHIFT(0x4) | \ |
| 143 | CSOR_GPCM_TRHZ_20 | \ |
| 144 | CSOR_GPCM_BCTLD) |
| 145 | #define CONFIG_SYS_CS2_FTIM0 (FTIM0_GPCM_TACSE(0x2) | \ |
| 146 | FTIM0_GPCM_TEADC(0x8) | \ |
| 147 | FTIM0_GPCM_TEAHC(0x2)) |
| 148 | #define CONFIG_SYS_CS2_FTIM1 (FTIM1_GPCM_TACO(0x2) | \ |
| 149 | FTIM1_GPCM_TRAD(0x6)) |
| 150 | #define CONFIG_SYS_CS2_FTIM2 (FTIM2_GPCM_TCS(0x1) | \ |
| 151 | FTIM2_GPCM_TCH(0x1) | \ |
| 152 | FTIM2_GPCM_TWP(0x7)) |
| 153 | #define CONFIG_SYS_CS2_FTIM3 0x04000000 |
| 154 | |
| 155 | /* |
| 156 | * Serial Port |
| 157 | */ |
| 158 | #define CONFIG_SYS_NS16550_SERIAL |
| 159 | #define CONFIG_SYS_NS16550_CLK get_serial_clock() |
| 160 | |
| 161 | /* |
| 162 | * I2C |
| 163 | */ |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 164 | #define CONFIG_SYS_I2C_INIT_BOARD |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 165 | |
| 166 | #define CONFIG_I2C_MULTI_BUS |
| 167 | #define CONFIG_SYS_I2C_MAX_HOPS 1 |
| 168 | #define CONFIG_SYS_NUM_I2C_BUSES 3 |
| 169 | #define I2C_MUX_PCA_ADDR 0x70 |
| 170 | #define I2C_MUX_CH_DEFAULT 0x0 |
| 171 | #define CONFIG_SYS_I2C_BUSES { {0, {I2C_NULL_HOP} }, \ |
| 172 | {0, {{I2C_MUX_PCA9547, 0x70, 1 } } }, \ |
| 173 | {1, {I2C_NULL_HOP} }, \ |
| 174 | } |
| 175 | |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 176 | #define CONFIG_SMP_PEN_ADDR 0x01ee0200 |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 177 | |
| 178 | #define CONFIG_HWCONFIG |
| 179 | #define HWCONFIG_BUFFER_SIZE 256 |
| 180 | #define CONFIG_FSL_DEVICE_DISABLE |
| 181 | |
| 182 | /* |
| 183 | * Miscellaneous configurable options |
| 184 | */ |
| 185 | |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 186 | #define CONFIG_LS102XA_STREAM_ID |
| 187 | |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 188 | #define CONFIG_SYS_MONITOR_LEN 0x100000 /* 1Mbyte */ |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 189 | |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 190 | /* |
| 191 | * Environment |
| 192 | */ |
| 193 | |
| 194 | #define CONFIG_ENV_TOTAL_SIZE 0x40000 |
| 195 | #define ENV_DEL_ADDR CONFIG_ENV_ADDR_REDUND /* direct for newenv */ |
| 196 | |
| 197 | #ifndef CONFIG_KM_DEF_ENV /* if not set by keymile-common.h */ |
| 198 | #define CONFIG_KM_DEF_ENV |
| 199 | #endif |
| 200 | |
| 201 | #ifndef CONFIG_KM_DEF_BOOT_ARGS_CPU |
| 202 | #define CONFIG_KM_DEF_BOOT_ARGS_CPU "" |
| 203 | #endif |
| 204 | |
| 205 | #define CONFIG_KM_DEF_ENV_CPU \ |
| 206 | "boot=bootm ${load_addr_r} - ${fdt_addr_r}\0" \ |
| 207 | "cramfsloadfdt=" \ |
| 208 | "cramfsload ${fdt_addr_r} " \ |
| 209 | "fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb\0" \ |
| 210 | "u-boot=" CONFIG_HOSTNAME "/u-boot.bin\0" \ |
| 211 | "update=protect off " __stringify(CONFIG_SYS_MONITOR_BASE) \ |
| 212 | " +${filesize} && " \ |
| 213 | "erase " __stringify(CONFIG_SYS_MONITOR_BASE) \ |
| 214 | " +${filesize} && " \ |
| 215 | "cp.b ${load_addr_r} " \ |
| 216 | __stringify(CONFIG_SYS_MONITOR_BASE) " ${filesize} && " \ |
| 217 | "protect on " __stringify(CONFIG_SYS_MONITOR_BASE) \ |
| 218 | " +${filesize}\0" \ |
| 219 | "update-nor=protect off " __stringify(CONFIG_SYS_FLASH_BASE) \ |
| 220 | " +${filesize} && " \ |
| 221 | "erase " __stringify(CONFIG_SYS_FLASH_BASE) \ |
| 222 | " +${filesize} && " \ |
| 223 | "cp.b ${load_addr_r} " \ |
| 224 | __stringify(CONFIG_SYS_FLASH_BASE) " ${filesize} && " \ |
| 225 | "protect on " __stringify(CONFIG_SYS_MONITOR_BASE) \ |
| 226 | " +" __stringify(CONFIG_SYS_MONITOR_LEN)"\0" \ |
| 227 | "set_fdthigh=true\0" \ |
| 228 | "checkfdt=true\0" \ |
| 229 | "" |
| 230 | |
| 231 | #define CONFIG_KM_NEW_ENV \ |
| 232 | "newenv=protect off " __stringify(ENV_DEL_ADDR) \ |
| 233 | " +" __stringify(CONFIG_ENV_TOTAL_SIZE) " && " \ |
| 234 | "erase " __stringify(ENV_DEL_ADDR) \ |
| 235 | " +" __stringify(CONFIG_ENV_TOTAL_SIZE) " && " \ |
| 236 | "protect on " __stringify(ENV_DEL_ADDR) \ |
| 237 | " +" __stringify(CONFIG_ENV_TOTAL_SIZE) "\0" |
| 238 | |
Aleksandar Gerasimovski | 56c6c2c | 2021-06-08 14:23:34 +0000 | [diff] [blame] | 239 | #define CONFIG_HW_ENV_SETTINGS \ |
| 240 | "hwconfig=devdis:esdhc,usb3,usb2,sata,sec,dcu,duart2,qspi," \ |
| 241 | "can1,can2_4,ftm2_8,i2c2_3,sai1_4,lpuart2_6," \ |
| 242 | "asrc,spdif,lpuart1,ftm1\0" |
| 243 | |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 244 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
| 245 | CONFIG_KM_NEW_ENV \ |
| 246 | CONFIG_KM_DEF_ENV \ |
Aleksandar Gerasimovski | 56c6c2c | 2021-06-08 14:23:34 +0000 | [diff] [blame] | 247 | CONFIG_HW_ENV_SETTINGS \ |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 248 | "EEprom_ivm=pca9547:70:9\0" \ |
Aleksandar Gerasimovski | a5ac0a4 | 2021-06-08 14:21:15 +0000 | [diff] [blame] | 249 | "ethrotate=no\0" \ |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 250 | "" |
| 251 | |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 252 | #define CONFIG_SYS_BOOTMAPSZ (256 << 20) /* Increase map for Linux */ |
| 253 | |
Aleksandar Gerasimovski | 032bdbc | 2021-02-22 18:18:11 +0000 | [diff] [blame] | 254 | #endif |