1 // SPDX-License-Identifier: GPL-2.0+
12 #include <fdt_support.h>
13 #include <linux/libfdt.h>
14 #include <env_internal.h>
15 #include <asm/arch-fsl-layerscape/soc.h>
16 #include <asm/arch-fsl-layerscape/fsl_icid.h>
18 #include <asm/arch/soc.h>
19 #ifdef CONFIG_FSL_LS_PPA
20 #include <asm/arch/ppa.h>
22 #include <fsl_immap.h>
27 #include "../common/qixis.h"
29 DECLARE_GLOBAL_DATA_PTR;
31 int config_board_mux(void)
33 #if defined(CONFIG_TARGET_LS1028AQDS) && defined(CONFIG_FSL_QIXIS)
36 reg = QIXIS_READ(brdcfg[13]);
38 * 7-6 | Controls I2C3 routing (net CFG_MUX_I2C3):
39 * I2C3 | 10= Routes {SCL, SDA} to CAN1 transceiver as {TX, RX}.
40 * 5-4 | Controls I2C4 routing (net CFG_MUX_I2C4):
41 * I2C4 |11= Routes {SCL, SDA} to CAN2 transceiver as {TX, RX}.
45 QIXIS_WRITE(brdcfg[13], reg);
47 reg = QIXIS_READ(brdcfg[15]);
49 * 7 | Controls the CAN1 transceiver (net CFG_CAN1_STBY):
50 * CAN1 | 0= CAN #1 transceiver enabled
51 * 6 | Controls the CAN2 transceiver (net CFG_CAN2_STBY):
52 * CAN2 | 0= CAN #2 transceiver enabled
55 QIXIS_WRITE(brdcfg[15], reg);
62 #ifdef CONFIG_ENV_IS_NOWHERE
63 gd->env_addr = (ulong)&default_environment[0];
66 #ifdef CONFIG_FSL_CAAM
70 #ifdef CONFIG_FSL_LS_PPA
74 #ifndef CONFIG_SYS_EARLY_PCI_INIT
78 #if defined(CONFIG_TARGET_LS1028ARDB)
79 u8 val = I2C_MUX_CH_DEFAULT;
82 i2c_write(I2C_MUX_PCA_ADDR_PRI, 0x0b, 1, &val, 1);
86 if (!i2c_get_chip_for_busnum(0, I2C_MUX_PCA_ADDR_PRI, 1, &dev))
87 dm_i2c_write(dev, 0x0b, &val, 1);
94 int board_eth_init(bd_t *bis)
96 return pci_eth_init(bis);
99 #if defined(CONFIG_ARCH_MISC_INIT)
100 int arch_misc_init(void)
108 int board_early_init_f(void)
110 #ifdef CONFIG_SYS_I2C_EARLY_INIT
114 fsl_lsch3_early_init_f();
118 void detail_board_ddr_info(void)
121 print_size(gd->bd->bi_dram[0].size + gd->bd->bi_dram[1].size, "");
125 #ifdef CONFIG_OF_BOARD_SETUP
126 int ft_board_setup(void *blob, bd_t *bd)
128 u64 base[CONFIG_NR_DRAM_BANKS];
129 u64 size[CONFIG_NR_DRAM_BANKS];
131 ft_cpu_setup(blob, bd);
133 /* fixup DT for the two GPP DDR banks */
134 base[0] = gd->bd->bi_dram[0].start;
135 size[0] = gd->bd->bi_dram[0].size;
136 base[1] = gd->bd->bi_dram[1].start;
137 size[1] = gd->bd->bi_dram[1].size;
139 #ifdef CONFIG_RESV_RAM
140 /* reduce size if reserved memory is within this bank */
141 if (gd->arch.resv_ram >= base[0] &&
142 gd->arch.resv_ram < base[0] + size[0])
143 size[0] = gd->arch.resv_ram - base[0];
144 else if (gd->arch.resv_ram >= base[1] &&
145 gd->arch.resv_ram < base[1] + size[1])
146 size[1] = gd->arch.resv_ram - base[1];
149 fdt_fixup_memory_banks(blob, base, size, 2);
151 fdt_fixup_icid(blob);
157 #ifdef CONFIG_FSL_QIXIS
160 #ifdef CONFIG_TFABOOT
161 enum boot_src src = get_boot_src();
168 static const char *freq[6] = {"100.00", "125.00", "156.25",
169 "161.13", "322.26", "100.00 SS"};
172 /* find the board details */
190 sw = QIXIS_READ(arch);
191 printf("Board: %s-%s, Version: %c, boot from ",
192 buf, board, (sw & 0xf) + 'A' - 1);
194 sw = QIXIS_READ(brdcfg[0]);
195 sw = (sw & QIXIS_LBMAP_MASK) >> QIXIS_LBMAP_SHIFT;
197 #ifdef CONFIG_TFABOOT
198 if (src == BOOT_SOURCE_SD_MMC) {
200 } else if (src == BOOT_SOURCE_SD_MMC2) {
204 #ifdef CONFIG_SD_BOOT
206 #elif defined(CONFIG_EMMC_BOOT)
218 printf("invalid setting of SW%u\n", QIXIS_LBMAP_SWITCH);
222 #ifdef CONFIG_TFABOOT
226 printf("FPGA: v%d (%s)\n", QIXIS_READ(scver), board);
227 puts("SERDES1 Reference : ");
229 sw = QIXIS_READ(brdcfg[2]);
230 #ifdef CONFIG_TARGET_LS1028ARDB
231 clock = (sw >> 6) & 3;
233 clock = (sw >> 4) & 0xf;
236 printf("Clock1 = %sMHz ", freq[clock]);
237 #ifdef CONFIG_TARGET_LS1028ARDB
238 clock = (sw >> 4) & 3;
242 printf("Clock2 = %sMHz\n", freq[clock]);