diff options
Diffstat (limited to 'external')
-rw-r--r-- | external/common/arch_flash_common.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/external/common/arch_flash_common.c b/external/common/arch_flash_common.c index ba06fb2..5b7f9ea 100644 --- a/external/common/arch_flash_common.c +++ b/external/common/arch_flash_common.c @@ -13,15 +13,31 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include <stdlib.h> #include <libflash/blocklevel.h> #include "arch_flash.h" -/* Default implmentations */ +/* Default implementations */ + +/* + * This just assumes that an erase from zero to total size is + * 'correct'. + * An erase from zero to total size is the correct approach for + * powerpc and x86. ARM has it own function which also includes a call + * to the flash driver. + */ int __attribute__((weak)) arch_flash_erase_chip(struct blocklevel_device *bl) { - return -1; + 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); } int __attribute__((weak)) arch_flash_4b_mode(struct blocklevel_device *bl, int set_4b) |