1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2017-2018 NXP
17 #include <fdt_support.h>
18 #include <linux/libfdt.h>
19 #include <fsl-mc/fsl_mc.h>
20 #include <env_internal.h>
21 #include <asm/arch-fsl-layerscape/soc.h>
22 #include <asm/arch/ppa.h>
24 #include <asm/arch/fsl_serdes.h>
25 #include <asm/arch/soc.h>
26 #include <asm/arch-fsl-layerscape/fsl_icid.h>
28 #include "../common/qixis.h"
29 #include "ls1088a_qixis.h"
30 #include "../common/vid.h"
31 #include <fsl_immap.h>
33 DECLARE_GLOBAL_DATA_PTR;
35 #ifdef CONFIG_TARGET_LS1088AQDS
37 struct ifc_regs ifc_cfg_ifc_nor_boot[CONFIG_SYS_FSL_IFC_BANK_COUNT] = {
40 CONFIG_SYS_NOR0_CSPR_EARLY,
41 CONFIG_SYS_NOR0_CSPR_EXT,
56 CONFIG_SYS_NOR1_CSPR_EARLY,
57 CONFIG_SYS_NOR0_CSPR_EXT,
58 CONFIG_SYS_NOR_AMASK_EARLY,
73 CONFIG_SYS_NAND_CSPR_EXT,
74 CONFIG_SYS_NAND_AMASK,
77 CONFIG_SYS_NAND_FTIM0,
78 CONFIG_SYS_NAND_FTIM1,
79 CONFIG_SYS_NAND_FTIM2,
86 CONFIG_SYS_FPGA_CSPR_EXT,
101 struct ifc_regs ifc_cfg_qspi_nor_boot[CONFIG_SYS_FSL_IFC_BANK_COUNT] = {
104 CONFIG_SYS_NAND_CSPR,
105 CONFIG_SYS_NAND_CSPR_EXT,
106 CONFIG_SYS_NAND_AMASK,
107 CONFIG_SYS_NAND_CSOR,
109 CONFIG_SYS_NAND_FTIM0,
110 CONFIG_SYS_NAND_FTIM1,
111 CONFIG_SYS_NAND_FTIM2,
112 CONFIG_SYS_NAND_FTIM3
120 CONFIG_SYS_FPGA_CSPR,
121 CONFIG_SYS_FPGA_CSPR_EXT,
123 CONFIG_SYS_FPGA_CSOR,
136 void ifc_cfg_boot_info(struct ifc_regs_info *regs_info)
138 enum boot_src src = get_boot_src();
140 if (src == BOOT_SOURCE_QSPI_NOR)
141 regs_info->regs = ifc_cfg_qspi_nor_boot;
143 regs_info->regs = ifc_cfg_ifc_nor_boot;
145 regs_info->cs_size = CONFIG_SYS_FSL_IFC_BANK_COUNT;
147 #endif /* CONFIG_TFABOOT */
148 #endif /* CONFIG_TARGET_LS1088AQDS */
150 int board_early_init_f(void)
152 #if defined(CONFIG_SYS_I2C_EARLY_INIT) && defined(CONFIG_TARGET_LS1088AQDS)
155 fsl_lsch3_early_init_f();
159 #ifdef CONFIG_FSL_QIXIS
160 unsigned long long get_qixis_addr(void)
162 unsigned long long addr;
164 if (gd->flags & GD_FLG_RELOC)
165 addr = QIXIS_BASE_PHYS;
167 addr = QIXIS_BASE_PHYS_EARLY;
170 * IFC address under 256MB is mapped to 0x30000000, any address above
171 * is mapped to 0x5_10000000 up to 4GB.
173 addr = addr > 0x10000000 ? addr + 0x500000000ULL : addr + 0x30000000;
179 #if defined(CONFIG_VID)
180 int init_func_vid(void)
182 if (adjust_vdd(0) < 0)
183 printf("core voltage not adjusted\n");
189 int is_pb_board(void)
193 board_id = QIXIS_READ(id);
194 if (board_id == LS1088ARDB_PB_BOARD)
200 int fixup_ls1088ardb_pb_banner(void *fdt)
202 fdt_setprop_string(fdt, 0, "model", "LS1088ARDB-PB Board");
207 #if !defined(CONFIG_SPL_BUILD)
210 #ifdef CONFIG_TFABOOT
211 enum boot_src src = get_boot_src();
215 static const char *const freq[] = {"100", "125", "156.25",
216 "100 separate SSCG"};
219 #ifdef CONFIG_TARGET_LS1088AQDS
220 printf("Board: LS1088A-QDS, ");
223 printf("Board: LS1088ARDB-PB, ");
225 printf("Board: LS1088A-RDB, ");
228 sw = QIXIS_READ(arch);
229 printf("Board Arch: V%d, ", sw >> 4);
231 #ifdef CONFIG_TARGET_LS1088AQDS
232 printf("Board version: %c, boot from ", (sw & 0xf) + 'A' - 1);
234 printf("Board version: %c, boot from ", (sw & 0xf) + 'A');
237 memset((u8 *)buf, 0x00, ARRAY_SIZE(buf));
239 sw = QIXIS_READ(brdcfg[0]);
240 sw = (sw & QIXIS_LBMAP_MASK) >> QIXIS_LBMAP_SHIFT;
242 #ifdef CONFIG_TFABOOT
243 if (src == BOOT_SOURCE_SD_MMC)
246 #ifdef CONFIG_SD_BOOT
249 #endif /* CONFIG_TFABOOT */
251 #ifdef CONFIG_TARGET_LS1088AQDS
260 printf("vBank: %d\n", sw);
273 sw = QIXIS_READ(brdcfg[0]);
274 sw = (sw & QIXIS_QMAP_MASK) >> QIXIS_QMAP_SHIFT;
275 if (sw == 0 || sw == 4)
284 printf("invalid setting of SW%u\n", QIXIS_LBMAP_SWITCH);
288 #ifdef CONFIG_TARGET_LS1088AQDS
289 printf("FPGA: v%d (%s), build %d",
290 (int)QIXIS_READ(scver), qixis_read_tag(buf),
291 (int)qixis_read_minor());
292 /* the timestamp string contains "\n" at the end */
293 printf(" on %s", qixis_read_time(buf));
295 printf("CPLD: v%d.%d\n", QIXIS_READ(scver), QIXIS_READ(tagdata));
299 * Display the actual SERDES reference clocks as configured by the
300 * dip switches on the board. Note that the SWx registers could
301 * technically be set to force the reference clocks to match the
302 * values that the SERDES expects (or vice versa). For now, however,
303 * we just display both values and hope the user notices when they
306 puts("SERDES1 Reference : ");
307 sw = QIXIS_READ(brdcfg[2]);
308 clock = (sw >> 6) & 3;
309 printf("Clock1 = %sMHz ", freq[clock]);
310 clock = (sw >> 4) & 3;
311 printf("Clock2 = %sMHz", freq[clock]);
313 puts("\nSERDES2 Reference : ");
314 clock = (sw >> 2) & 3;
315 printf("Clock1 = %sMHz ", freq[clock]);
316 clock = (sw >> 0) & 3;
317 printf("Clock2 = %sMHz\n", freq[clock]);
323 bool if_board_diff_clk(void)
325 #ifdef CONFIG_TARGET_LS1088AQDS
326 u8 diff_conf = QIXIS_READ(brdcfg[11]);
327 return diff_conf & 0x40;
329 u8 diff_conf = QIXIS_READ(dutcfg[11]);
330 return diff_conf & 0x80;
334 unsigned long get_board_sys_clk(void)
336 u8 sysclk_conf = QIXIS_READ(brdcfg[1]);
338 switch (sysclk_conf & 0x0f) {
339 case QIXIS_SYSCLK_83:
341 case QIXIS_SYSCLK_100:
343 case QIXIS_SYSCLK_125:
345 case QIXIS_SYSCLK_133:
347 case QIXIS_SYSCLK_150:
349 case QIXIS_SYSCLK_160:
351 case QIXIS_SYSCLK_166:
358 unsigned long get_board_ddr_clk(void)
360 u8 ddrclk_conf = QIXIS_READ(brdcfg[1]);
362 if (if_board_diff_clk())
363 return get_board_sys_clk();
364 switch ((ddrclk_conf & 0x30) >> 4) {
365 case QIXIS_DDRCLK_100:
367 case QIXIS_DDRCLK_125:
369 case QIXIS_DDRCLK_133:
376 int select_i2c_ch_pca9547(u8 ch)
380 #ifndef CONFIG_DM_I2C
381 ret = i2c_write(I2C_MUX_PCA_ADDR_PRI, 0, 1, &ch, 1);
385 ret = i2c_get_chip_for_busnum(0, I2C_MUX_PCA_ADDR_PRI, 1, &dev);
387 ret = dm_i2c_write(dev, 0, &ch, 1);
390 puts("PCA: failed to select proper channel\n");
397 #if !defined(CONFIG_SPL_BUILD)
398 void board_retimer_init(void)
402 /* Retimer is connected to I2C1_CH5 */
403 select_i2c_ch_pca9547(I2C_MUX_CH5);
405 /* Access to Control/Shared register */
407 #ifndef CONFIG_DM_I2C
408 i2c_write(I2C_RETIMER_ADDR, 0xff, 1, ®, 1);
412 i2c_get_chip_for_busnum(0, I2C_RETIMER_ADDR, 1, &dev);
413 dm_i2c_write(dev, 0xff, ®, 1);
416 /* Read device revision and ID */
417 #ifndef CONFIG_DM_I2C
418 i2c_read(I2C_RETIMER_ADDR, 1, 1, ®, 1);
420 dm_i2c_read(dev, 1, ®, 1);
422 debug("Retimer version id = 0x%x\n", reg);
424 /* Enable Broadcast. All writes target all channel register sets */
426 #ifndef CONFIG_DM_I2C
427 i2c_write(I2C_RETIMER_ADDR, 0xff, 1, ®, 1);
429 dm_i2c_write(dev, 0xff, ®, 1);
432 /* Reset Channel Registers */
433 #ifndef CONFIG_DM_I2C
434 i2c_read(I2C_RETIMER_ADDR, 0, 1, ®, 1);
436 dm_i2c_read(dev, 0, ®, 1);
439 #ifndef CONFIG_DM_I2C
440 i2c_write(I2C_RETIMER_ADDR, 0, 1, ®, 1);
442 dm_i2c_write(dev, 0, ®, 1);
445 /* Set data rate as 10.3125 Gbps */
447 #ifndef CONFIG_DM_I2C
448 i2c_write(I2C_RETIMER_ADDR, 0x60, 1, ®, 1);
450 dm_i2c_write(dev, 0x60, ®, 1);
453 #ifndef CONFIG_DM_I2C
454 i2c_write(I2C_RETIMER_ADDR, 0x61, 1, ®, 1);
456 dm_i2c_write(dev, 0x61, ®, 1);
459 #ifndef CONFIG_DM_I2C
460 i2c_write(I2C_RETIMER_ADDR, 0x62, 1, ®, 1);
462 dm_i2c_write(dev, 0x62, ®, 1);
465 #ifndef CONFIG_DM_I2C
466 i2c_write(I2C_RETIMER_ADDR, 0x63, 1, ®, 1);
468 dm_i2c_write(dev, 0x63, ®, 1);
471 #ifndef CONFIG_DM_I2C
472 i2c_write(I2C_RETIMER_ADDR, 0x64, 1, ®, 1);
474 dm_i2c_write(dev, 0x64, ®, 1);
477 /* Select VCO Divider to full rate (000) */
478 #ifndef CONFIG_DM_I2C
479 i2c_read(I2C_RETIMER_ADDR, 0x2F, 1, ®, 1);
481 dm_i2c_read(dev, 0x2F, ®, 1);
485 #ifndef CONFIG_DM_I2C
486 i2c_write(I2C_RETIMER_ADDR, 0x2F, 1, ®, 1);
488 dm_i2c_write(dev, 0x2F, ®, 1);
491 #ifdef CONFIG_TARGET_LS1088AQDS
492 /* Retimer is connected to I2C1_CH5 */
493 select_i2c_ch_pca9547(I2C_MUX_CH5);
495 /* Access to Control/Shared register */
497 #ifndef CONFIG_DM_I2C
498 i2c_write(I2C_RETIMER_ADDR2, 0xff, 1, ®, 1);
500 i2c_get_chip_for_busnum(0, I2C_RETIMER_ADDR2, 1, &dev);
501 dm_i2c_write(dev, 0xff, ®, 1);
504 /* Read device revision and ID */
505 #ifndef CONFIG_DM_I2C
506 i2c_read(I2C_RETIMER_ADDR2, 1, 1, ®, 1);
508 dm_i2c_read(dev, 1, ®, 1);
510 debug("Retimer version id = 0x%x\n", reg);
512 /* Enable Broadcast. All writes target all channel register sets */
514 #ifndef CONFIG_DM_I2C
515 i2c_write(I2C_RETIMER_ADDR2, 0xff, 1, ®, 1);
517 dm_i2c_write(dev, 0xff, ®, 1);
520 /* Reset Channel Registers */
521 #ifndef CONFIG_DM_I2C
522 i2c_read(I2C_RETIMER_ADDR2, 0, 1, ®, 1);
524 dm_i2c_read(dev, 0, ®, 1);
527 #ifndef CONFIG_DM_I2C
528 i2c_write(I2C_RETIMER_ADDR2, 0, 1, ®, 1);
530 dm_i2c_write(dev, 0, ®, 1);
533 /* Set data rate as 10.3125 Gbps */
535 #ifndef CONFIG_DM_I2C
536 i2c_write(I2C_RETIMER_ADDR2, 0x60, 1, ®, 1);
538 dm_i2c_write(dev, 0x60, ®, 1);
541 #ifndef CONFIG_DM_I2C
542 i2c_write(I2C_RETIMER_ADDR2, 0x61, 1, ®, 1);
544 dm_i2c_write(dev, 0x61, ®, 1);
547 #ifndef CONFIG_DM_I2C
548 i2c_write(I2C_RETIMER_ADDR2, 0x62, 1, ®, 1);
550 dm_i2c_write(dev, 0x62, ®, 1);
553 #ifndef CONFIG_DM_I2C
554 i2c_write(I2C_RETIMER_ADDR2, 0x63, 1, ®, 1);
556 dm_i2c_write(dev, 0x63, ®, 1);
559 #ifndef CONFIG_DM_I2C
560 i2c_write(I2C_RETIMER_ADDR2, 0x64, 1, ®, 1);
562 dm_i2c_write(dev, 0x64, ®, 1);
565 /* Select VCO Divider to full rate (000) */
566 #ifndef CONFIG_DM_I2C
567 i2c_read(I2C_RETIMER_ADDR2, 0x2F, 1, ®, 1);
569 dm_i2c_read(dev, 0x2F, ®, 1);
573 #ifndef CONFIG_DM_I2C
574 i2c_write(I2C_RETIMER_ADDR2, 0x2F, 1, ®, 1);
576 dm_i2c_write(dev, 0x2F, ®, 1);
580 /*return the default channel*/
581 select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
584 #ifdef CONFIG_MISC_INIT_R
585 int misc_init_r(void)
587 #ifdef CONFIG_TARGET_LS1088ARDB
590 if (hwconfig("esdhc-force-sd")) {
591 brdcfg5 = QIXIS_READ(brdcfg[5]);
592 brdcfg5 &= ~BRDCFG5_SPISDHC_MASK;
593 brdcfg5 |= BRDCFG5_FORCE_SD;
594 QIXIS_WRITE(brdcfg[5], brdcfg5);
598 #ifdef CONFIG_TARGET_LS1088AQDS
601 if (hwconfig("dspi-on-board")) {
602 brdcfg4 = QIXIS_READ(brdcfg[4]);
603 brdcfg4 &= ~BRDCFG4_USBOSC_MASK;
604 brdcfg4 |= BRDCFG4_SPI;
605 QIXIS_WRITE(brdcfg[4], brdcfg4);
607 brdcfg5 = QIXIS_READ(brdcfg[5]);
608 brdcfg5 &= ~BRDCFG5_SPR_MASK;
609 brdcfg5 |= BRDCFG5_SPI_ON_BOARD;
610 QIXIS_WRITE(brdcfg[5], brdcfg5);
611 } else if (hwconfig("dspi-off-board")) {
612 brdcfg4 = QIXIS_READ(brdcfg[4]);
613 brdcfg4 &= ~BRDCFG4_USBOSC_MASK;
614 brdcfg4 |= BRDCFG4_SPI;
615 QIXIS_WRITE(brdcfg[4], brdcfg4);
617 brdcfg5 = QIXIS_READ(brdcfg[5]);
618 brdcfg5 &= ~BRDCFG5_SPR_MASK;
619 brdcfg5 |= BRDCFG5_SPI_OFF_BOARD;
620 QIXIS_WRITE(brdcfg[5], brdcfg5);
628 int i2c_multiplexer_select_vid_channel(u8 channel)
630 return select_i2c_ch_pca9547(channel);
633 #ifdef CONFIG_TARGET_LS1088AQDS
634 /* read the current value(SVDD) of the LTM Regulator Voltage */
635 int get_serdes_volt(void)
638 u8 chan = PWM_CHANNEL0;
640 /* Select the PAGE 0 using PMBus commands PAGE for VDD */
641 #ifndef CONFIG_DM_I2C
642 ret = i2c_write(I2C_SVDD_MONITOR_ADDR,
643 PMBUS_CMD_PAGE, 1, &chan, 1);
647 ret = i2c_get_chip_for_busnum(0, I2C_SVDD_MONITOR_ADDR, 1, &dev);
649 ret = dm_i2c_write(dev, PMBUS_CMD_PAGE,
654 printf("VID: failed to select VDD Page 0\n");
658 /* Read the output voltage using PMBus command READ_VOUT */
659 #ifndef CONFIG_DM_I2C
660 ret = i2c_read(I2C_SVDD_MONITOR_ADDR,
661 PMBUS_CMD_READ_VOUT, 1, (void *)&vcode, 2);
663 dm_i2c_read(dev, PMBUS_CMD_READ_VOUT, (void *)&vcode, 2);
666 printf("VID: failed to read the volatge\n");
673 int set_serdes_volt(int svdd)
676 u8 buff[5] = {0x04, PWM_CHANNEL0, PMBUS_CMD_VOUT_COMMAND,
677 svdd & 0xFF, (svdd & 0xFF00) >> 8};
679 /* Write the desired voltage code to the SVDD regulator */
680 #ifndef CONFIG_DM_I2C
681 ret = i2c_write(I2C_SVDD_MONITOR_ADDR,
682 PMBUS_CMD_PAGE_PLUS_WRITE, 1, (void *)&buff, 5);
686 ret = i2c_get_chip_for_busnum(0, I2C_SVDD_MONITOR_ADDR, 1, &dev);
688 ret = dm_i2c_write(dev, PMBUS_CMD_PAGE_PLUS_WRITE,
692 printf("VID: I2C failed to write to the volatge regulator\n");
696 /* Wait for the volatge to get to the desired value */
698 vdd_last = get_serdes_volt();
700 printf("VID: Couldn't read sensor abort VID adjust\n");
703 } while (vdd_last != svdd);
708 int get_serdes_volt(void)
713 int set_serdes_volt(int svdd)
718 printf("SVDD changing of RDB\n");
720 /* Read the BRDCFG54 via CLPD */
721 #ifndef CONFIG_DM_I2C
722 ret = i2c_read(CONFIG_SYS_I2C_FPGA_ADDR,
723 QIXIS_BRDCFG4_OFFSET, 1, (void *)&brdcfg4, 1);
727 ret = i2c_get_chip_for_busnum(0, CONFIG_SYS_I2C_FPGA_ADDR, 1, &dev);
729 ret = dm_i2c_read(dev, QIXIS_BRDCFG4_OFFSET,
730 (void *)&brdcfg4, 1);
734 printf("VID: I2C failed to read the CPLD BRDCFG4\n");
738 brdcfg4 = brdcfg4 | 0x08;
740 /* Write to the BRDCFG4 */
741 #ifndef CONFIG_DM_I2C
742 ret = i2c_write(CONFIG_SYS_I2C_FPGA_ADDR,
743 QIXIS_BRDCFG4_OFFSET, 1, (void *)&brdcfg4, 1);
745 ret = dm_i2c_write(dev, QIXIS_BRDCFG4_OFFSET,
746 (void *)&brdcfg4, 1);
750 debug("VID: I2C failed to set the SVDD CPLD BRDCFG4\n");
754 /* Wait for the volatge to get to the desired value */
761 /* this function disables the SERDES, changes the SVDD Voltage and enables it*/
762 int board_adjust_vdd(int vdd)
766 debug("%s: vdd = %d\n", __func__, vdd);
768 /* Special settings to be performed when voltage is 900mV */
770 ret = setup_serdes_volt(vdd);
780 #if !defined(CONFIG_SPL_BUILD)
783 init_final_memctl_regs();
784 #if defined(CONFIG_TARGET_LS1088ARDB) && defined(CONFIG_FSL_MC_ENET)
785 u32 __iomem *irq_ccsr = (u32 __iomem *)ISC_BASE;
788 select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
789 board_retimer_init();
791 #ifdef CONFIG_ENV_IS_NOWHERE
792 gd->env_addr = (ulong)&default_environment[0];
795 #if defined(CONFIG_TARGET_LS1088ARDB) && defined(CONFIG_FSL_MC_ENET)
796 /* invert AQR105 IRQ pins polarity */
797 out_le32(irq_ccsr + IRQCR_OFFSET / 4, AQR105_IRQ_MASK);
800 #ifdef CONFIG_FSL_CAAM
803 #ifdef CONFIG_FSL_LS_PPA
807 #if !defined(CONFIG_SYS_EARLY_PCI_INIT) && defined(CONFIG_DM_ETH)
814 void detail_board_ddr_info(void)
817 print_size(gd->bd->bi_dram[0].size + gd->bd->bi_dram[1].size, "");
821 #ifdef CONFIG_FSL_MC_ENET
822 void board_quiesce_devices(void)
824 fsl_mc_ldpaa_exit(gd->bd);
827 void fdt_fixup_board_enet(void *fdt)
831 offset = fdt_path_offset(fdt, "/fsl-mc");
834 offset = fdt_path_offset(fdt, "/soc/fsl-mc");
837 printf("%s: ERROR: fsl-mc node not found in device tree (error %d)\n",
842 if (get_mc_boot_status() == 0 &&
843 (is_lazy_dpl_addr_valid() || get_dpl_apply_status() == 0))
844 fdt_status_okay(fdt, offset);
846 fdt_status_fail(fdt, offset);
850 #ifdef CONFIG_OF_BOARD_SETUP
851 void fsl_fdt_fixup_flash(void *fdt)
854 #ifdef CONFIG_TFABOOT
855 u32 __iomem *dcfg_ccsr = (u32 __iomem *)DCFG_BASE;
860 * IFC-NOR and QSPI are muxed on SoC.
861 * So disable IFC node in dts if QSPI is enabled or
862 * disable QSPI node in dts in case QSPI is not enabled.
865 #ifdef CONFIG_TFABOOT
866 enum boot_src src = get_boot_src();
867 bool disable_ifc = false;
870 case BOOT_SOURCE_IFC_NOR:
873 case BOOT_SOURCE_QSPI_NOR:
877 val = in_le32(dcfg_ccsr + DCFG_RCWSR15 / 4);
878 if (DCFG_RCWSR15_IFCGRPABASE_QSPI == (val & (u32)0x3))
884 offset = fdt_path_offset(fdt, "/soc/ifc/nor");
887 offset = fdt_path_offset(fdt, "/ifc/nor");
889 offset = fdt_path_offset(fdt, "/soc/quadspi");
892 offset = fdt_path_offset(fdt, "/quadspi");
896 #ifdef CONFIG_FSL_QSPI
897 offset = fdt_path_offset(fdt, "/soc/ifc/nor");
900 offset = fdt_path_offset(fdt, "/ifc/nor");
902 offset = fdt_path_offset(fdt, "/soc/quadspi");
905 offset = fdt_path_offset(fdt, "/quadspi");
911 fdt_status_disabled(fdt, offset);
914 int ft_board_setup(void *blob, bd_t *bd)
917 u16 mc_memory_bank = 0;
921 u64 mc_memory_base = 0;
922 u64 mc_memory_size = 0;
923 u16 total_memory_banks;
925 ft_cpu_setup(blob, bd);
927 fdt_fixup_mc_ddr(&mc_memory_base, &mc_memory_size);
929 if (mc_memory_base != 0)
932 total_memory_banks = CONFIG_NR_DRAM_BANKS + mc_memory_bank;
934 base = calloc(total_memory_banks, sizeof(u64));
935 size = calloc(total_memory_banks, sizeof(u64));
937 /* fixup DT for the two GPP DDR banks */
938 for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
939 base[i] = gd->bd->bi_dram[i].start;
940 size[i] = gd->bd->bi_dram[i].size;
943 #ifdef CONFIG_RESV_RAM
944 /* reduce size if reserved memory is within this bank */
945 if (gd->arch.resv_ram >= base[0] &&
946 gd->arch.resv_ram < base[0] + size[0])
947 size[0] = gd->arch.resv_ram - base[0];
948 else if (gd->arch.resv_ram >= base[1] &&
949 gd->arch.resv_ram < base[1] + size[1])
950 size[1] = gd->arch.resv_ram - base[1];
953 if (mc_memory_base != 0) {
954 for (i = 0; i <= total_memory_banks; i++) {
955 if (base[i] == 0 && size[i] == 0) {
956 base[i] = mc_memory_base;
957 size[i] = mc_memory_size;
963 fdt_fixup_memory_banks(blob, base, size, total_memory_banks);
965 fdt_fsl_mc_fixup_iommu_map_entry(blob);
967 fsl_fdt_fixup_flash(blob);
969 #ifdef CONFIG_FSL_MC_ENET
970 fdt_fixup_board_enet(blob);
973 fdt_fixup_icid(blob);
976 fixup_ls1088ardb_pb_banner(blob);
981 #endif /* defined(CONFIG_SPL_BUILD) */
983 #ifdef CONFIG_TFABOOT
984 #ifdef CONFIG_MTD_NOR_FLASH
985 int is_flash_available(void)
987 char *env_hwconfig = env_get("hwconfig");
988 enum boot_src src = get_boot_src();
989 int is_nor_flash_available = 1;
992 case BOOT_SOURCE_IFC_NOR:
993 is_nor_flash_available = 1;
995 case BOOT_SOURCE_QSPI_NOR:
996 is_nor_flash_available = 0;
999 * In Case of SD boot,if qspi is defined in env_hwconfig
1000 * disable nor flash probe.
1003 if (hwconfig_f("qspi", env_hwconfig))
1004 is_nor_flash_available = 0;
1007 return is_nor_flash_available;
1011 #ifdef CONFIG_ENV_IS_IN_SPI_FLASH
1012 void *env_sf_get_env_addr(void)
1014 return (void *)(CONFIG_SYS_FSL_QSPI_BASE + CONFIG_ENV_OFFSET);