flasher: Move to new libflash API
The new API unifies the PNOR and MTD flash access functions so we can
call the one API.
Change-Id: I49705f14d3433b3a1f4b7d70bccaeea7b494d6a6
Signed-off-by: Joel Stanley <joel@jms.id.au>
diff --git a/op-flasher/flasher_obj.c b/op-flasher/flasher_obj.c
index 0a8a50f..f256679 100644
--- a/op-flasher/flasher_obj.c
+++ b/op-flasher/flasher_obj.c
@@ -166,23 +166,15 @@
}
static int
-flash_access_setup(enum bmc_access chip)
+flash_access_setup(enum flash_access chip)
{
int rc;
printf("Setting up flash\n");
- if (chip == BMC_MTD) {
- rc = arch_flash_bmc(bl, chip);
- if (rc != BMC_MTD) {
- fprintf(stderr, "Failed to init flash chip\n");
- return FLASH_SETUP_ERROR;
- }
- } else {
- rc = arch_flash_init(&bl, NULL, true);
- if(rc) {
- fprintf(stderr, "Failed to init flash chip\n");
- return FLASH_SETUP_ERROR;
- }
+ rc = arch_flash_access(bl, chip);
+ if (rc != chip) {
+ fprintf(stderr, "Failed to init flash chip\n");
+ return FLASH_SETUP_ERROR;
}
/* Setup cleanup function */
@@ -191,7 +183,7 @@
}
uint8_t
-flash(FlashControl* flash_control, enum bmc_access chip, uint32_t address, char* write_file, char* obj_path)
+flash(FlashControl* flash_control, enum flash_access chip, uint32_t address, char* write_file, char* obj_path)
{
int rc;
printf("flasher: %s, BMC = %d, address = 0x%x\n", write_file, chip, address);
@@ -256,7 +248,7 @@
/* Export all objects */
g_dbus_object_manager_server_set_connection(manager, connection);
- enum bmc_access chip = PNOR_MTD;
+ enum flash_access chip = PNOR_MTD;
uint32_t address = 0;
/* TODO: Look up all partitions from the device tree or /proc/mtd */