1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2017-2018 NXP
16 #include <asm/global_data.h>
18 #include <fdt_support.h>
19 #include <linux/delay.h>
20 #include <linux/libfdt.h>
21 #include <fsl-mc/fsl_mc.h>
22 #include <env_internal.h>
23 #include <asm/arch-fsl-layerscape/soc.h>
24 #include <asm/arch/ppa.h>
26 #include <asm/arch/fsl_serdes.h>
27 #include <asm/arch/soc.h>
28 #include <asm/arch-fsl-layerscape/fsl_icid.h>
30 #include "../common/qixis.h"
31 #include "ls1088a_qixis.h"
32 #include "../common/vid.h"
33 #include <fsl_immap.h>
35 DECLARE_GLOBAL_DATA_PTR;
37 #ifdef CONFIG_TARGET_LS1088AQDS
39 struct ifc_regs ifc_cfg_ifc_nor_boot[CONFIG_SYS_FSL_IFC_BANK_COUNT] = {
42 CONFIG_SYS_NOR0_CSPR_EARLY,
43 CONFIG_SYS_NOR0_CSPR_EXT,
58 CONFIG_SYS_NOR1_CSPR_EARLY,
59 CONFIG_SYS_NOR0_CSPR_EXT,
60 CONFIG_SYS_NOR_AMASK_EARLY,
75 CONFIG_SYS_NAND_CSPR_EXT,
76 CONFIG_SYS_NAND_AMASK,
79 CONFIG_SYS_NAND_FTIM0,
80 CONFIG_SYS_NAND_FTIM1,
81 CONFIG_SYS_NAND_FTIM2,
88 CONFIG_SYS_FPGA_CSPR_EXT,
103 struct ifc_regs ifc_cfg_qspi_nor_boot[CONFIG_SYS_FSL_IFC_BANK_COUNT] = {
106 CONFIG_SYS_NAND_CSPR,
107 CONFIG_SYS_NAND_CSPR_EXT,
108 CONFIG_SYS_NAND_AMASK,
109 CONFIG_SYS_NAND_CSOR,
111 CONFIG_SYS_NAND_FTIM0,
112 CONFIG_SYS_NAND_FTIM1,
113 CONFIG_SYS_NAND_FTIM2,
114 CONFIG_SYS_NAND_FTIM3
122 CONFIG_SYS_FPGA_CSPR,
123 CONFIG_SYS_FPGA_CSPR_EXT,
125 CONFIG_SYS_FPGA_CSOR,
138 void ifc_cfg_boot_info(struct ifc_regs_info *regs_info)
140 enum boot_src src = get_boot_src();
142 if (src == BOOT_SOURCE_QSPI_NOR)
143 regs_info->regs = ifc_cfg_qspi_nor_boot;
145 regs_info->regs = ifc_cfg_ifc_nor_boot;
147 regs_info->cs_size = CONFIG_SYS_FSL_IFC_BANK_COUNT;
149 #endif /* CONFIG_TFABOOT */
150 #endif /* CONFIG_TARGET_LS1088AQDS */
152 int board_early_init_f(void)
154 #if defined(CONFIG_SYS_I2C_EARLY_INIT) && defined(CONFIG_TARGET_LS1088AQDS)
157 fsl_lsch3_early_init_f();
161 #ifdef CONFIG_FSL_QIXIS
162 unsigned long long get_qixis_addr(void)
164 unsigned long long addr;
166 if (gd->flags & GD_FLG_RELOC)
167 addr = QIXIS_BASE_PHYS;
169 addr = QIXIS_BASE_PHYS_EARLY;
172 * IFC address under 256MB is mapped to 0x30000000, any address above
173 * is mapped to 0x5_10000000 up to 4GB.
175 addr = addr > 0x10000000 ? addr + 0x500000000ULL : addr + 0x30000000;
181 #if defined(CONFIG_VID)
182 int init_func_vid(void)
184 if (adjust_vdd(0) < 0)
185 printf("core voltage not adjusted\n");
190 u16 soc_get_fuse_vid(int vid_index)
192 static const u16 vdd[32] = {
227 return vdd[vid_index];
231 int is_pb_board(void)
235 board_id = QIXIS_READ(id);
236 if (board_id == LS1088ARDB_PB_BOARD)
242 int fixup_ls1088ardb_pb_banner(void *fdt)
244 fdt_setprop_string(fdt, 0, "model", "LS1088ARDB-PB Board");
249 #if !defined(CONFIG_SPL_BUILD)
252 #ifdef CONFIG_TFABOOT
253 enum boot_src src = get_boot_src();
257 static const char *const freq[] = {"100", "125", "156.25",
258 "100 separate SSCG"};
261 #ifdef CONFIG_TARGET_LS1088AQDS
262 printf("Board: LS1088A-QDS, ");
265 printf("Board: LS1088ARDB-PB, ");
267 printf("Board: LS1088A-RDB, ");
270 sw = QIXIS_READ(arch);
271 printf("Board Arch: V%d, ", sw >> 4);
273 #ifdef CONFIG_TARGET_LS1088AQDS
274 printf("Board version: %c, boot from ", (sw & 0xf) + 'A' - 1);
276 printf("Board version: %c, boot from ", (sw & 0xf) + 'A');
279 memset((u8 *)buf, 0x00, ARRAY_SIZE(buf));
281 sw = QIXIS_READ(brdcfg[0]);
282 sw = (sw & QIXIS_LBMAP_MASK) >> QIXIS_LBMAP_SHIFT;
284 #ifdef CONFIG_TFABOOT
285 if (src == BOOT_SOURCE_SD_MMC)
288 #ifdef CONFIG_SD_BOOT
291 #endif /* CONFIG_TFABOOT */
293 #ifdef CONFIG_TARGET_LS1088AQDS
302 printf("vBank: %d\n", sw);
315 sw = QIXIS_READ(brdcfg[0]);
316 sw = (sw & QIXIS_QMAP_MASK) >> QIXIS_QMAP_SHIFT;
317 if (sw == 0 || sw == 4)
326 printf("invalid setting of SW%u\n", QIXIS_LBMAP_SWITCH);
330 #ifdef CONFIG_TARGET_LS1088AQDS
331 printf("FPGA: v%d (%s), build %d",
332 (int)QIXIS_READ(scver), qixis_read_tag(buf),
333 (int)qixis_read_minor());
334 /* the timestamp string contains "\n" at the end */
335 printf(" on %s", qixis_read_time(buf));
337 printf("CPLD: v%d.%d\n", QIXIS_READ(scver), QIXIS_READ(tagdata));
341 * Display the actual SERDES reference clocks as configured by the
342 * dip switches on the board. Note that the SWx registers could
343 * technically be set to force the reference clocks to match the
344 * values that the SERDES expects (or vice versa). For now, however,
345 * we just display both values and hope the user notices when they
348 puts("SERDES1 Reference : ");
349 sw = QIXIS_READ(brdcfg[2]);
350 clock = (sw >> 6) & 3;
351 printf("Clock1 = %sMHz ", freq[clock]);
352 clock = (sw >> 4) & 3;
353 printf("Clock2 = %sMHz", freq[clock]);
355 puts("\nSERDES2 Reference : ");
356 clock = (sw >> 2) & 3;
357 printf("Clock1 = %sMHz ", freq[clock]);
358 clock = (sw >> 0) & 3;
359 printf("Clock2 = %sMHz\n", freq[clock]);
365 bool if_board_diff_clk(void)
367 #ifdef CONFIG_TARGET_LS1088AQDS
368 u8 diff_conf = QIXIS_READ(brdcfg[11]);
369 return diff_conf & 0x40;
371 u8 diff_conf = QIXIS_READ(dutcfg[11]);
372 return diff_conf & 0x80;
376 unsigned long get_board_sys_clk(void)
378 u8 sysclk_conf = QIXIS_READ(brdcfg[1]);
380 switch (sysclk_conf & 0x0f) {
381 case QIXIS_SYSCLK_83:
383 case QIXIS_SYSCLK_100:
385 case QIXIS_SYSCLK_125:
387 case QIXIS_SYSCLK_133:
389 case QIXIS_SYSCLK_150:
391 case QIXIS_SYSCLK_160:
393 case QIXIS_SYSCLK_166:
400 unsigned long get_board_ddr_clk(void)
402 u8 ddrclk_conf = QIXIS_READ(brdcfg[1]);
404 if (if_board_diff_clk())
405 return get_board_sys_clk();
406 switch ((ddrclk_conf & 0x30) >> 4) {
407 case QIXIS_DDRCLK_100:
409 case QIXIS_DDRCLK_125:
411 case QIXIS_DDRCLK_133:
418 int select_i2c_ch_pca9547(u8 ch)
422 #if !CONFIG_IS_ENABLED(DM_I2C)
423 ret = i2c_write(I2C_MUX_PCA_ADDR_PRI, 0, 1, &ch, 1);
427 ret = i2c_get_chip_for_busnum(0, I2C_MUX_PCA_ADDR_PRI, 1, &dev);
429 ret = dm_i2c_write(dev, 0, &ch, 1);
432 puts("PCA: failed to select proper channel\n");
439 #if !defined(CONFIG_SPL_BUILD)
440 void board_retimer_init(void)
444 /* Retimer is connected to I2C1_CH5 */
445 select_i2c_ch_pca9547(I2C_MUX_CH5);
447 /* Access to Control/Shared register */
449 #if !CONFIG_IS_ENABLED(DM_I2C)
450 i2c_write(I2C_RETIMER_ADDR, 0xff, 1, ®, 1);
454 i2c_get_chip_for_busnum(0, I2C_RETIMER_ADDR, 1, &dev);
455 dm_i2c_write(dev, 0xff, ®, 1);
458 /* Read device revision and ID */
459 #if !CONFIG_IS_ENABLED(DM_I2C)
460 i2c_read(I2C_RETIMER_ADDR, 1, 1, ®, 1);
462 dm_i2c_read(dev, 1, ®, 1);
464 debug("Retimer version id = 0x%x\n", reg);
466 /* Enable Broadcast. All writes target all channel register sets */
468 #if !CONFIG_IS_ENABLED(DM_I2C)
469 i2c_write(I2C_RETIMER_ADDR, 0xff, 1, ®, 1);
471 dm_i2c_write(dev, 0xff, ®, 1);
474 /* Reset Channel Registers */
475 #if !CONFIG_IS_ENABLED(DM_I2C)
476 i2c_read(I2C_RETIMER_ADDR, 0, 1, ®, 1);
478 dm_i2c_read(dev, 0, ®, 1);
481 #if !CONFIG_IS_ENABLED(DM_I2C)
482 i2c_write(I2C_RETIMER_ADDR, 0, 1, ®, 1);
484 dm_i2c_write(dev, 0, ®, 1);
487 /* Set data rate as 10.3125 Gbps */
489 #if !CONFIG_IS_ENABLED(DM_I2C)
490 i2c_write(I2C_RETIMER_ADDR, 0x60, 1, ®, 1);
492 dm_i2c_write(dev, 0x60, ®, 1);
495 #if !CONFIG_IS_ENABLED(DM_I2C)
496 i2c_write(I2C_RETIMER_ADDR, 0x61, 1, ®, 1);
498 dm_i2c_write(dev, 0x61, ®, 1);
501 #if !CONFIG_IS_ENABLED(DM_I2C)
502 i2c_write(I2C_RETIMER_ADDR, 0x62, 1, ®, 1);
504 dm_i2c_write(dev, 0x62, ®, 1);
507 #if !CONFIG_IS_ENABLED(DM_I2C)
508 i2c_write(I2C_RETIMER_ADDR, 0x63, 1, ®, 1);
510 dm_i2c_write(dev, 0x63, ®, 1);
513 #if !CONFIG_IS_ENABLED(DM_I2C)
514 i2c_write(I2C_RETIMER_ADDR, 0x64, 1, ®, 1);
516 dm_i2c_write(dev, 0x64, ®, 1);
519 /* Select VCO Divider to full rate (000) */
520 #if !CONFIG_IS_ENABLED(DM_I2C)
521 i2c_read(I2C_RETIMER_ADDR, 0x2F, 1, ®, 1);
523 dm_i2c_read(dev, 0x2F, ®, 1);
527 #if !CONFIG_IS_ENABLED(DM_I2C)
528 i2c_write(I2C_RETIMER_ADDR, 0x2F, 1, ®, 1);
530 dm_i2c_write(dev, 0x2F, ®, 1);
533 #ifdef CONFIG_TARGET_LS1088AQDS
534 /* Retimer is connected to I2C1_CH5 */
535 select_i2c_ch_pca9547(I2C_MUX_CH5);
537 /* Access to Control/Shared register */
539 #if !CONFIG_IS_ENABLED(DM_I2C)
540 i2c_write(I2C_RETIMER_ADDR2, 0xff, 1, ®, 1);
542 i2c_get_chip_for_busnum(0, I2C_RETIMER_ADDR2, 1, &dev);
543 dm_i2c_write(dev, 0xff, ®, 1);
546 /* Read device revision and ID */
547 #if !CONFIG_IS_ENABLED(DM_I2C)
548 i2c_read(I2C_RETIMER_ADDR2, 1, 1, ®, 1);
550 dm_i2c_read(dev, 1, ®, 1);
552 debug("Retimer version id = 0x%x\n", reg);
554 /* Enable Broadcast. All writes target all channel register sets */
556 #if !CONFIG_IS_ENABLED(DM_I2C)
557 i2c_write(I2C_RETIMER_ADDR2, 0xff, 1, ®, 1);
559 dm_i2c_write(dev, 0xff, ®, 1);
562 /* Reset Channel Registers */
563 #if !CONFIG_IS_ENABLED(DM_I2C)
564 i2c_read(I2C_RETIMER_ADDR2, 0, 1, ®, 1);
566 dm_i2c_read(dev, 0, ®, 1);
569 #if !CONFIG_IS_ENABLED(DM_I2C)
570 i2c_write(I2C_RETIMER_ADDR2, 0, 1, ®, 1);
572 dm_i2c_write(dev, 0, ®, 1);
575 /* Set data rate as 10.3125 Gbps */
577 #if !CONFIG_IS_ENABLED(DM_I2C)
578 i2c_write(I2C_RETIMER_ADDR2, 0x60, 1, ®, 1);
580 dm_i2c_write(dev, 0x60, ®, 1);
583 #if !CONFIG_IS_ENABLED(DM_I2C)
584 i2c_write(I2C_RETIMER_ADDR2, 0x61, 1, ®, 1);
586 dm_i2c_write(dev, 0x61, ®, 1);
589 #if !CONFIG_IS_ENABLED(DM_I2C)
590 i2c_write(I2C_RETIMER_ADDR2, 0x62, 1, ®, 1);
592 dm_i2c_write(dev, 0x62, ®, 1);
595 #if !CONFIG_IS_ENABLED(DM_I2C)
596 i2c_write(I2C_RETIMER_ADDR2, 0x63, 1, ®, 1);
598 dm_i2c_write(dev, 0x63, ®, 1);
601 #if !CONFIG_IS_ENABLED(DM_I2C)
602 i2c_write(I2C_RETIMER_ADDR2, 0x64, 1, ®, 1);
604 dm_i2c_write(dev, 0x64, ®, 1);
607 /* Select VCO Divider to full rate (000) */
608 #if !CONFIG_IS_ENABLED(DM_I2C)
609 i2c_read(I2C_RETIMER_ADDR2, 0x2F, 1, ®, 1);
611 dm_i2c_read(dev, 0x2F, ®, 1);
615 #if !CONFIG_IS_ENABLED(DM_I2C)
616 i2c_write(I2C_RETIMER_ADDR2, 0x2F, 1, ®, 1);
618 dm_i2c_write(dev, 0x2F, ®, 1);
622 /*return the default channel*/
623 select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
626 #ifdef CONFIG_MISC_INIT_R
627 int misc_init_r(void)
629 #ifdef CONFIG_TARGET_LS1088ARDB
632 if (hwconfig("esdhc-force-sd")) {
633 brdcfg5 = QIXIS_READ(brdcfg[5]);
634 brdcfg5 &= ~BRDCFG5_SPISDHC_MASK;
635 brdcfg5 |= BRDCFG5_FORCE_SD;
636 QIXIS_WRITE(brdcfg[5], brdcfg5);
640 #ifdef CONFIG_TARGET_LS1088AQDS
643 if (hwconfig("dspi-on-board")) {
644 brdcfg4 = QIXIS_READ(brdcfg[4]);
645 brdcfg4 &= ~BRDCFG4_USBOSC_MASK;
646 brdcfg4 |= BRDCFG4_SPI;
647 QIXIS_WRITE(brdcfg[4], brdcfg4);
649 brdcfg5 = QIXIS_READ(brdcfg[5]);
650 brdcfg5 &= ~BRDCFG5_SPR_MASK;
651 brdcfg5 |= BRDCFG5_SPI_ON_BOARD;
652 QIXIS_WRITE(brdcfg[5], brdcfg5);
653 } else if (hwconfig("dspi-off-board")) {
654 brdcfg4 = QIXIS_READ(brdcfg[4]);
655 brdcfg4 &= ~BRDCFG4_USBOSC_MASK;
656 brdcfg4 |= BRDCFG4_SPI;
657 QIXIS_WRITE(brdcfg[4], brdcfg4);
659 brdcfg5 = QIXIS_READ(brdcfg[5]);
660 brdcfg5 &= ~BRDCFG5_SPR_MASK;
661 brdcfg5 |= BRDCFG5_SPI_OFF_BOARD;
662 QIXIS_WRITE(brdcfg[5], brdcfg5);
670 int i2c_multiplexer_select_vid_channel(u8 channel)
672 return select_i2c_ch_pca9547(channel);
675 #ifdef CONFIG_TARGET_LS1088AQDS
676 /* read the current value(SVDD) of the LTM Regulator Voltage */
677 int get_serdes_volt(void)
680 u8 chan = PWM_CHANNEL0;
682 /* Select the PAGE 0 using PMBus commands PAGE for VDD */
683 #if !CONFIG_IS_ENABLED(DM_I2C)
684 ret = i2c_write(I2C_SVDD_MONITOR_ADDR,
685 PMBUS_CMD_PAGE, 1, &chan, 1);
689 ret = i2c_get_chip_for_busnum(0, I2C_SVDD_MONITOR_ADDR, 1, &dev);
691 ret = dm_i2c_write(dev, PMBUS_CMD_PAGE,
696 printf("VID: failed to select VDD Page 0\n");
700 /* Read the output voltage using PMBus command READ_VOUT */
701 #if !CONFIG_IS_ENABLED(DM_I2C)
702 ret = i2c_read(I2C_SVDD_MONITOR_ADDR,
703 PMBUS_CMD_READ_VOUT, 1, (void *)&vcode, 2);
705 dm_i2c_read(dev, PMBUS_CMD_READ_VOUT, (void *)&vcode, 2);
708 printf("VID: failed to read the volatge\n");
715 int set_serdes_volt(int svdd)
718 u8 buff[5] = {0x04, PWM_CHANNEL0, PMBUS_CMD_VOUT_COMMAND,
719 svdd & 0xFF, (svdd & 0xFF00) >> 8};
721 /* Write the desired voltage code to the SVDD regulator */
722 #if !CONFIG_IS_ENABLED(DM_I2C)
723 ret = i2c_write(I2C_SVDD_MONITOR_ADDR,
724 PMBUS_CMD_PAGE_PLUS_WRITE, 1, (void *)&buff, 5);
728 ret = i2c_get_chip_for_busnum(0, I2C_SVDD_MONITOR_ADDR, 1, &dev);
730 ret = dm_i2c_write(dev, PMBUS_CMD_PAGE_PLUS_WRITE,
734 printf("VID: I2C failed to write to the volatge regulator\n");
738 /* Wait for the volatge to get to the desired value */
740 vdd_last = get_serdes_volt();
742 printf("VID: Couldn't read sensor abort VID adjust\n");
745 } while (vdd_last != svdd);
750 int get_serdes_volt(void)
755 int set_serdes_volt(int svdd)
760 printf("SVDD changing of RDB\n");
762 /* Read the BRDCFG54 via CLPD */
763 #if !CONFIG_IS_ENABLED(DM_I2C)
764 ret = i2c_read(CONFIG_SYS_I2C_FPGA_ADDR,
765 QIXIS_BRDCFG4_OFFSET, 1, (void *)&brdcfg4, 1);
769 ret = i2c_get_chip_for_busnum(0, CONFIG_SYS_I2C_FPGA_ADDR, 1, &dev);
771 ret = dm_i2c_read(dev, QIXIS_BRDCFG4_OFFSET,
772 (void *)&brdcfg4, 1);
776 printf("VID: I2C failed to read the CPLD BRDCFG4\n");
780 brdcfg4 = brdcfg4 | 0x08;
782 /* Write to the BRDCFG4 */
783 #if !CONFIG_IS_ENABLED(DM_I2C)
784 ret = i2c_write(CONFIG_SYS_I2C_FPGA_ADDR,
785 QIXIS_BRDCFG4_OFFSET, 1, (void *)&brdcfg4, 1);
787 ret = dm_i2c_write(dev, QIXIS_BRDCFG4_OFFSET,
788 (void *)&brdcfg4, 1);
792 debug("VID: I2C failed to set the SVDD CPLD BRDCFG4\n");
796 /* Wait for the volatge to get to the desired value */
803 /* this function disables the SERDES, changes the SVDD Voltage and enables it*/
804 int board_adjust_vdd(int vdd)
808 debug("%s: vdd = %d\n", __func__, vdd);
810 /* Special settings to be performed when voltage is 900mV */
812 ret = setup_serdes_volt(vdd);
822 #if !defined(CONFIG_SPL_BUILD)
825 init_final_memctl_regs();
826 #if defined(CONFIG_TARGET_LS1088ARDB) && defined(CONFIG_FSL_MC_ENET)
827 u32 __iomem *irq_ccsr = (u32 __iomem *)ISC_BASE;
830 select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
831 board_retimer_init();
833 #ifdef CONFIG_ENV_IS_NOWHERE
834 gd->env_addr = (ulong)&default_environment[0];
837 #if defined(CONFIG_TARGET_LS1088ARDB) && defined(CONFIG_FSL_MC_ENET)
838 /* invert AQR105 IRQ pins polarity */
839 out_le32(irq_ccsr + IRQCR_OFFSET / 4, AQR105_IRQ_MASK);
842 #ifdef CONFIG_FSL_CAAM
845 #ifdef CONFIG_FSL_LS_PPA
849 #if !defined(CONFIG_SYS_EARLY_PCI_INIT) && defined(CONFIG_DM_ETH)
856 void detail_board_ddr_info(void)
859 print_size(gd->bd->bi_dram[0].size + gd->bd->bi_dram[1].size, "");
863 #ifdef CONFIG_FSL_MC_ENET
864 void board_quiesce_devices(void)
866 fsl_mc_ldpaa_exit(gd->bd);
869 void fdt_fixup_board_enet(void *fdt)
873 offset = fdt_path_offset(fdt, "/fsl-mc");
876 offset = fdt_path_offset(fdt, "/soc/fsl-mc");
879 printf("%s: ERROR: fsl-mc node not found in device tree (error %d)\n",
884 if (get_mc_boot_status() == 0 &&
885 (is_lazy_dpl_addr_valid() || get_dpl_apply_status() == 0))
886 fdt_status_okay(fdt, offset);
888 fdt_status_fail(fdt, offset);
892 #ifdef CONFIG_OF_BOARD_SETUP
893 void fsl_fdt_fixup_flash(void *fdt)
896 #ifdef CONFIG_TFABOOT
897 u32 __iomem *dcfg_ccsr = (u32 __iomem *)DCFG_BASE;
902 * IFC-NOR and QSPI are muxed on SoC.
903 * So disable IFC node in dts if QSPI is enabled or
904 * disable QSPI node in dts in case QSPI is not enabled.
907 #ifdef CONFIG_TFABOOT
908 enum boot_src src = get_boot_src();
909 bool disable_ifc = false;
912 case BOOT_SOURCE_IFC_NOR:
915 case BOOT_SOURCE_QSPI_NOR:
919 val = in_le32(dcfg_ccsr + DCFG_RCWSR15 / 4);
920 if (DCFG_RCWSR15_IFCGRPABASE_QSPI == (val & (u32)0x3))
926 offset = fdt_path_offset(fdt, "/soc/ifc/nor");
929 offset = fdt_path_offset(fdt, "/ifc/nor");
931 offset = fdt_path_offset(fdt, "/soc/quadspi");
934 offset = fdt_path_offset(fdt, "/quadspi");
938 #ifdef CONFIG_FSL_QSPI
939 offset = fdt_path_offset(fdt, "/soc/ifc/nor");
942 offset = fdt_path_offset(fdt, "/ifc/nor");
944 offset = fdt_path_offset(fdt, "/soc/quadspi");
947 offset = fdt_path_offset(fdt, "/quadspi");
953 fdt_status_disabled(fdt, offset);
956 int ft_board_setup(void *blob, struct bd_info *bd)
959 u16 mc_memory_bank = 0;
963 u64 mc_memory_base = 0;
964 u64 mc_memory_size = 0;
965 u16 total_memory_banks;
967 ft_cpu_setup(blob, bd);
969 fdt_fixup_mc_ddr(&mc_memory_base, &mc_memory_size);
971 if (mc_memory_base != 0)
974 total_memory_banks = CONFIG_NR_DRAM_BANKS + mc_memory_bank;
976 base = calloc(total_memory_banks, sizeof(u64));
977 size = calloc(total_memory_banks, sizeof(u64));
979 /* fixup DT for the two GPP DDR banks */
980 for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
981 base[i] = gd->bd->bi_dram[i].start;
982 size[i] = gd->bd->bi_dram[i].size;
985 #ifdef CONFIG_RESV_RAM
986 /* reduce size if reserved memory is within this bank */
987 if (gd->arch.resv_ram >= base[0] &&
988 gd->arch.resv_ram < base[0] + size[0])
989 size[0] = gd->arch.resv_ram - base[0];
990 else if (gd->arch.resv_ram >= base[1] &&
991 gd->arch.resv_ram < base[1] + size[1])
992 size[1] = gd->arch.resv_ram - base[1];
995 if (mc_memory_base != 0) {
996 for (i = 0; i <= total_memory_banks; i++) {
997 if (base[i] == 0 && size[i] == 0) {
998 base[i] = mc_memory_base;
999 size[i] = mc_memory_size;
1005 fdt_fixup_memory_banks(blob, base, size, total_memory_banks);
1007 fdt_fsl_mc_fixup_iommu_map_entry(blob);
1009 fsl_fdt_fixup_flash(blob);
1011 #ifdef CONFIG_FSL_MC_ENET
1012 fdt_fixup_board_enet(blob);
1015 fdt_fixup_icid(blob);
1018 fixup_ls1088ardb_pb_banner(blob);
1023 #endif /* defined(CONFIG_SPL_BUILD) */
1025 #ifdef CONFIG_TFABOOT
1026 #ifdef CONFIG_MTD_NOR_FLASH
1027 int is_flash_available(void)
1029 char *env_hwconfig = env_get("hwconfig");
1030 enum boot_src src = get_boot_src();
1031 int is_nor_flash_available = 1;
1034 case BOOT_SOURCE_IFC_NOR:
1035 is_nor_flash_available = 1;
1037 case BOOT_SOURCE_QSPI_NOR:
1038 is_nor_flash_available = 0;
1041 * In Case of SD boot,if qspi is defined in env_hwconfig
1042 * disable nor flash probe.
1045 if (hwconfig_f("qspi", env_hwconfig))
1046 is_nor_flash_available = 0;
1049 return is_nor_flash_available;
1053 #ifdef CONFIG_ENV_IS_IN_SPI_FLASH
1054 void *env_sf_get_env_addr(void)
1056 return (void *)(CONFIG_SYS_FSL_QSPI_BASE + CONFIG_ENV_OFFSET);