Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 2 | /* |
Jianpeng Bu | f9648b6 | 2022-01-31 18:42:36 +0530 | [diff] [blame] | 3 | * Copyright 2017-2022 NXP |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 4 | */ |
| 5 | #include <common.h> |
Tom Rini | 8c70baa | 2021-12-14 13:36:40 -0500 | [diff] [blame] | 6 | #include <clock_legacy.h> |
Simon Glass | 0af6e2d | 2019-08-01 09:46:52 -0600 | [diff] [blame] | 7 | #include <env.h> |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 8 | #include <i2c.h> |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 9 | #include <init.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 10 | #include <log.h> |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 11 | #include <malloc.h> |
| 12 | #include <errno.h> |
| 13 | #include <netdev.h> |
| 14 | #include <fsl_ifc.h> |
| 15 | #include <fsl_ddr.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 16 | #include <asm/global_data.h> |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 17 | #include <asm/io.h> |
| 18 | #include <fdt_support.h> |
Simon Glass | dbd7954 | 2020-05-10 11:40:11 -0600 | [diff] [blame] | 19 | #include <linux/delay.h> |
Masahiro Yamada | 75f82d0 | 2018-03-05 01:20:11 +0900 | [diff] [blame] | 20 | #include <linux/libfdt.h> |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 21 | #include <fsl-mc/fsl_mc.h> |
Simon Glass | 9d1f619 | 2019-08-02 09:44:25 -0600 | [diff] [blame] | 22 | #include <env_internal.h> |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 23 | #include <asm/arch-fsl-layerscape/soc.h> |
| 24 | #include <asm/arch/ppa.h> |
Yangbo Lu | 1d87953 | 2017-11-27 15:40:17 +0800 | [diff] [blame] | 25 | #include <hwconfig.h> |
Rajesh Bhagat | a421625 | 2018-01-17 16:13:09 +0530 | [diff] [blame] | 26 | #include <asm/arch/fsl_serdes.h> |
| 27 | #include <asm/arch/soc.h> |
Laurentiu Tudor | 7690ea7 | 2019-07-30 17:29:58 +0300 | [diff] [blame] | 28 | #include <asm/arch-fsl-layerscape/fsl_icid.h> |
Stephen Carlson | 267ddcc | 2021-06-22 16:41:38 -0700 | [diff] [blame] | 29 | #include "../common/i2c_mux.h" |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 30 | |
| 31 | #include "../common/qixis.h" |
| 32 | #include "ls1088a_qixis.h" |
Rajesh Bhagat | a421625 | 2018-01-17 16:13:09 +0530 | [diff] [blame] | 33 | #include "../common/vid.h" |
| 34 | #include <fsl_immap.h> |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 35 | |
| 36 | DECLARE_GLOBAL_DATA_PTR; |
| 37 | |
Pankit Garg | 112aeba | 2018-12-27 04:37:57 +0000 | [diff] [blame] | 38 | #ifdef CONFIG_TARGET_LS1088AQDS |
| 39 | #ifdef CONFIG_TFABOOT |
| 40 | struct ifc_regs ifc_cfg_ifc_nor_boot[CONFIG_SYS_FSL_IFC_BANK_COUNT] = { |
| 41 | { |
| 42 | "nor0", |
| 43 | CONFIG_SYS_NOR0_CSPR_EARLY, |
| 44 | CONFIG_SYS_NOR0_CSPR_EXT, |
| 45 | CONFIG_SYS_NOR_AMASK, |
| 46 | CONFIG_SYS_NOR_CSOR, |
| 47 | { |
| 48 | CONFIG_SYS_NOR_FTIM0, |
| 49 | CONFIG_SYS_NOR_FTIM1, |
| 50 | CONFIG_SYS_NOR_FTIM2, |
| 51 | CONFIG_SYS_NOR_FTIM3 |
| 52 | }, |
| 53 | 0, |
| 54 | CONFIG_SYS_NOR0_CSPR, |
| 55 | 0, |
| 56 | }, |
| 57 | { |
| 58 | "nor1", |
| 59 | CONFIG_SYS_NOR1_CSPR_EARLY, |
| 60 | CONFIG_SYS_NOR0_CSPR_EXT, |
| 61 | CONFIG_SYS_NOR_AMASK_EARLY, |
| 62 | CONFIG_SYS_NOR_CSOR, |
| 63 | { |
| 64 | CONFIG_SYS_NOR_FTIM0, |
| 65 | CONFIG_SYS_NOR_FTIM1, |
| 66 | CONFIG_SYS_NOR_FTIM2, |
| 67 | CONFIG_SYS_NOR_FTIM3 |
| 68 | }, |
| 69 | 0, |
| 70 | CONFIG_SYS_NOR1_CSPR, |
| 71 | CONFIG_SYS_NOR_AMASK, |
| 72 | }, |
| 73 | { |
| 74 | "nand", |
| 75 | CONFIG_SYS_NAND_CSPR, |
| 76 | CONFIG_SYS_NAND_CSPR_EXT, |
| 77 | CONFIG_SYS_NAND_AMASK, |
| 78 | CONFIG_SYS_NAND_CSOR, |
| 79 | { |
| 80 | CONFIG_SYS_NAND_FTIM0, |
| 81 | CONFIG_SYS_NAND_FTIM1, |
| 82 | CONFIG_SYS_NAND_FTIM2, |
| 83 | CONFIG_SYS_NAND_FTIM3 |
| 84 | }, |
| 85 | }, |
| 86 | { |
| 87 | "fpga", |
| 88 | CONFIG_SYS_FPGA_CSPR, |
| 89 | CONFIG_SYS_FPGA_CSPR_EXT, |
| 90 | SYS_FPGA_AMASK, |
| 91 | CONFIG_SYS_FPGA_CSOR, |
| 92 | { |
| 93 | SYS_FPGA_CS_FTIM0, |
| 94 | SYS_FPGA_CS_FTIM1, |
| 95 | SYS_FPGA_CS_FTIM2, |
| 96 | SYS_FPGA_CS_FTIM3 |
| 97 | }, |
| 98 | 0, |
| 99 | SYS_FPGA_CSPR_FINAL, |
| 100 | 0, |
| 101 | } |
| 102 | }; |
| 103 | |
| 104 | struct ifc_regs ifc_cfg_qspi_nor_boot[CONFIG_SYS_FSL_IFC_BANK_COUNT] = { |
| 105 | { |
| 106 | "nand", |
| 107 | CONFIG_SYS_NAND_CSPR, |
| 108 | CONFIG_SYS_NAND_CSPR_EXT, |
| 109 | CONFIG_SYS_NAND_AMASK, |
| 110 | CONFIG_SYS_NAND_CSOR, |
| 111 | { |
| 112 | CONFIG_SYS_NAND_FTIM0, |
| 113 | CONFIG_SYS_NAND_FTIM1, |
| 114 | CONFIG_SYS_NAND_FTIM2, |
| 115 | CONFIG_SYS_NAND_FTIM3 |
| 116 | }, |
| 117 | }, |
| 118 | { |
| 119 | "reserved", |
| 120 | }, |
| 121 | { |
| 122 | "fpga", |
| 123 | CONFIG_SYS_FPGA_CSPR, |
| 124 | CONFIG_SYS_FPGA_CSPR_EXT, |
| 125 | SYS_FPGA_AMASK, |
| 126 | CONFIG_SYS_FPGA_CSOR, |
| 127 | { |
| 128 | SYS_FPGA_CS_FTIM0, |
| 129 | SYS_FPGA_CS_FTIM1, |
| 130 | SYS_FPGA_CS_FTIM2, |
| 131 | SYS_FPGA_CS_FTIM3 |
| 132 | }, |
| 133 | 0, |
| 134 | SYS_FPGA_CSPR_FINAL, |
| 135 | 0, |
| 136 | } |
| 137 | }; |
| 138 | |
| 139 | void ifc_cfg_boot_info(struct ifc_regs_info *regs_info) |
| 140 | { |
| 141 | enum boot_src src = get_boot_src(); |
| 142 | |
| 143 | if (src == BOOT_SOURCE_QSPI_NOR) |
| 144 | regs_info->regs = ifc_cfg_qspi_nor_boot; |
| 145 | else |
| 146 | regs_info->regs = ifc_cfg_ifc_nor_boot; |
| 147 | |
| 148 | regs_info->cs_size = CONFIG_SYS_FSL_IFC_BANK_COUNT; |
| 149 | } |
| 150 | #endif /* CONFIG_TFABOOT */ |
| 151 | #endif /* CONFIG_TARGET_LS1088AQDS */ |
| 152 | |
Sumit Garg | 08da8b2 | 2018-01-06 09:04:24 +0530 | [diff] [blame] | 153 | int board_early_init_f(void) |
| 154 | { |
Ashish Kumar | f719b19 | 2018-02-19 14:14:53 +0530 | [diff] [blame] | 155 | #if defined(CONFIG_SYS_I2C_EARLY_INIT) && defined(CONFIG_TARGET_LS1088AQDS) |
| 156 | i2c_early_init_f(); |
| 157 | #endif |
Sumit Garg | 08da8b2 | 2018-01-06 09:04:24 +0530 | [diff] [blame] | 158 | fsl_lsch3_early_init_f(); |
| 159 | return 0; |
| 160 | } |
| 161 | |
| 162 | #ifdef CONFIG_FSL_QIXIS |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 163 | unsigned long long get_qixis_addr(void) |
| 164 | { |
| 165 | unsigned long long addr; |
| 166 | |
| 167 | if (gd->flags & GD_FLG_RELOC) |
| 168 | addr = QIXIS_BASE_PHYS; |
| 169 | else |
| 170 | addr = QIXIS_BASE_PHYS_EARLY; |
| 171 | |
| 172 | /* |
| 173 | * IFC address under 256MB is mapped to 0x30000000, any address above |
| 174 | * is mapped to 0x5_10000000 up to 4GB. |
| 175 | */ |
| 176 | addr = addr > 0x10000000 ? addr + 0x500000000ULL : addr + 0x30000000; |
| 177 | |
| 178 | return addr; |
| 179 | } |
Sumit Garg | 08da8b2 | 2018-01-06 09:04:24 +0530 | [diff] [blame] | 180 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 181 | |
Rajesh Bhagat | a421625 | 2018-01-17 16:13:09 +0530 | [diff] [blame] | 182 | #if defined(CONFIG_VID) |
| 183 | int init_func_vid(void) |
| 184 | { |
| 185 | if (adjust_vdd(0) < 0) |
| 186 | printf("core voltage not adjusted\n"); |
| 187 | |
| 188 | return 0; |
| 189 | } |
Stephen Carlson | c3301a2 | 2021-02-08 11:11:29 +0100 | [diff] [blame] | 190 | |
| 191 | u16 soc_get_fuse_vid(int vid_index) |
| 192 | { |
| 193 | static const u16 vdd[32] = { |
| 194 | 10250, |
| 195 | 9875, |
| 196 | 9750, |
| 197 | 0, /* reserved */ |
| 198 | 0, /* reserved */ |
| 199 | 0, /* reserved */ |
| 200 | 0, /* reserved */ |
| 201 | 0, /* reserved */ |
| 202 | 9000, |
| 203 | 0, /* reserved */ |
| 204 | 0, /* reserved */ |
| 205 | 0, /* reserved */ |
| 206 | 0, /* reserved */ |
| 207 | 0, /* reserved */ |
| 208 | 0, /* reserved */ |
| 209 | 0, /* reserved */ |
| 210 | 10000, /* 1.0000V */ |
| 211 | 10125, |
| 212 | 10250, |
| 213 | 0, /* reserved */ |
| 214 | 0, /* reserved */ |
| 215 | 0, /* reserved */ |
| 216 | 0, /* reserved */ |
| 217 | 0, /* reserved */ |
| 218 | 0, /* reserved */ |
| 219 | 0, /* reserved */ |
| 220 | 0, /* reserved */ |
| 221 | 0, /* reserved */ |
| 222 | 0, /* reserved */ |
| 223 | 0, /* reserved */ |
| 224 | 0, /* reserved */ |
| 225 | 0, /* reserved */ |
| 226 | }; |
| 227 | |
| 228 | return vdd[vid_index]; |
| 229 | }; |
Rajesh Bhagat | a421625 | 2018-01-17 16:13:09 +0530 | [diff] [blame] | 230 | #endif |
| 231 | |
Pramod Kumar | a053182 | 2018-10-12 14:04:27 +0000 | [diff] [blame] | 232 | int is_pb_board(void) |
| 233 | { |
| 234 | u8 board_id; |
| 235 | |
| 236 | board_id = QIXIS_READ(id); |
| 237 | if (board_id == LS1088ARDB_PB_BOARD) |
| 238 | return 1; |
| 239 | else |
| 240 | return 0; |
| 241 | } |
| 242 | |
| 243 | int fixup_ls1088ardb_pb_banner(void *fdt) |
| 244 | { |
| 245 | fdt_setprop_string(fdt, 0, "model", "LS1088ARDB-PB Board"); |
| 246 | |
| 247 | return 0; |
| 248 | } |
| 249 | |
Sumit Garg | 08da8b2 | 2018-01-06 09:04:24 +0530 | [diff] [blame] | 250 | #if !defined(CONFIG_SPL_BUILD) |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 251 | int checkboard(void) |
| 252 | { |
Pankit Garg | f5c2a83 | 2018-12-27 04:37:55 +0000 | [diff] [blame] | 253 | #ifdef CONFIG_TFABOOT |
| 254 | enum boot_src src = get_boot_src(); |
| 255 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 256 | char buf[64]; |
| 257 | u8 sw; |
| 258 | static const char *const freq[] = {"100", "125", "156.25", |
| 259 | "100 separate SSCG"}; |
| 260 | int clock; |
| 261 | |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 262 | #ifdef CONFIG_TARGET_LS1088AQDS |
| 263 | printf("Board: LS1088A-QDS, "); |
| 264 | #else |
Pramod Kumar | a053182 | 2018-10-12 14:04:27 +0000 | [diff] [blame] | 265 | if (is_pb_board()) |
| 266 | printf("Board: LS1088ARDB-PB, "); |
| 267 | else |
| 268 | printf("Board: LS1088A-RDB, "); |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 269 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 270 | |
| 271 | sw = QIXIS_READ(arch); |
| 272 | printf("Board Arch: V%d, ", sw >> 4); |
| 273 | |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 274 | #ifdef CONFIG_TARGET_LS1088AQDS |
| 275 | printf("Board version: %c, boot from ", (sw & 0xf) + 'A' - 1); |
| 276 | #else |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 277 | printf("Board version: %c, boot from ", (sw & 0xf) + 'A'); |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 278 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 279 | |
| 280 | memset((u8 *)buf, 0x00, ARRAY_SIZE(buf)); |
| 281 | |
| 282 | sw = QIXIS_READ(brdcfg[0]); |
| 283 | sw = (sw & QIXIS_LBMAP_MASK) >> QIXIS_LBMAP_SHIFT; |
| 284 | |
Pankit Garg | f5c2a83 | 2018-12-27 04:37:55 +0000 | [diff] [blame] | 285 | #ifdef CONFIG_TFABOOT |
| 286 | if (src == BOOT_SOURCE_SD_MMC) |
| 287 | puts("SD card\n"); |
| 288 | #else |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 289 | #ifdef CONFIG_SD_BOOT |
| 290 | puts("SD card\n"); |
| 291 | #endif |
Pankit Garg | f5c2a83 | 2018-12-27 04:37:55 +0000 | [diff] [blame] | 292 | #endif /* CONFIG_TFABOOT */ |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 293 | switch (sw) { |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 294 | #ifdef CONFIG_TARGET_LS1088AQDS |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 295 | case 0: |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 296 | case 1: |
| 297 | case 2: |
| 298 | case 3: |
| 299 | case 4: |
| 300 | case 5: |
| 301 | case 6: |
| 302 | case 7: |
| 303 | printf("vBank: %d\n", sw); |
| 304 | break; |
| 305 | case 8: |
| 306 | puts("PromJet\n"); |
| 307 | break; |
| 308 | case 15: |
| 309 | puts("IFCCard\n"); |
| 310 | break; |
| 311 | case 14: |
| 312 | #else |
| 313 | case 0: |
| 314 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 315 | puts("QSPI:"); |
| 316 | sw = QIXIS_READ(brdcfg[0]); |
| 317 | sw = (sw & QIXIS_QMAP_MASK) >> QIXIS_QMAP_SHIFT; |
| 318 | if (sw == 0 || sw == 4) |
| 319 | puts("0\n"); |
| 320 | else if (sw == 1) |
| 321 | puts("1\n"); |
| 322 | else |
| 323 | puts("EMU\n"); |
| 324 | break; |
| 325 | |
| 326 | default: |
| 327 | printf("invalid setting of SW%u\n", QIXIS_LBMAP_SWITCH); |
| 328 | break; |
| 329 | } |
| 330 | |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 331 | #ifdef CONFIG_TARGET_LS1088AQDS |
| 332 | printf("FPGA: v%d (%s), build %d", |
| 333 | (int)QIXIS_READ(scver), qixis_read_tag(buf), |
| 334 | (int)qixis_read_minor()); |
| 335 | /* the timestamp string contains "\n" at the end */ |
| 336 | printf(" on %s", qixis_read_time(buf)); |
| 337 | #else |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 338 | printf("CPLD: v%d.%d\n", QIXIS_READ(scver), QIXIS_READ(tagdata)); |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 339 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 340 | |
| 341 | /* |
| 342 | * Display the actual SERDES reference clocks as configured by the |
| 343 | * dip switches on the board. Note that the SWx registers could |
| 344 | * technically be set to force the reference clocks to match the |
| 345 | * values that the SERDES expects (or vice versa). For now, however, |
| 346 | * we just display both values and hope the user notices when they |
| 347 | * don't match. |
| 348 | */ |
| 349 | puts("SERDES1 Reference : "); |
| 350 | sw = QIXIS_READ(brdcfg[2]); |
| 351 | clock = (sw >> 6) & 3; |
| 352 | printf("Clock1 = %sMHz ", freq[clock]); |
| 353 | clock = (sw >> 4) & 3; |
| 354 | printf("Clock2 = %sMHz", freq[clock]); |
| 355 | |
| 356 | puts("\nSERDES2 Reference : "); |
| 357 | clock = (sw >> 2) & 3; |
| 358 | printf("Clock1 = %sMHz ", freq[clock]); |
| 359 | clock = (sw >> 0) & 3; |
| 360 | printf("Clock2 = %sMHz\n", freq[clock]); |
| 361 | |
| 362 | return 0; |
| 363 | } |
Ashish Kumar | d029b27 | 2018-02-19 14:14:52 +0530 | [diff] [blame] | 364 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 365 | |
| 366 | bool if_board_diff_clk(void) |
| 367 | { |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 368 | #ifdef CONFIG_TARGET_LS1088AQDS |
| 369 | u8 diff_conf = QIXIS_READ(brdcfg[11]); |
| 370 | return diff_conf & 0x40; |
| 371 | #else |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 372 | u8 diff_conf = QIXIS_READ(dutcfg[11]); |
| 373 | return diff_conf & 0x80; |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 374 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 375 | } |
| 376 | |
Tom Rini | aea2a99 | 2021-12-14 13:36:39 -0500 | [diff] [blame] | 377 | #ifdef CONFIG_DYNAMIC_SYS_CLK_FREQ |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 378 | unsigned long get_board_sys_clk(void) |
| 379 | { |
| 380 | u8 sysclk_conf = QIXIS_READ(brdcfg[1]); |
| 381 | |
| 382 | switch (sysclk_conf & 0x0f) { |
| 383 | case QIXIS_SYSCLK_83: |
| 384 | return 83333333; |
| 385 | case QIXIS_SYSCLK_100: |
| 386 | return 100000000; |
| 387 | case QIXIS_SYSCLK_125: |
| 388 | return 125000000; |
| 389 | case QIXIS_SYSCLK_133: |
| 390 | return 133333333; |
| 391 | case QIXIS_SYSCLK_150: |
| 392 | return 150000000; |
| 393 | case QIXIS_SYSCLK_160: |
| 394 | return 160000000; |
| 395 | case QIXIS_SYSCLK_166: |
| 396 | return 166666666; |
| 397 | } |
| 398 | |
| 399 | return 66666666; |
| 400 | } |
Tom Rini | aea2a99 | 2021-12-14 13:36:39 -0500 | [diff] [blame] | 401 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 402 | |
Tom Rini | 8fa9125 | 2021-12-14 13:36:37 -0500 | [diff] [blame] | 403 | #ifdef CONFIG_DYNAMIC_DDR_CLK_FREQ |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 404 | unsigned long get_board_ddr_clk(void) |
| 405 | { |
| 406 | u8 ddrclk_conf = QIXIS_READ(brdcfg[1]); |
| 407 | |
| 408 | if (if_board_diff_clk()) |
| 409 | return get_board_sys_clk(); |
| 410 | switch ((ddrclk_conf & 0x30) >> 4) { |
| 411 | case QIXIS_DDRCLK_100: |
| 412 | return 100000000; |
| 413 | case QIXIS_DDRCLK_125: |
| 414 | return 125000000; |
| 415 | case QIXIS_DDRCLK_133: |
| 416 | return 133333333; |
| 417 | } |
| 418 | |
| 419 | return 66666666; |
| 420 | } |
Tom Rini | 8fa9125 | 2021-12-14 13:36:37 -0500 | [diff] [blame] | 421 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 422 | |
Rajesh Bhagat | 6d809b8 | 2018-01-17 16:13:10 +0530 | [diff] [blame] | 423 | #if !defined(CONFIG_SPL_BUILD) |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 424 | void board_retimer_init(void) |
| 425 | { |
| 426 | u8 reg; |
| 427 | |
| 428 | /* Retimer is connected to I2C1_CH5 */ |
Stephen Carlson | 267ddcc | 2021-06-22 16:41:38 -0700 | [diff] [blame] | 429 | select_i2c_ch_pca9547(I2C_MUX_CH5, 0); |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 430 | |
| 431 | /* Access to Control/Shared register */ |
| 432 | reg = 0x0; |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 433 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 434 | i2c_write(I2C_RETIMER_ADDR, 0xff, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 435 | #else |
| 436 | struct udevice *dev; |
| 437 | |
| 438 | i2c_get_chip_for_busnum(0, I2C_RETIMER_ADDR, 1, &dev); |
| 439 | dm_i2c_write(dev, 0xff, ®, 1); |
| 440 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 441 | |
| 442 | /* Read device revision and ID */ |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 443 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 444 | i2c_read(I2C_RETIMER_ADDR, 1, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 445 | #else |
| 446 | dm_i2c_read(dev, 1, ®, 1); |
| 447 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 448 | debug("Retimer version id = 0x%x\n", reg); |
| 449 | |
| 450 | /* Enable Broadcast. All writes target all channel register sets */ |
| 451 | reg = 0x0c; |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 452 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 453 | i2c_write(I2C_RETIMER_ADDR, 0xff, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 454 | #else |
| 455 | dm_i2c_write(dev, 0xff, ®, 1); |
| 456 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 457 | |
| 458 | /* Reset Channel Registers */ |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 459 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 460 | i2c_read(I2C_RETIMER_ADDR, 0, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 461 | #else |
| 462 | dm_i2c_read(dev, 0, ®, 1); |
| 463 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 464 | reg |= 0x4; |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 465 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 466 | i2c_write(I2C_RETIMER_ADDR, 0, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 467 | #else |
| 468 | dm_i2c_write(dev, 0, ®, 1); |
| 469 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 470 | |
| 471 | /* Set data rate as 10.3125 Gbps */ |
| 472 | reg = 0x90; |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 473 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 474 | i2c_write(I2C_RETIMER_ADDR, 0x60, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 475 | #else |
| 476 | dm_i2c_write(dev, 0x60, ®, 1); |
| 477 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 478 | reg = 0xb3; |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 479 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 480 | i2c_write(I2C_RETIMER_ADDR, 0x61, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 481 | #else |
| 482 | dm_i2c_write(dev, 0x61, ®, 1); |
| 483 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 484 | reg = 0x90; |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 485 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 486 | i2c_write(I2C_RETIMER_ADDR, 0x62, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 487 | #else |
| 488 | dm_i2c_write(dev, 0x62, ®, 1); |
| 489 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 490 | reg = 0xb3; |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 491 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 492 | i2c_write(I2C_RETIMER_ADDR, 0x63, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 493 | #else |
| 494 | dm_i2c_write(dev, 0x63, ®, 1); |
| 495 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 496 | reg = 0xcd; |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 497 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 498 | i2c_write(I2C_RETIMER_ADDR, 0x64, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 499 | #else |
| 500 | dm_i2c_write(dev, 0x64, ®, 1); |
| 501 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 502 | |
| 503 | /* Select VCO Divider to full rate (000) */ |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 504 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 505 | i2c_read(I2C_RETIMER_ADDR, 0x2F, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 506 | #else |
| 507 | dm_i2c_read(dev, 0x2F, ®, 1); |
| 508 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 509 | reg &= 0x0f; |
| 510 | reg |= 0x70; |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 511 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 512 | i2c_write(I2C_RETIMER_ADDR, 0x2F, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 513 | #else |
| 514 | dm_i2c_write(dev, 0x2F, ®, 1); |
| 515 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 516 | |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 517 | #ifdef CONFIG_TARGET_LS1088AQDS |
| 518 | /* Retimer is connected to I2C1_CH5 */ |
Stephen Carlson | 267ddcc | 2021-06-22 16:41:38 -0700 | [diff] [blame] | 519 | select_i2c_ch_pca9547(I2C_MUX_CH5, 0); |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 520 | |
| 521 | /* Access to Control/Shared register */ |
| 522 | reg = 0x0; |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 523 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 524 | i2c_write(I2C_RETIMER_ADDR2, 0xff, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 525 | #else |
| 526 | i2c_get_chip_for_busnum(0, I2C_RETIMER_ADDR2, 1, &dev); |
| 527 | dm_i2c_write(dev, 0xff, ®, 1); |
| 528 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 529 | |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 530 | /* Read device revision and ID */ |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 531 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 532 | i2c_read(I2C_RETIMER_ADDR2, 1, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 533 | #else |
| 534 | dm_i2c_read(dev, 1, ®, 1); |
| 535 | #endif |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 536 | debug("Retimer version id = 0x%x\n", reg); |
| 537 | |
| 538 | /* Enable Broadcast. All writes target all channel register sets */ |
| 539 | reg = 0x0c; |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 540 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 541 | i2c_write(I2C_RETIMER_ADDR2, 0xff, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 542 | #else |
| 543 | dm_i2c_write(dev, 0xff, ®, 1); |
| 544 | #endif |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 545 | |
| 546 | /* Reset Channel Registers */ |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 547 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 548 | i2c_read(I2C_RETIMER_ADDR2, 0, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 549 | #else |
| 550 | dm_i2c_read(dev, 0, ®, 1); |
| 551 | #endif |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 552 | reg |= 0x4; |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 553 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 554 | i2c_write(I2C_RETIMER_ADDR2, 0, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 555 | #else |
| 556 | dm_i2c_write(dev, 0, ®, 1); |
| 557 | #endif |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 558 | |
| 559 | /* Set data rate as 10.3125 Gbps */ |
| 560 | reg = 0x90; |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 561 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 562 | i2c_write(I2C_RETIMER_ADDR2, 0x60, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 563 | #else |
| 564 | dm_i2c_write(dev, 0x60, ®, 1); |
| 565 | #endif |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 566 | reg = 0xb3; |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 567 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 568 | i2c_write(I2C_RETIMER_ADDR2, 0x61, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 569 | #else |
| 570 | dm_i2c_write(dev, 0x61, ®, 1); |
| 571 | #endif |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 572 | reg = 0x90; |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 573 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 574 | i2c_write(I2C_RETIMER_ADDR2, 0x62, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 575 | #else |
| 576 | dm_i2c_write(dev, 0x62, ®, 1); |
| 577 | #endif |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 578 | reg = 0xb3; |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 579 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 580 | i2c_write(I2C_RETIMER_ADDR2, 0x63, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 581 | #else |
| 582 | dm_i2c_write(dev, 0x63, ®, 1); |
| 583 | #endif |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 584 | reg = 0xcd; |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 585 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 586 | i2c_write(I2C_RETIMER_ADDR2, 0x64, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 587 | #else |
| 588 | dm_i2c_write(dev, 0x64, ®, 1); |
| 589 | #endif |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 590 | |
| 591 | /* Select VCO Divider to full rate (000) */ |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 592 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 593 | i2c_read(I2C_RETIMER_ADDR2, 0x2F, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 594 | #else |
| 595 | dm_i2c_read(dev, 0x2F, ®, 1); |
| 596 | #endif |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 597 | reg &= 0x0f; |
| 598 | reg |= 0x70; |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 599 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 600 | i2c_write(I2C_RETIMER_ADDR2, 0x2F, 1, ®, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 601 | #else |
| 602 | dm_i2c_write(dev, 0x2F, ®, 1); |
| 603 | #endif |
| 604 | |
Ashish Kumar | 1ef4c77 | 2017-08-31 16:12:55 +0530 | [diff] [blame] | 605 | #endif |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 606 | /*return the default channel*/ |
Stephen Carlson | 267ddcc | 2021-06-22 16:41:38 -0700 | [diff] [blame] | 607 | select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT, 0); |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 608 | } |
| 609 | |
Yangbo Lu | 1d87953 | 2017-11-27 15:40:17 +0800 | [diff] [blame] | 610 | #ifdef CONFIG_MISC_INIT_R |
| 611 | int misc_init_r(void) |
| 612 | { |
| 613 | #ifdef CONFIG_TARGET_LS1088ARDB |
| 614 | u8 brdcfg5; |
| 615 | |
| 616 | if (hwconfig("esdhc-force-sd")) { |
| 617 | brdcfg5 = QIXIS_READ(brdcfg[5]); |
| 618 | brdcfg5 &= ~BRDCFG5_SPISDHC_MASK; |
| 619 | brdcfg5 |= BRDCFG5_FORCE_SD; |
| 620 | QIXIS_WRITE(brdcfg[5], brdcfg5); |
| 621 | } |
| 622 | #endif |
Chuanhua Han | 26b39ef | 2019-08-01 16:36:57 +0800 | [diff] [blame] | 623 | |
| 624 | #ifdef CONFIG_TARGET_LS1088AQDS |
| 625 | u8 brdcfg4, brdcfg5; |
| 626 | |
| 627 | if (hwconfig("dspi-on-board")) { |
| 628 | brdcfg4 = QIXIS_READ(brdcfg[4]); |
| 629 | brdcfg4 &= ~BRDCFG4_USBOSC_MASK; |
| 630 | brdcfg4 |= BRDCFG4_SPI; |
| 631 | QIXIS_WRITE(brdcfg[4], brdcfg4); |
| 632 | |
| 633 | brdcfg5 = QIXIS_READ(brdcfg[5]); |
| 634 | brdcfg5 &= ~BRDCFG5_SPR_MASK; |
| 635 | brdcfg5 |= BRDCFG5_SPI_ON_BOARD; |
| 636 | QIXIS_WRITE(brdcfg[5], brdcfg5); |
| 637 | } else if (hwconfig("dspi-off-board")) { |
| 638 | brdcfg4 = QIXIS_READ(brdcfg[4]); |
| 639 | brdcfg4 &= ~BRDCFG4_USBOSC_MASK; |
| 640 | brdcfg4 |= BRDCFG4_SPI; |
| 641 | QIXIS_WRITE(brdcfg[4], brdcfg4); |
| 642 | |
| 643 | brdcfg5 = QIXIS_READ(brdcfg[5]); |
| 644 | brdcfg5 &= ~BRDCFG5_SPR_MASK; |
| 645 | brdcfg5 |= BRDCFG5_SPI_OFF_BOARD; |
| 646 | QIXIS_WRITE(brdcfg[5], brdcfg5); |
| 647 | } |
| 648 | #endif |
Yangbo Lu | 1d87953 | 2017-11-27 15:40:17 +0800 | [diff] [blame] | 649 | return 0; |
| 650 | } |
| 651 | #endif |
Rajesh Bhagat | 6d809b8 | 2018-01-17 16:13:10 +0530 | [diff] [blame] | 652 | #endif |
Yangbo Lu | 1d87953 | 2017-11-27 15:40:17 +0800 | [diff] [blame] | 653 | |
Rajesh Bhagat | a421625 | 2018-01-17 16:13:09 +0530 | [diff] [blame] | 654 | int i2c_multiplexer_select_vid_channel(u8 channel) |
| 655 | { |
Stephen Carlson | 267ddcc | 2021-06-22 16:41:38 -0700 | [diff] [blame] | 656 | return select_i2c_ch_pca9547(channel, 0); |
Rajesh Bhagat | a421625 | 2018-01-17 16:13:09 +0530 | [diff] [blame] | 657 | } |
| 658 | |
| 659 | #ifdef CONFIG_TARGET_LS1088AQDS |
| 660 | /* read the current value(SVDD) of the LTM Regulator Voltage */ |
| 661 | int get_serdes_volt(void) |
| 662 | { |
| 663 | int ret, vcode = 0; |
| 664 | u8 chan = PWM_CHANNEL0; |
| 665 | |
| 666 | /* Select the PAGE 0 using PMBus commands PAGE for VDD */ |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 667 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Rajesh Bhagat | a421625 | 2018-01-17 16:13:09 +0530 | [diff] [blame] | 668 | ret = i2c_write(I2C_SVDD_MONITOR_ADDR, |
| 669 | PMBUS_CMD_PAGE, 1, &chan, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 670 | #else |
| 671 | struct udevice *dev; |
| 672 | |
| 673 | ret = i2c_get_chip_for_busnum(0, I2C_SVDD_MONITOR_ADDR, 1, &dev); |
| 674 | if (!ret) |
| 675 | ret = dm_i2c_write(dev, PMBUS_CMD_PAGE, |
| 676 | &chan, 1); |
| 677 | #endif |
| 678 | |
Rajesh Bhagat | a421625 | 2018-01-17 16:13:09 +0530 | [diff] [blame] | 679 | if (ret) { |
| 680 | printf("VID: failed to select VDD Page 0\n"); |
| 681 | return ret; |
| 682 | } |
| 683 | |
| 684 | /* Read the output voltage using PMBus command READ_VOUT */ |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 685 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Rajesh Bhagat | a421625 | 2018-01-17 16:13:09 +0530 | [diff] [blame] | 686 | ret = i2c_read(I2C_SVDD_MONITOR_ADDR, |
| 687 | PMBUS_CMD_READ_VOUT, 1, (void *)&vcode, 2); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 688 | #else |
| 689 | dm_i2c_read(dev, PMBUS_CMD_READ_VOUT, (void *)&vcode, 2); |
| 690 | #endif |
Rajesh Bhagat | a421625 | 2018-01-17 16:13:09 +0530 | [diff] [blame] | 691 | if (ret) { |
| 692 | printf("VID: failed to read the volatge\n"); |
| 693 | return ret; |
| 694 | } |
| 695 | |
| 696 | return vcode; |
| 697 | } |
| 698 | |
| 699 | int set_serdes_volt(int svdd) |
| 700 | { |
| 701 | int ret, vdd_last; |
| 702 | u8 buff[5] = {0x04, PWM_CHANNEL0, PMBUS_CMD_VOUT_COMMAND, |
| 703 | svdd & 0xFF, (svdd & 0xFF00) >> 8}; |
| 704 | |
| 705 | /* Write the desired voltage code to the SVDD regulator */ |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 706 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Rajesh Bhagat | a421625 | 2018-01-17 16:13:09 +0530 | [diff] [blame] | 707 | ret = i2c_write(I2C_SVDD_MONITOR_ADDR, |
| 708 | PMBUS_CMD_PAGE_PLUS_WRITE, 1, (void *)&buff, 5); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 709 | #else |
| 710 | struct udevice *dev; |
| 711 | |
| 712 | ret = i2c_get_chip_for_busnum(0, I2C_SVDD_MONITOR_ADDR, 1, &dev); |
| 713 | if (!ret) |
| 714 | ret = dm_i2c_write(dev, PMBUS_CMD_PAGE_PLUS_WRITE, |
| 715 | (void *)&buff, 5); |
| 716 | #endif |
Rajesh Bhagat | a421625 | 2018-01-17 16:13:09 +0530 | [diff] [blame] | 717 | if (ret) { |
| 718 | printf("VID: I2C failed to write to the volatge regulator\n"); |
| 719 | return -1; |
| 720 | } |
| 721 | |
| 722 | /* Wait for the volatge to get to the desired value */ |
| 723 | do { |
| 724 | vdd_last = get_serdes_volt(); |
| 725 | if (vdd_last < 0) { |
| 726 | printf("VID: Couldn't read sensor abort VID adjust\n"); |
| 727 | return -1; |
| 728 | } |
| 729 | } while (vdd_last != svdd); |
| 730 | |
| 731 | return 1; |
| 732 | } |
| 733 | #else |
| 734 | int get_serdes_volt(void) |
| 735 | { |
| 736 | return 0; |
| 737 | } |
| 738 | |
| 739 | int set_serdes_volt(int svdd) |
| 740 | { |
| 741 | int ret; |
| 742 | u8 brdcfg4; |
| 743 | |
| 744 | printf("SVDD changing of RDB\n"); |
| 745 | |
| 746 | /* Read the BRDCFG54 via CLPD */ |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 747 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Rajesh Bhagat | a421625 | 2018-01-17 16:13:09 +0530 | [diff] [blame] | 748 | ret = i2c_read(CONFIG_SYS_I2C_FPGA_ADDR, |
| 749 | QIXIS_BRDCFG4_OFFSET, 1, (void *)&brdcfg4, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 750 | #else |
| 751 | struct udevice *dev; |
| 752 | |
| 753 | ret = i2c_get_chip_for_busnum(0, CONFIG_SYS_I2C_FPGA_ADDR, 1, &dev); |
| 754 | if (!ret) |
| 755 | ret = dm_i2c_read(dev, QIXIS_BRDCFG4_OFFSET, |
| 756 | (void *)&brdcfg4, 1); |
| 757 | #endif |
| 758 | |
Rajesh Bhagat | a421625 | 2018-01-17 16:13:09 +0530 | [diff] [blame] | 759 | if (ret) { |
| 760 | printf("VID: I2C failed to read the CPLD BRDCFG4\n"); |
| 761 | return -1; |
| 762 | } |
| 763 | |
| 764 | brdcfg4 = brdcfg4 | 0x08; |
| 765 | |
| 766 | /* Write to the BRDCFG4 */ |
Igor Opaniuk | f7c9176 | 2021-02-09 13:52:45 +0200 | [diff] [blame] | 767 | #if !CONFIG_IS_ENABLED(DM_I2C) |
Rajesh Bhagat | a421625 | 2018-01-17 16:13:09 +0530 | [diff] [blame] | 768 | ret = i2c_write(CONFIG_SYS_I2C_FPGA_ADDR, |
| 769 | QIXIS_BRDCFG4_OFFSET, 1, (void *)&brdcfg4, 1); |
Chuanhua Han | 8a89846 | 2019-07-23 18:43:11 +0800 | [diff] [blame] | 770 | #else |
| 771 | ret = dm_i2c_write(dev, QIXIS_BRDCFG4_OFFSET, |
| 772 | (void *)&brdcfg4, 1); |
| 773 | #endif |
| 774 | |
Rajesh Bhagat | a421625 | 2018-01-17 16:13:09 +0530 | [diff] [blame] | 775 | if (ret) { |
| 776 | debug("VID: I2C failed to set the SVDD CPLD BRDCFG4\n"); |
| 777 | return -1; |
| 778 | } |
| 779 | |
| 780 | /* Wait for the volatge to get to the desired value */ |
| 781 | udelay(10000); |
| 782 | |
| 783 | return 1; |
| 784 | } |
| 785 | #endif |
| 786 | |
| 787 | /* this function disables the SERDES, changes the SVDD Voltage and enables it*/ |
| 788 | int board_adjust_vdd(int vdd) |
| 789 | { |
| 790 | int ret = 0; |
| 791 | |
| 792 | debug("%s: vdd = %d\n", __func__, vdd); |
| 793 | |
| 794 | /* Special settings to be performed when voltage is 900mV */ |
| 795 | if (vdd == 900) { |
| 796 | ret = setup_serdes_volt(vdd); |
| 797 | if (ret < 0) { |
| 798 | ret = -1; |
| 799 | goto exit; |
| 800 | } |
| 801 | } |
| 802 | exit: |
| 803 | return ret; |
| 804 | } |
| 805 | |
Rajesh Bhagat | 6d809b8 | 2018-01-17 16:13:10 +0530 | [diff] [blame] | 806 | #if !defined(CONFIG_SPL_BUILD) |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 807 | int board_init(void) |
| 808 | { |
| 809 | init_final_memctl_regs(); |
| 810 | #if defined(CONFIG_TARGET_LS1088ARDB) && defined(CONFIG_FSL_MC_ENET) |
| 811 | u32 __iomem *irq_ccsr = (u32 __iomem *)ISC_BASE; |
| 812 | #endif |
| 813 | |
Stephen Carlson | 267ddcc | 2021-06-22 16:41:38 -0700 | [diff] [blame] | 814 | select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT, 0); |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 815 | board_retimer_init(); |
| 816 | |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 817 | #if defined(CONFIG_TARGET_LS1088ARDB) && defined(CONFIG_FSL_MC_ENET) |
| 818 | /* invert AQR105 IRQ pins polarity */ |
| 819 | out_le32(irq_ccsr + IRQCR_OFFSET / 4, AQR105_IRQ_MASK); |
| 820 | #endif |
| 821 | |
| 822 | #ifdef CONFIG_FSL_LS_PPA |
| 823 | ppa_init(); |
| 824 | #endif |
Ioana Ciornei | 5d955a6 | 2020-03-18 16:47:39 +0200 | [diff] [blame] | 825 | |
| 826 | #if !defined(CONFIG_SYS_EARLY_PCI_INIT) && defined(CONFIG_DM_ETH) |
| 827 | pci_init(); |
| 828 | #endif |
| 829 | |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 830 | return 0; |
| 831 | } |
| 832 | |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 833 | void detail_board_ddr_info(void) |
| 834 | { |
| 835 | puts("\nDDR "); |
| 836 | print_size(gd->bd->bi_dram[0].size + gd->bd->bi_dram[1].size, ""); |
| 837 | print_ddr_info(0); |
| 838 | } |
| 839 | |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 840 | #ifdef CONFIG_FSL_MC_ENET |
Mian Yousaf Kaukab | e1dabf0 | 2019-01-29 16:38:30 +0100 | [diff] [blame] | 841 | void board_quiesce_devices(void) |
| 842 | { |
| 843 | fsl_mc_ldpaa_exit(gd->bd); |
| 844 | } |
| 845 | |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 846 | void fdt_fixup_board_enet(void *fdt) |
| 847 | { |
| 848 | int offset; |
| 849 | |
| 850 | offset = fdt_path_offset(fdt, "/fsl-mc"); |
| 851 | |
| 852 | if (offset < 0) |
Mian Yousaf Kaukab | 775c091 | 2019-01-29 16:38:31 +0100 | [diff] [blame] | 853 | offset = fdt_path_offset(fdt, "/soc/fsl-mc"); |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 854 | |
| 855 | if (offset < 0) { |
| 856 | printf("%s: ERROR: fsl-mc node not found in device tree (error %d)\n", |
| 857 | __func__, offset); |
| 858 | return; |
| 859 | } |
| 860 | |
Mian Yousaf Kaukab | 9712465 | 2018-12-18 14:01:17 +0100 | [diff] [blame] | 861 | if (get_mc_boot_status() == 0 && |
| 862 | (is_lazy_dpl_addr_valid() || get_dpl_apply_status() == 0)) |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 863 | fdt_status_okay(fdt, offset); |
| 864 | else |
| 865 | fdt_status_fail(fdt, offset); |
| 866 | } |
| 867 | #endif |
| 868 | |
| 869 | #ifdef CONFIG_OF_BOARD_SETUP |
Ashish Kumar | ff12b8a | 2017-11-09 11:14:24 +0530 | [diff] [blame] | 870 | void fsl_fdt_fixup_flash(void *fdt) |
| 871 | { |
| 872 | int offset; |
Pankit Garg | f5c2a83 | 2018-12-27 04:37:55 +0000 | [diff] [blame] | 873 | #ifdef CONFIG_TFABOOT |
| 874 | u32 __iomem *dcfg_ccsr = (u32 __iomem *)DCFG_BASE; |
| 875 | u32 val; |
| 876 | #endif |
Ashish Kumar | ff12b8a | 2017-11-09 11:14:24 +0530 | [diff] [blame] | 877 | |
| 878 | /* |
| 879 | * IFC-NOR and QSPI are muxed on SoC. |
| 880 | * So disable IFC node in dts if QSPI is enabled or |
| 881 | * disable QSPI node in dts in case QSPI is not enabled. |
| 882 | */ |
| 883 | |
Pankit Garg | f5c2a83 | 2018-12-27 04:37:55 +0000 | [diff] [blame] | 884 | #ifdef CONFIG_TFABOOT |
| 885 | enum boot_src src = get_boot_src(); |
| 886 | bool disable_ifc = false; |
| 887 | |
| 888 | switch (src) { |
| 889 | case BOOT_SOURCE_IFC_NOR: |
| 890 | disable_ifc = false; |
| 891 | break; |
| 892 | case BOOT_SOURCE_QSPI_NOR: |
| 893 | disable_ifc = true; |
| 894 | break; |
| 895 | default: |
| 896 | val = in_le32(dcfg_ccsr + DCFG_RCWSR15 / 4); |
| 897 | if (DCFG_RCWSR15_IFCGRPABASE_QSPI == (val & (u32)0x3)) |
| 898 | disable_ifc = true; |
| 899 | break; |
| 900 | } |
| 901 | |
| 902 | if (disable_ifc) { |
Jianpeng Bu | f9648b6 | 2022-01-31 18:42:36 +0530 | [diff] [blame] | 903 | offset = fdt_path_offset(fdt, "/soc/memory-controller/nor"); |
Pankit Garg | f5c2a83 | 2018-12-27 04:37:55 +0000 | [diff] [blame] | 904 | |
| 905 | if (offset < 0) |
Jianpeng Bu | f9648b6 | 2022-01-31 18:42:36 +0530 | [diff] [blame] | 906 | offset = fdt_path_offset(fdt, "/memory-controller/nor"); |
Pankit Garg | f5c2a83 | 2018-12-27 04:37:55 +0000 | [diff] [blame] | 907 | } else { |
| 908 | offset = fdt_path_offset(fdt, "/soc/quadspi"); |
| 909 | |
| 910 | if (offset < 0) |
| 911 | offset = fdt_path_offset(fdt, "/quadspi"); |
| 912 | } |
| 913 | |
| 914 | #else |
Ashish Kumar | ff12b8a | 2017-11-09 11:14:24 +0530 | [diff] [blame] | 915 | #ifdef CONFIG_FSL_QSPI |
Jianpeng Bu | f9648b6 | 2022-01-31 18:42:36 +0530 | [diff] [blame] | 916 | offset = fdt_path_offset(fdt, "/soc/memory-controller/nor"); |
Ashish Kumar | ff12b8a | 2017-11-09 11:14:24 +0530 | [diff] [blame] | 917 | |
| 918 | if (offset < 0) |
Jianpeng Bu | f9648b6 | 2022-01-31 18:42:36 +0530 | [diff] [blame] | 919 | offset = fdt_path_offset(fdt, "/memory-controller/nor"); |
Ashish Kumar | ff12b8a | 2017-11-09 11:14:24 +0530 | [diff] [blame] | 920 | #else |
| 921 | offset = fdt_path_offset(fdt, "/soc/quadspi"); |
| 922 | |
| 923 | if (offset < 0) |
| 924 | offset = fdt_path_offset(fdt, "/quadspi"); |
| 925 | #endif |
Pankit Garg | f5c2a83 | 2018-12-27 04:37:55 +0000 | [diff] [blame] | 926 | #endif |
Ashish Kumar | ff12b8a | 2017-11-09 11:14:24 +0530 | [diff] [blame] | 927 | if (offset < 0) |
| 928 | return; |
| 929 | |
| 930 | fdt_status_disabled(fdt, offset); |
| 931 | } |
| 932 | |
Masahiro Yamada | f7ed78b | 2020-06-26 15:13:33 +0900 | [diff] [blame] | 933 | int ft_board_setup(void *blob, struct bd_info *bd) |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 934 | { |
Mian Yousaf Kaukab | e1dabf0 | 2019-01-29 16:38:30 +0100 | [diff] [blame] | 935 | int i; |
Meenakshi Aggarwal | d67ae48 | 2019-05-23 15:13:43 +0530 | [diff] [blame] | 936 | u16 mc_memory_bank = 0; |
| 937 | |
| 938 | u64 *base; |
| 939 | u64 *size; |
| 940 | u64 mc_memory_base = 0; |
| 941 | u64 mc_memory_size = 0; |
| 942 | u16 total_memory_banks; |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 943 | |
| 944 | ft_cpu_setup(blob, bd); |
| 945 | |
Meenakshi Aggarwal | d67ae48 | 2019-05-23 15:13:43 +0530 | [diff] [blame] | 946 | fdt_fixup_mc_ddr(&mc_memory_base, &mc_memory_size); |
| 947 | |
| 948 | if (mc_memory_base != 0) |
| 949 | mc_memory_bank++; |
| 950 | |
| 951 | total_memory_banks = CONFIG_NR_DRAM_BANKS + mc_memory_bank; |
| 952 | |
| 953 | base = calloc(total_memory_banks, sizeof(u64)); |
| 954 | size = calloc(total_memory_banks, sizeof(u64)); |
| 955 | |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 956 | /* fixup DT for the two GPP DDR banks */ |
| 957 | for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { |
| 958 | base[i] = gd->bd->bi_dram[i].start; |
| 959 | size[i] = gd->bd->bi_dram[i].size; |
| 960 | } |
| 961 | |
| 962 | #ifdef CONFIG_RESV_RAM |
| 963 | /* reduce size if reserved memory is within this bank */ |
| 964 | if (gd->arch.resv_ram >= base[0] && |
| 965 | gd->arch.resv_ram < base[0] + size[0]) |
| 966 | size[0] = gd->arch.resv_ram - base[0]; |
| 967 | else if (gd->arch.resv_ram >= base[1] && |
| 968 | gd->arch.resv_ram < base[1] + size[1]) |
| 969 | size[1] = gd->arch.resv_ram - base[1]; |
| 970 | #endif |
| 971 | |
Meenakshi Aggarwal | d67ae48 | 2019-05-23 15:13:43 +0530 | [diff] [blame] | 972 | if (mc_memory_base != 0) { |
| 973 | for (i = 0; i <= total_memory_banks; i++) { |
| 974 | if (base[i] == 0 && size[i] == 0) { |
| 975 | base[i] = mc_memory_base; |
| 976 | size[i] = mc_memory_size; |
| 977 | break; |
| 978 | } |
| 979 | } |
| 980 | } |
| 981 | |
| 982 | fdt_fixup_memory_banks(blob, base, size, total_memory_banks); |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 983 | |
Nipun Gupta | d691264 | 2018-08-20 16:01:14 +0530 | [diff] [blame] | 984 | fdt_fsl_mc_fixup_iommu_map_entry(blob); |
| 985 | |
Ashish Kumar | ff12b8a | 2017-11-09 11:14:24 +0530 | [diff] [blame] | 986 | fsl_fdt_fixup_flash(blob); |
| 987 | |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 988 | #ifdef CONFIG_FSL_MC_ENET |
| 989 | fdt_fixup_board_enet(blob); |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 990 | #endif |
Laurentiu Tudor | 7690ea7 | 2019-07-30 17:29:58 +0300 | [diff] [blame] | 991 | |
| 992 | fdt_fixup_icid(blob); |
| 993 | |
Pramod Kumar | a053182 | 2018-10-12 14:04:27 +0000 | [diff] [blame] | 994 | if (is_pb_board()) |
| 995 | fixup_ls1088ardb_pb_banner(blob); |
Ashish Kumar | 227b4bc | 2017-08-31 16:12:54 +0530 | [diff] [blame] | 996 | |
| 997 | return 0; |
| 998 | } |
| 999 | #endif |
Sumit Garg | 08da8b2 | 2018-01-06 09:04:24 +0530 | [diff] [blame] | 1000 | #endif /* defined(CONFIG_SPL_BUILD) */ |
Pankit Garg | f5c2a83 | 2018-12-27 04:37:55 +0000 | [diff] [blame] | 1001 | |
| 1002 | #ifdef CONFIG_TFABOOT |
| 1003 | #ifdef CONFIG_MTD_NOR_FLASH |
| 1004 | int is_flash_available(void) |
| 1005 | { |
| 1006 | char *env_hwconfig = env_get("hwconfig"); |
| 1007 | enum boot_src src = get_boot_src(); |
| 1008 | int is_nor_flash_available = 1; |
| 1009 | |
| 1010 | switch (src) { |
| 1011 | case BOOT_SOURCE_IFC_NOR: |
| 1012 | is_nor_flash_available = 1; |
| 1013 | break; |
| 1014 | case BOOT_SOURCE_QSPI_NOR: |
| 1015 | is_nor_flash_available = 0; |
| 1016 | break; |
| 1017 | /* |
| 1018 | * In Case of SD boot,if qspi is defined in env_hwconfig |
| 1019 | * disable nor flash probe. |
| 1020 | */ |
| 1021 | default: |
| 1022 | if (hwconfig_f("qspi", env_hwconfig)) |
| 1023 | is_nor_flash_available = 0; |
| 1024 | break; |
| 1025 | } |
| 1026 | return is_nor_flash_available; |
| 1027 | } |
| 1028 | #endif |
| 1029 | |
Tom Rini | 0543c43 | 2019-11-18 20:02:08 -0500 | [diff] [blame] | 1030 | #ifdef CONFIG_ENV_IS_IN_SPI_FLASH |
Pankit Garg | f5c2a83 | 2018-12-27 04:37:55 +0000 | [diff] [blame] | 1031 | void *env_sf_get_env_addr(void) |
| 1032 | { |
| 1033 | return (void *)(CONFIG_SYS_FSL_QSPI_BASE + CONFIG_ENV_OFFSET); |
| 1034 | } |
| 1035 | #endif |
Tom Rini | 0543c43 | 2019-11-18 20:02:08 -0500 | [diff] [blame] | 1036 | #endif |