int ft_board_setup(void *blob, bd_t *bd) { #ifdef CONFIG_FSL_MC_ENET int err; #endif u64 base[CONFIG_NR_DRAM_BANKS]; u64 size[CONFIG_NR_DRAM_BANKS]; ft_cpu_setup(blob, bd); /* fixup DT for the two GPP DDR banks */ base[0] = gd->bd->bi_dram[0].start; size[0] = gd->bd->bi_dram[0].size; base[1] = gd->bd->bi_dram[1].start; size[1] = gd->bd->bi_dram[1].size; fdt_fixup_memory_banks(blob, base, size, 2); #ifdef CONFIG_FSL_MC_ENET fdt_fixup_board_enet(blob); err = fsl_mc_ldpaa_exit(bd); if (err) return err; #endif return 0; }
int ft_board_setup(void *blob, bd_t *bd) { phys_addr_t base; phys_size_t size; ft_cpu_setup(blob, bd); /* limit the memory size to bank 1 until Linux can handle 40-bit PA */ base = getenv_bootm_low(); size = getenv_bootm_size(); fdt_fixup_memory(blob, (u64)base, (u64)size); #ifdef CONFIG_FSL_MC_ENET fdt_fixup_board_enet(blob); fsl_mc_ldpaa_exit(bd); #endif return 0; }
static int do_fsl_mc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int err = 0; if (argc < 3) goto usage; switch (argv[1][0]) { case 's': { char sub_cmd; u64 mc_fw_addr, mc_dpc_addr; #ifdef CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET u64 aiop_fw_addr; #endif sub_cmd = argv[2][0]; switch (sub_cmd) { case 'm': if (argc < 5) goto usage; if (get_mc_boot_status() == 0) { printf("fsl-mc: MC is already booted"); printf("\n"); return err; } mc_fw_addr = simple_strtoull(argv[3], NULL, 16); mc_dpc_addr = simple_strtoull(argv[4], NULL, 16); if (!mc_init(mc_fw_addr, mc_dpc_addr)) err = mc_init_object(); break; #ifdef CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET case 'a': if (argc < 4) goto usage; if (get_aiop_apply_status() == 0) { printf("fsl-mc: AIOP FW is already"); printf(" applied\n"); return err; } aiop_fw_addr = simple_strtoull(argv[3], NULL, 16); err = load_mc_aiop_img(aiop_fw_addr); if (!err) printf("fsl-mc: AIOP FW applied\n"); break; #endif default: printf("Invalid option: %s\n", argv[2]); goto usage; break; } } break; case 'a': { u64 mc_dpl_addr; if (argc < 4) goto usage; if (get_dpl_apply_status() == 0) { printf("fsl-mc: DPL already applied\n"); return err; } mc_dpl_addr = simple_strtoull(argv[3], NULL, 16); if (get_mc_boot_status() != 0) { printf("fsl-mc: Deploying data path layout .."); printf("ERROR (MC is not booted)\n"); return -ENODEV; } if (!fsl_mc_ldpaa_exit(NULL)) err = mc_apply_dpl(mc_dpl_addr); break; } default: printf("Invalid option: %s\n", argv[1]); goto usage; break; } return err; usage: return CMD_RET_USAGE; }
void board_quiesce_devices(void) { fsl_mc_ldpaa_exit(gd->bd); }
int fsl_mc_ldpaa_exit(bd_t *bd) { int err = 0; bool is_dpl_apply_status = false; bool mc_boot_status = false; if (bd && mc_lazy_dpl_addr && !fsl_mc_ldpaa_exit(NULL)) { err = mc_apply_dpl(mc_lazy_dpl_addr); if (!err) fdt_fixup_board_enet(working_fdt); mc_lazy_dpl_addr = 0; } if (!get_mc_boot_status()) mc_boot_status = true; /* MC is not loaded intentionally, So return success. */ if (bd && !mc_boot_status) return 0; /* If DPL is deployed, set is_dpl_apply_status as TRUE. */ if (!get_dpl_apply_status()) is_dpl_apply_status = true; /* * For case MC is loaded but DPL is not deployed, return success and * print message on console. Else FDT fix-up code execution hanged. */ if (bd && mc_boot_status && !is_dpl_apply_status) { printf("fsl-mc: DPL not deployed, DPAA2 ethernet not work\n"); goto mc_obj_cleanup; } if (bd && mc_boot_status && is_dpl_apply_status) return 0; mc_obj_cleanup: err = dpbp_exit(); if (err < 0) { printf("dpbp_exit() failed: %d\n", err); goto err; } err = dpio_exit(); if (err < 0) { printf("dpio_exit() failed: %d\n", err); goto err; } err = dpni_exit(); if (err < 0) { printf("dpni_exit() failed: %d\n", err); goto err; } err = dprc_exit(); if (err < 0) { printf("dprc_exit() failed: %d\n", err); goto err; } return 0; err: return err; }