diff options
author | Joel Stanley <joel@jms.id.au> | 2016-11-03 12:55:36 +1030 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2016-11-04 02:06:03 +0000 |
commit | ead1c62dca8f8237ad3a898ca0af4d48e3855ff2 (patch) | |
tree | ba63b3d8d9d095031aa9741e2e242d5955da158c /op-flasher | |
parent | 29eaf4d4143056d271ee65f1c6126c533b87a49d (diff) | |
download | talos-skeleton-ead1c62dca8f8237ad3a898ca0af4d48e3855ff2.tar.gz talos-skeleton-ead1c62dca8f8237ad3a898ca0af4d48e3855ff2.zip |
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>
Diffstat (limited to 'op-flasher')
-rw-r--r-- | op-flasher/flasher_obj.c | 22 |
1 files changed, 7 insertions, 15 deletions
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 @@ flash_access_cleanup(void) } 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 @@ flash_access_setup(enum bmc_access chip) } 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 @@ on_bus_acquired(GDBusConnection *connection, /* 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 */ |