aboutsummaryrefslogtreecommitdiff
path: root/external/common
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2016-11-08 17:08:40 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-11-08 17:36:58 +1100
commit71f77880462e72b9888237ae8f1fbdf36da2ef0e (patch)
tree5647874981ab18083e3f2d107acfa861cb407f36 /external/common
parentb36b3d1edd6654d7e4c0e2798b32ff6e4f6cd1fe (diff)
downloadskiboot-71f77880462e72b9888237ae8f1fbdf36da2ef0e.zip
skiboot-71f77880462e72b9888237ae8f1fbdf36da2ef0e.tar.gz
skiboot-71f77880462e72b9888237ae8f1fbdf36da2ef0e.tar.bz2
external/common: Add default erase chip implementation
Just blocklevel_erase() from zero to sizeof. 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/common')
-rw-r--r--external/common/arch_flash_common.c20
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)