static int initr_env(void) { /* initialize environment */ if (should_load_env()) env_relocate(); else set_default_env(NULL); #ifdef CONFIG_OF_CONTROL setenv_addr("fdtcontroladdr", gd->fdt_blob); #endif /* Initialize from environment */ load_addr = getenv_ulong("loadaddr", 16, load_addr); #if defined(CONFIG_SYS_EXTBDINFO) #if defined(CONFIG_405GP) || defined(CONFIG_405EP) #if defined(CONFIG_I2CFAST) /* * set bi_iic_fast for linux taking environment variable * "i2cfast" into account */ { char *s = getenv("i2cfast"); if (s && ((*s == 'y') || (*s == 'Y'))) { gd->bd->bi_iic_fast[0] = 1; gd->bd->bi_iic_fast[1] = 1; } } #endif /* CONFIG_I2CFAST */ #endif /* CONFIG_405GP, CONFIG_405EP */ #endif /* CONFIG_SYS_EXTBDINFO */ return 0; }
void set_working_fdt_addr(void *addr) { void *buf; buf = map_sysmem((ulong)addr, 0); working_fdt = buf; setenv_addr("fdtaddr", addr); }
/* * Get the kernel partition details from SMEM and populate the, * environment with sufficient information for the boot command to * load and execute the kernel. */ int board_late_init(void) { unsigned int machid; ipq_smem_flash_info_t *sfi = &ipq_smem_flash_info; if (sfi->flash_type != SMEM_BOOT_MMC_FLASH) { ipq_get_part_details(); } /* get machine type from SMEM and set in env */ machid = gd->bd->bi_arch_number; if (machid != 0) { setenv_addr("machid", (void *)machid); gd->bd->bi_arch_number = machid; } return 0; }
/* Init common part of FM, index is fm num# like fm as above */ int fm_init_common(int index, struct ccsr_fman *reg) { int rc; #if defined(CONFIG_SYS_QE_FMAN_FW_IN_NOR) void *addr = (void *)CONFIG_SYS_QE_FMAN_FW_ADDR; #elif defined(CONFIG_SYS_QE_FMAN_FW_IN_NAND) size_t fw_length = CONFIG_SYS_QE_FMAN_FW_LENGTH; void *addr = malloc(CONFIG_SYS_QE_FMAN_FW_LENGTH); rc = nand_read(&nand_info[0], (loff_t)CONFIG_SYS_QE_FMAN_FW_ADDR, &fw_length, (u_char *)addr); if (rc == -EUCLEAN) { printf("NAND read of FMAN firmware at offset 0x%x failed %d\n", CONFIG_SYS_QE_FMAN_FW_ADDR, rc); } #elif defined(CONFIG_SYS_QE_FW_IN_SPIFLASH) struct spi_flash *ucode_flash; void *addr = malloc(CONFIG_SYS_QE_FMAN_FW_LENGTH); int ret = 0; ucode_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS, CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE); if (!ucode_flash) printf("SF: probe for ucode failed\n"); else { ret = spi_flash_read(ucode_flash, CONFIG_SYS_QE_FMAN_FW_ADDR, CONFIG_SYS_QE_FMAN_FW_LENGTH, addr); if (ret) printf("SF: read for ucode failed\n"); spi_flash_free(ucode_flash); } #elif defined(CONFIG_SYS_QE_FMAN_FW_IN_MMC) int dev = CONFIG_SYS_MMC_ENV_DEV; void *addr = malloc(CONFIG_SYS_QE_FMAN_FW_LENGTH); u32 cnt = CONFIG_SYS_QE_FMAN_FW_LENGTH / 512; u32 blk = CONFIG_SYS_QE_FMAN_FW_ADDR / 512; struct mmc *mmc = find_mmc_device(CONFIG_SYS_MMC_ENV_DEV); if (!mmc) printf("\nMMC cannot find device for ucode\n"); else { printf("\nMMC read: dev # %u, block # %u, count %u ...\n", dev, blk, cnt); mmc_init(mmc); (void)mmc->block_dev.block_read(dev, blk, cnt, addr); /* flush cache after read */ flush_cache((ulong)addr, cnt * 512); } #elif defined(CONFIG_SYS_QE_FMAN_FW_IN_REMOTE) void *addr = (void *)CONFIG_SYS_QE_FMAN_FW_ADDR; #endif /* Upload the Fman microcode if it's present */ rc = fman_upload_firmware(index, ®->fm_imem, addr); if (rc) return rc; setenv_addr("fman_ucode", addr); fm_init_muram(index, ®->muram); fm_init_qmi(®->fm_qmi_common); fm_init_fpm(®->fm_fpm); /* clear DMA status */ setbits_be32(®->fm_dma.fmdmsr, FMDMSR_CLEAR_ALL); /* set DMA mode */ setbits_be32(®->fm_dma.fmdmmr, FMDMMR_SBER); return fm_init_bmi(index, ®->fm_bmi_common); }
void set_working_fdt_addr(void *addr) { working_fdt = addr; setenv_addr("fdtaddr", addr); }