1e84a324bSAshish Kumar /* 2e84a324bSAshish Kumar * Copyright 2017 NXP 3e84a324bSAshish Kumar * 4e84a324bSAshish Kumar * SPDX-License-Identifier: GPL-2.0+ 5e84a324bSAshish Kumar */ 6e84a324bSAshish Kumar #include <common.h> 7e84a324bSAshish Kumar #include <i2c.h> 8e84a324bSAshish Kumar #include <malloc.h> 9e84a324bSAshish Kumar #include <errno.h> 10e84a324bSAshish Kumar #include <netdev.h> 11e84a324bSAshish Kumar #include <fsl_ifc.h> 12e84a324bSAshish Kumar #include <fsl_ddr.h> 13e84a324bSAshish Kumar #include <fsl_sec.h> 14e84a324bSAshish Kumar #include <asm/io.h> 15e84a324bSAshish Kumar #include <fdt_support.h> 16e84a324bSAshish Kumar #include <libfdt.h> 17e84a324bSAshish Kumar #include <fsl-mc/fsl_mc.h> 18e84a324bSAshish Kumar #include <environment.h> 19e84a324bSAshish Kumar #include <asm/arch-fsl-layerscape/soc.h> 20e84a324bSAshish Kumar #include <asm/arch/ppa.h> 21e84a324bSAshish Kumar 22e84a324bSAshish Kumar #include "../common/qixis.h" 23e84a324bSAshish Kumar #include "ls1088a_qixis.h" 24e84a324bSAshish Kumar 25e84a324bSAshish Kumar DECLARE_GLOBAL_DATA_PTR; 26e84a324bSAshish Kumar 27e84a324bSAshish Kumar unsigned long long get_qixis_addr(void) 28e84a324bSAshish Kumar { 29e84a324bSAshish Kumar unsigned long long addr; 30e84a324bSAshish Kumar 31e84a324bSAshish Kumar if (gd->flags & GD_FLG_RELOC) 32e84a324bSAshish Kumar addr = QIXIS_BASE_PHYS; 33e84a324bSAshish Kumar else 34e84a324bSAshish Kumar addr = QIXIS_BASE_PHYS_EARLY; 35e84a324bSAshish Kumar 36e84a324bSAshish Kumar /* 37e84a324bSAshish Kumar * IFC address under 256MB is mapped to 0x30000000, any address above 38e84a324bSAshish Kumar * is mapped to 0x5_10000000 up to 4GB. 39e84a324bSAshish Kumar */ 40e84a324bSAshish Kumar addr = addr > 0x10000000 ? addr + 0x500000000ULL : addr + 0x30000000; 41e84a324bSAshish Kumar 42e84a324bSAshish Kumar return addr; 43e84a324bSAshish Kumar } 44e84a324bSAshish Kumar 45e84a324bSAshish Kumar int checkboard(void) 46e84a324bSAshish Kumar { 47e84a324bSAshish Kumar char buf[64]; 48e84a324bSAshish Kumar u8 sw; 49e84a324bSAshish Kumar static const char *const freq[] = {"100", "125", "156.25", 50e84a324bSAshish Kumar "100 separate SSCG"}; 51e84a324bSAshish Kumar int clock; 52e84a324bSAshish Kumar 537769776aSAshish Kumar #ifdef CONFIG_TARGET_LS1088AQDS 547769776aSAshish Kumar printf("Board: LS1088A-QDS, "); 557769776aSAshish Kumar #else 56e84a324bSAshish Kumar printf("Board: LS1088A-RDB, "); 577769776aSAshish Kumar #endif 58e84a324bSAshish Kumar 59e84a324bSAshish Kumar sw = QIXIS_READ(arch); 60e84a324bSAshish Kumar printf("Board Arch: V%d, ", sw >> 4); 61e84a324bSAshish Kumar 627769776aSAshish Kumar #ifdef CONFIG_TARGET_LS1088AQDS 637769776aSAshish Kumar printf("Board version: %c, boot from ", (sw & 0xf) + 'A' - 1); 647769776aSAshish Kumar #else 65e84a324bSAshish Kumar printf("Board version: %c, boot from ", (sw & 0xf) + 'A'); 667769776aSAshish Kumar #endif 67e84a324bSAshish Kumar 68e84a324bSAshish Kumar memset((u8 *)buf, 0x00, ARRAY_SIZE(buf)); 69e84a324bSAshish Kumar 70e84a324bSAshish Kumar sw = QIXIS_READ(brdcfg[0]); 71e84a324bSAshish Kumar sw = (sw & QIXIS_LBMAP_MASK) >> QIXIS_LBMAP_SHIFT; 72e84a324bSAshish Kumar 73e84a324bSAshish Kumar #ifdef CONFIG_SD_BOOT 74e84a324bSAshish Kumar puts("SD card\n"); 75e84a324bSAshish Kumar #endif 76e84a324bSAshish Kumar switch (sw) { 777769776aSAshish Kumar #ifdef CONFIG_TARGET_LS1088AQDS 78e84a324bSAshish Kumar case 0: 797769776aSAshish Kumar case 1: 807769776aSAshish Kumar case 2: 817769776aSAshish Kumar case 3: 827769776aSAshish Kumar case 4: 837769776aSAshish Kumar case 5: 847769776aSAshish Kumar case 6: 857769776aSAshish Kumar case 7: 867769776aSAshish Kumar printf("vBank: %d\n", sw); 877769776aSAshish Kumar break; 887769776aSAshish Kumar case 8: 897769776aSAshish Kumar puts("PromJet\n"); 907769776aSAshish Kumar break; 917769776aSAshish Kumar case 15: 927769776aSAshish Kumar puts("IFCCard\n"); 937769776aSAshish Kumar break; 947769776aSAshish Kumar case 14: 957769776aSAshish Kumar #else 967769776aSAshish Kumar case 0: 977769776aSAshish Kumar #endif 98e84a324bSAshish Kumar puts("QSPI:"); 99e84a324bSAshish Kumar sw = QIXIS_READ(brdcfg[0]); 100e84a324bSAshish Kumar sw = (sw & QIXIS_QMAP_MASK) >> QIXIS_QMAP_SHIFT; 101e84a324bSAshish Kumar if (sw == 0 || sw == 4) 102e84a324bSAshish Kumar puts("0\n"); 103e84a324bSAshish Kumar else if (sw == 1) 104e84a324bSAshish Kumar puts("1\n"); 105e84a324bSAshish Kumar else 106e84a324bSAshish Kumar puts("EMU\n"); 107e84a324bSAshish Kumar break; 108e84a324bSAshish Kumar 109e84a324bSAshish Kumar default: 110e84a324bSAshish Kumar printf("invalid setting of SW%u\n", QIXIS_LBMAP_SWITCH); 111e84a324bSAshish Kumar break; 112e84a324bSAshish Kumar } 113e84a324bSAshish Kumar 1147769776aSAshish Kumar #ifdef CONFIG_TARGET_LS1088AQDS 1157769776aSAshish Kumar printf("FPGA: v%d (%s), build %d", 1167769776aSAshish Kumar (int)QIXIS_READ(scver), qixis_read_tag(buf), 1177769776aSAshish Kumar (int)qixis_read_minor()); 1187769776aSAshish Kumar /* the timestamp string contains "\n" at the end */ 1197769776aSAshish Kumar printf(" on %s", qixis_read_time(buf)); 1207769776aSAshish Kumar #else 121e84a324bSAshish Kumar printf("CPLD: v%d.%d\n", QIXIS_READ(scver), QIXIS_READ(tagdata)); 1227769776aSAshish Kumar #endif 123e84a324bSAshish Kumar 124e84a324bSAshish Kumar /* 125e84a324bSAshish Kumar * Display the actual SERDES reference clocks as configured by the 126e84a324bSAshish Kumar * dip switches on the board. Note that the SWx registers could 127e84a324bSAshish Kumar * technically be set to force the reference clocks to match the 128e84a324bSAshish Kumar * values that the SERDES expects (or vice versa). For now, however, 129e84a324bSAshish Kumar * we just display both values and hope the user notices when they 130e84a324bSAshish Kumar * don't match. 131e84a324bSAshish Kumar */ 132e84a324bSAshish Kumar puts("SERDES1 Reference : "); 133e84a324bSAshish Kumar sw = QIXIS_READ(brdcfg[2]); 134e84a324bSAshish Kumar clock = (sw >> 6) & 3; 135e84a324bSAshish Kumar printf("Clock1 = %sMHz ", freq[clock]); 136e84a324bSAshish Kumar clock = (sw >> 4) & 3; 137e84a324bSAshish Kumar printf("Clock2 = %sMHz", freq[clock]); 138e84a324bSAshish Kumar 139e84a324bSAshish Kumar puts("\nSERDES2 Reference : "); 140e84a324bSAshish Kumar clock = (sw >> 2) & 3; 141e84a324bSAshish Kumar printf("Clock1 = %sMHz ", freq[clock]); 142e84a324bSAshish Kumar clock = (sw >> 0) & 3; 143e84a324bSAshish Kumar printf("Clock2 = %sMHz\n", freq[clock]); 144e84a324bSAshish Kumar 145e84a324bSAshish Kumar return 0; 146e84a324bSAshish Kumar } 147e84a324bSAshish Kumar 148e84a324bSAshish Kumar bool if_board_diff_clk(void) 149e84a324bSAshish Kumar { 1507769776aSAshish Kumar #ifdef CONFIG_TARGET_LS1088AQDS 1517769776aSAshish Kumar u8 diff_conf = QIXIS_READ(brdcfg[11]); 1527769776aSAshish Kumar return diff_conf & 0x40; 1537769776aSAshish Kumar #else 154e84a324bSAshish Kumar u8 diff_conf = QIXIS_READ(dutcfg[11]); 155e84a324bSAshish Kumar return diff_conf & 0x80; 1567769776aSAshish Kumar #endif 157e84a324bSAshish Kumar } 158e84a324bSAshish Kumar 159e84a324bSAshish Kumar unsigned long get_board_sys_clk(void) 160e84a324bSAshish Kumar { 161e84a324bSAshish Kumar u8 sysclk_conf = QIXIS_READ(brdcfg[1]); 162e84a324bSAshish Kumar 163e84a324bSAshish Kumar switch (sysclk_conf & 0x0f) { 164e84a324bSAshish Kumar case QIXIS_SYSCLK_83: 165e84a324bSAshish Kumar return 83333333; 166e84a324bSAshish Kumar case QIXIS_SYSCLK_100: 167e84a324bSAshish Kumar return 100000000; 168e84a324bSAshish Kumar case QIXIS_SYSCLK_125: 169e84a324bSAshish Kumar return 125000000; 170e84a324bSAshish Kumar case QIXIS_SYSCLK_133: 171e84a324bSAshish Kumar return 133333333; 172e84a324bSAshish Kumar case QIXIS_SYSCLK_150: 173e84a324bSAshish Kumar return 150000000; 174e84a324bSAshish Kumar case QIXIS_SYSCLK_160: 175e84a324bSAshish Kumar return 160000000; 176e84a324bSAshish Kumar case QIXIS_SYSCLK_166: 177e84a324bSAshish Kumar return 166666666; 178e84a324bSAshish Kumar } 179e84a324bSAshish Kumar 180e84a324bSAshish Kumar return 66666666; 181e84a324bSAshish Kumar } 182e84a324bSAshish Kumar 183e84a324bSAshish Kumar unsigned long get_board_ddr_clk(void) 184e84a324bSAshish Kumar { 185e84a324bSAshish Kumar u8 ddrclk_conf = QIXIS_READ(brdcfg[1]); 186e84a324bSAshish Kumar 187e84a324bSAshish Kumar if (if_board_diff_clk()) 188e84a324bSAshish Kumar return get_board_sys_clk(); 189e84a324bSAshish Kumar switch ((ddrclk_conf & 0x30) >> 4) { 190e84a324bSAshish Kumar case QIXIS_DDRCLK_100: 191e84a324bSAshish Kumar return 100000000; 192e84a324bSAshish Kumar case QIXIS_DDRCLK_125: 193e84a324bSAshish Kumar return 125000000; 194e84a324bSAshish Kumar case QIXIS_DDRCLK_133: 195e84a324bSAshish Kumar return 133333333; 196e84a324bSAshish Kumar } 197e84a324bSAshish Kumar 198e84a324bSAshish Kumar return 66666666; 199e84a324bSAshish Kumar } 200e84a324bSAshish Kumar 201e84a324bSAshish Kumar int select_i2c_ch_pca9547(u8 ch) 202e84a324bSAshish Kumar { 203e84a324bSAshish Kumar int ret; 204e84a324bSAshish Kumar 205e84a324bSAshish Kumar ret = i2c_write(I2C_MUX_PCA_ADDR_PRI, 0, 1, &ch, 1); 206e84a324bSAshish Kumar if (ret) { 207e84a324bSAshish Kumar puts("PCA: failed to select proper channel\n"); 208e84a324bSAshish Kumar return ret; 209e84a324bSAshish Kumar } 210e84a324bSAshish Kumar 211e84a324bSAshish Kumar return 0; 212e84a324bSAshish Kumar } 213e84a324bSAshish Kumar 214e84a324bSAshish Kumar void board_retimer_init(void) 215e84a324bSAshish Kumar { 216e84a324bSAshish Kumar u8 reg; 217e84a324bSAshish Kumar 218e84a324bSAshish Kumar /* Retimer is connected to I2C1_CH5 */ 219e84a324bSAshish Kumar select_i2c_ch_pca9547(I2C_MUX_CH5); 220e84a324bSAshish Kumar 221e84a324bSAshish Kumar /* Access to Control/Shared register */ 222e84a324bSAshish Kumar reg = 0x0; 223e84a324bSAshish Kumar i2c_write(I2C_RETIMER_ADDR, 0xff, 1, ®, 1); 224e84a324bSAshish Kumar 225e84a324bSAshish Kumar /* Read device revision and ID */ 226e84a324bSAshish Kumar i2c_read(I2C_RETIMER_ADDR, 1, 1, ®, 1); 227e84a324bSAshish Kumar debug("Retimer version id = 0x%x\n", reg); 228e84a324bSAshish Kumar 229e84a324bSAshish Kumar /* Enable Broadcast. All writes target all channel register sets */ 230e84a324bSAshish Kumar reg = 0x0c; 231e84a324bSAshish Kumar i2c_write(I2C_RETIMER_ADDR, 0xff, 1, ®, 1); 232e84a324bSAshish Kumar 233e84a324bSAshish Kumar /* Reset Channel Registers */ 234e84a324bSAshish Kumar i2c_read(I2C_RETIMER_ADDR, 0, 1, ®, 1); 235e84a324bSAshish Kumar reg |= 0x4; 236e84a324bSAshish Kumar i2c_write(I2C_RETIMER_ADDR, 0, 1, ®, 1); 237e84a324bSAshish Kumar 238e84a324bSAshish Kumar /* Set data rate as 10.3125 Gbps */ 239e84a324bSAshish Kumar reg = 0x90; 240e84a324bSAshish Kumar i2c_write(I2C_RETIMER_ADDR, 0x60, 1, ®, 1); 241e84a324bSAshish Kumar reg = 0xb3; 242e84a324bSAshish Kumar i2c_write(I2C_RETIMER_ADDR, 0x61, 1, ®, 1); 243e84a324bSAshish Kumar reg = 0x90; 244e84a324bSAshish Kumar i2c_write(I2C_RETIMER_ADDR, 0x62, 1, ®, 1); 245e84a324bSAshish Kumar reg = 0xb3; 246e84a324bSAshish Kumar i2c_write(I2C_RETIMER_ADDR, 0x63, 1, ®, 1); 247e84a324bSAshish Kumar reg = 0xcd; 248e84a324bSAshish Kumar i2c_write(I2C_RETIMER_ADDR, 0x64, 1, ®, 1); 249e84a324bSAshish Kumar 250e84a324bSAshish Kumar /* Select VCO Divider to full rate (000) */ 251e84a324bSAshish Kumar i2c_read(I2C_RETIMER_ADDR, 0x2F, 1, ®, 1); 252e84a324bSAshish Kumar reg &= 0x0f; 253e84a324bSAshish Kumar reg |= 0x70; 254e84a324bSAshish Kumar i2c_write(I2C_RETIMER_ADDR, 0x2F, 1, ®, 1); 255e84a324bSAshish Kumar 2567769776aSAshish Kumar #ifdef CONFIG_TARGET_LS1088AQDS 2577769776aSAshish Kumar /* Retimer is connected to I2C1_CH5 */ 2587769776aSAshish Kumar select_i2c_ch_pca9547(I2C_MUX_CH5); 259e84a324bSAshish Kumar 2607769776aSAshish Kumar /* Access to Control/Shared register */ 2617769776aSAshish Kumar reg = 0x0; 2627769776aSAshish Kumar i2c_write(I2C_RETIMER_ADDR2, 0xff, 1, ®, 1); 2637769776aSAshish Kumar 2647769776aSAshish Kumar /* Read device revision and ID */ 2657769776aSAshish Kumar i2c_read(I2C_RETIMER_ADDR2, 1, 1, ®, 1); 2667769776aSAshish Kumar debug("Retimer version id = 0x%x\n", reg); 2677769776aSAshish Kumar 2687769776aSAshish Kumar /* Enable Broadcast. All writes target all channel register sets */ 2697769776aSAshish Kumar reg = 0x0c; 2707769776aSAshish Kumar i2c_write(I2C_RETIMER_ADDR2, 0xff, 1, ®, 1); 2717769776aSAshish Kumar 2727769776aSAshish Kumar /* Reset Channel Registers */ 2737769776aSAshish Kumar i2c_read(I2C_RETIMER_ADDR2, 0, 1, ®, 1); 2747769776aSAshish Kumar reg |= 0x4; 2757769776aSAshish Kumar i2c_write(I2C_RETIMER_ADDR2, 0, 1, ®, 1); 2767769776aSAshish Kumar 2777769776aSAshish Kumar /* Set data rate as 10.3125 Gbps */ 2787769776aSAshish Kumar reg = 0x90; 2797769776aSAshish Kumar i2c_write(I2C_RETIMER_ADDR2, 0x60, 1, ®, 1); 2807769776aSAshish Kumar reg = 0xb3; 2817769776aSAshish Kumar i2c_write(I2C_RETIMER_ADDR2, 0x61, 1, ®, 1); 2827769776aSAshish Kumar reg = 0x90; 2837769776aSAshish Kumar i2c_write(I2C_RETIMER_ADDR2, 0x62, 1, ®, 1); 2847769776aSAshish Kumar reg = 0xb3; 2857769776aSAshish Kumar i2c_write(I2C_RETIMER_ADDR2, 0x63, 1, ®, 1); 2867769776aSAshish Kumar reg = 0xcd; 2877769776aSAshish Kumar i2c_write(I2C_RETIMER_ADDR2, 0x64, 1, ®, 1); 2887769776aSAshish Kumar 2897769776aSAshish Kumar /* Select VCO Divider to full rate (000) */ 2907769776aSAshish Kumar i2c_read(I2C_RETIMER_ADDR2, 0x2F, 1, ®, 1); 2917769776aSAshish Kumar reg &= 0x0f; 2927769776aSAshish Kumar reg |= 0x70; 2937769776aSAshish Kumar i2c_write(I2C_RETIMER_ADDR2, 0x2F, 1, ®, 1); 2947769776aSAshish Kumar #endif 295e84a324bSAshish Kumar /*return the default channel*/ 296e84a324bSAshish Kumar select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT); 297e84a324bSAshish Kumar } 298e84a324bSAshish Kumar 299e84a324bSAshish Kumar int board_init(void) 300e84a324bSAshish Kumar { 301e84a324bSAshish Kumar init_final_memctl_regs(); 302e84a324bSAshish Kumar #if defined(CONFIG_TARGET_LS1088ARDB) && defined(CONFIG_FSL_MC_ENET) 303e84a324bSAshish Kumar u32 __iomem *irq_ccsr = (u32 __iomem *)ISC_BASE; 304e84a324bSAshish Kumar #endif 305e84a324bSAshish Kumar 306e84a324bSAshish Kumar select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT); 307e84a324bSAshish Kumar board_retimer_init(); 308e84a324bSAshish Kumar 309e84a324bSAshish Kumar #ifdef CONFIG_ENV_IS_NOWHERE 310e84a324bSAshish Kumar gd->env_addr = (ulong)&default_environment[0]; 311e84a324bSAshish Kumar #endif 312e84a324bSAshish Kumar 313e84a324bSAshish Kumar #if defined(CONFIG_TARGET_LS1088ARDB) && defined(CONFIG_FSL_MC_ENET) 314e84a324bSAshish Kumar /* invert AQR105 IRQ pins polarity */ 315e84a324bSAshish Kumar out_le32(irq_ccsr + IRQCR_OFFSET / 4, AQR105_IRQ_MASK); 316e84a324bSAshish Kumar #endif 317e84a324bSAshish Kumar 318e84a324bSAshish Kumar #ifdef CONFIG_FSL_LS_PPA 319e84a324bSAshish Kumar ppa_init(); 320e84a324bSAshish Kumar #endif 321e84a324bSAshish Kumar return 0; 322e84a324bSAshish Kumar } 323e84a324bSAshish Kumar 324e84a324bSAshish Kumar int board_early_init_f(void) 325e84a324bSAshish Kumar { 326e84a324bSAshish Kumar fsl_lsch3_early_init_f(); 327e84a324bSAshish Kumar return 0; 328e84a324bSAshish Kumar } 329e84a324bSAshish Kumar 330e84a324bSAshish Kumar void detail_board_ddr_info(void) 331e84a324bSAshish Kumar { 332e84a324bSAshish Kumar puts("\nDDR "); 333e84a324bSAshish Kumar print_size(gd->bd->bi_dram[0].size + gd->bd->bi_dram[1].size, ""); 334e84a324bSAshish Kumar print_ddr_info(0); 335e84a324bSAshish Kumar } 336e84a324bSAshish Kumar 337e84a324bSAshish Kumar #if defined(CONFIG_ARCH_MISC_INIT) 338e84a324bSAshish Kumar int arch_misc_init(void) 339e84a324bSAshish Kumar { 340e84a324bSAshish Kumar #ifdef CONFIG_FSL_CAAM 341e84a324bSAshish Kumar sec_init(); 342e84a324bSAshish Kumar #endif 343e84a324bSAshish Kumar return 0; 344e84a324bSAshish Kumar } 345e84a324bSAshish Kumar #endif 346e84a324bSAshish Kumar 347e84a324bSAshish Kumar #ifdef CONFIG_FSL_MC_ENET 348e84a324bSAshish Kumar void fdt_fixup_board_enet(void *fdt) 349e84a324bSAshish Kumar { 350e84a324bSAshish Kumar int offset; 351e84a324bSAshish Kumar 352e84a324bSAshish Kumar offset = fdt_path_offset(fdt, "/fsl-mc"); 353e84a324bSAshish Kumar 354e84a324bSAshish Kumar if (offset < 0) 355e84a324bSAshish Kumar offset = fdt_path_offset(fdt, "/fsl,dprc@0"); 356e84a324bSAshish Kumar 357e84a324bSAshish Kumar if (offset < 0) { 358e84a324bSAshish Kumar printf("%s: ERROR: fsl-mc node not found in device tree (error %d)\n", 359e84a324bSAshish Kumar __func__, offset); 360e84a324bSAshish Kumar return; 361e84a324bSAshish Kumar } 362e84a324bSAshish Kumar 363e84a324bSAshish Kumar if (get_mc_boot_status() == 0) 364e84a324bSAshish Kumar fdt_status_okay(fdt, offset); 365e84a324bSAshish Kumar else 366e84a324bSAshish Kumar fdt_status_fail(fdt, offset); 367e84a324bSAshish Kumar } 368e84a324bSAshish Kumar #endif 369e84a324bSAshish Kumar 370e84a324bSAshish Kumar #ifdef CONFIG_OF_BOARD_SETUP 371*6b6b7e8aSAshish Kumar void fsl_fdt_fixup_flash(void *fdt) 372*6b6b7e8aSAshish Kumar { 373*6b6b7e8aSAshish Kumar int offset; 374*6b6b7e8aSAshish Kumar 375*6b6b7e8aSAshish Kumar /* 376*6b6b7e8aSAshish Kumar * IFC-NOR and QSPI are muxed on SoC. 377*6b6b7e8aSAshish Kumar * So disable IFC node in dts if QSPI is enabled or 378*6b6b7e8aSAshish Kumar * disable QSPI node in dts in case QSPI is not enabled. 379*6b6b7e8aSAshish Kumar */ 380*6b6b7e8aSAshish Kumar 381*6b6b7e8aSAshish Kumar #ifdef CONFIG_FSL_QSPI 382*6b6b7e8aSAshish Kumar offset = fdt_path_offset(fdt, "/soc/ifc/nor"); 383*6b6b7e8aSAshish Kumar 384*6b6b7e8aSAshish Kumar if (offset < 0) 385*6b6b7e8aSAshish Kumar offset = fdt_path_offset(fdt, "/ifc/nor"); 386*6b6b7e8aSAshish Kumar #else 387*6b6b7e8aSAshish Kumar offset = fdt_path_offset(fdt, "/soc/quadspi"); 388*6b6b7e8aSAshish Kumar 389*6b6b7e8aSAshish Kumar if (offset < 0) 390*6b6b7e8aSAshish Kumar offset = fdt_path_offset(fdt, "/quadspi"); 391*6b6b7e8aSAshish Kumar #endif 392*6b6b7e8aSAshish Kumar if (offset < 0) 393*6b6b7e8aSAshish Kumar return; 394*6b6b7e8aSAshish Kumar 395*6b6b7e8aSAshish Kumar fdt_status_disabled(fdt, offset); 396*6b6b7e8aSAshish Kumar } 397*6b6b7e8aSAshish Kumar 398e84a324bSAshish Kumar int ft_board_setup(void *blob, bd_t *bd) 399e84a324bSAshish Kumar { 400e84a324bSAshish Kumar int err, i; 401e84a324bSAshish Kumar u64 base[CONFIG_NR_DRAM_BANKS]; 402e84a324bSAshish Kumar u64 size[CONFIG_NR_DRAM_BANKS]; 403e84a324bSAshish Kumar 404e84a324bSAshish Kumar ft_cpu_setup(blob, bd); 405e84a324bSAshish Kumar 406e84a324bSAshish Kumar /* fixup DT for the two GPP DDR banks */ 407e84a324bSAshish Kumar for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { 408e84a324bSAshish Kumar base[i] = gd->bd->bi_dram[i].start; 409e84a324bSAshish Kumar size[i] = gd->bd->bi_dram[i].size; 410e84a324bSAshish Kumar } 411e84a324bSAshish Kumar 412e84a324bSAshish Kumar #ifdef CONFIG_RESV_RAM 413e84a324bSAshish Kumar /* reduce size if reserved memory is within this bank */ 414e84a324bSAshish Kumar if (gd->arch.resv_ram >= base[0] && 415e84a324bSAshish Kumar gd->arch.resv_ram < base[0] + size[0]) 416e84a324bSAshish Kumar size[0] = gd->arch.resv_ram - base[0]; 417e84a324bSAshish Kumar else if (gd->arch.resv_ram >= base[1] && 418e84a324bSAshish Kumar gd->arch.resv_ram < base[1] + size[1]) 419e84a324bSAshish Kumar size[1] = gd->arch.resv_ram - base[1]; 420e84a324bSAshish Kumar #endif 421e84a324bSAshish Kumar 422e84a324bSAshish Kumar fdt_fixup_memory_banks(blob, base, size, CONFIG_NR_DRAM_BANKS); 423e84a324bSAshish Kumar 424*6b6b7e8aSAshish Kumar fsl_fdt_fixup_flash(blob); 425*6b6b7e8aSAshish Kumar 426e84a324bSAshish Kumar #ifdef CONFIG_FSL_MC_ENET 427e84a324bSAshish Kumar fdt_fixup_board_enet(blob); 428e84a324bSAshish Kumar err = fsl_mc_ldpaa_exit(bd); 429e84a324bSAshish Kumar if (err) 430e84a324bSAshish Kumar return err; 431e84a324bSAshish Kumar #endif 432e84a324bSAshish Kumar 433e84a324bSAshish Kumar return 0; 434e84a324bSAshish Kumar } 435e84a324bSAshish Kumar #endif 436