int fsl_mc_ldpaa_exit(bd_t *bd) { int err = 0; /* MC is not loaded intentionally, So return success. */ if (bd && get_mc_boot_status() != 0) return 0; if (bd && !get_mc_boot_status() && get_dpl_apply_status() == -1) { printf("ERROR: fsl-mc: DPL is not applied\n"); err = -ENODEV; return err; } if (bd && !get_mc_boot_status() && !get_dpl_apply_status()) return err; 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; }
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; }