aboutsummaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2016-11-08 17:08:39 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-11-08 17:36:49 +1100
commitb36b3d1edd6654d7e4c0e2798b32ff6e4f6cd1fe (patch)
tree16d5defd8067e4a5d7496ad3ccf659f3c5d7e70b /external
parent71239ffb353db75bf2bf191949bbaa63cd44de1c (diff)
downloadskiboot-b36b3d1edd6654d7e4c0e2798b32ff6e4f6cd1fe.zip
skiboot-b36b3d1edd6654d7e4c0e2798b32ff6e4f6cd1fe.tar.gz
skiboot-b36b3d1edd6654d7e4c0e2798b32ff6e4f6cd1fe.tar.bz2
external/common: Teach ARM code to erase 'mtd chips'
Currently the arch flash code for all architectures can only perform chip erases if there is a real flash driver attached. With increasing use of MTD on both host and BMC this code needs to know how to behave of the backend of blocklevel is MTD. This patch teaches the ARM specific code to pass an erase for the full size of the chip down the stack. This can be optimised into a chip erase within the kernel. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'external')
-rw-r--r--external/common/arch_flash_arm.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/external/common/arch_flash_arm.c b/external/common/arch_flash_arm.c
index 697609d..bb8800f 100644
--- a/external/common/arch_flash_arm.c
+++ b/external/common/arch_flash_arm.c
@@ -300,8 +300,17 @@ int arch_flash_erase_chip(struct blocklevel_device *bl)
if (!arch_data.init_bl || arch_data.init_bl != bl)
return -1;
- if (!arch_data.flash_chip)
- return -1;
+ if (!arch_data.flash_chip) {
+ /* Just assume its a regular erase */
+ int rc;
+ uint64_t total_size;
+
+ rc = blocklevel_get_info(bl, NULL, &total_size, NULL);
+ if (rc)
+ return rc;
+
+ return blocklevel_erase(bl, 0, total_size);
+ }
return flash_erase_chip(arch_data.flash_chip);
}