int mrccache_save(void) { struct mrc_data_container *data; struct mrc_region entry; struct udevice *sf; int ret; if (!gd->arch.mrc_output_len) return 0; debug("Saving %d bytes of MRC output data to SPI flash\n", gd->arch.mrc_output_len); ret = mrccache_get_region(&sf, &entry); if (ret) goto err_entry; data = (struct mrc_data_container *)gd->arch.mrc_output; ret = mrccache_update(sf, &entry, data); if (!ret) debug("Saved MRC data with checksum %04x\n", data->checksum); err_entry: if (ret) debug("%s: Failed: %d\n", __func__, ret); return ret; }
static int sdram_save_mrc_data(void) { struct mrc_data_container *data; struct fmap_entry entry; struct udevice *sf; int ret; if (!gd->arch.mrc_output_len) return 0; debug("Saving %d bytes of MRC output data to SPI flash\n", gd->arch.mrc_output_len); ret = get_mrc_entry(&sf, &entry); if (ret) goto err_entry; ret = build_mrc_data(&data); if (ret) goto err_data; ret = mrccache_update(sf, &entry, data); if (!ret) debug("Saved MRC data with checksum %04x\n", data->checksum); free(data); err_data: err_entry: if (ret) debug("%s: Failed: %d\n", __func__, ret); return ret; }