From 9815abeaea4b663c3545ebfbedc5ea5f4593e6a2 Mon Sep 17 00:00:00 2001 From: Gary Bisson <gary.bisson@boundarydevices.com> Date: Tue, 7 Mar 2017 18:01:12 +0100 Subject: [PATCH] image-sparse: disable data cache to avoid misaligned warnings Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com> --- lib/image-sparse.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/image-sparse.c b/lib/image-sparse.c index 036062139bb..ef959f3cd9c 100644 --- a/lib/image-sparse.c +++ b/lib/image-sparse.c @@ -62,6 +62,7 @@ int write_sparse_image(struct sparse_storage *info, chunk_header_t *chunk_header; uint32_t total_blocks = 0; int fill_buf_num_blks; + int dcache_enabled = dcache_status(); int i; int j; @@ -106,6 +107,10 @@ int write_sparse_image(struct sparse_storage *info, puts("Flashing Sparse Image\n"); + /* Disable data cache since chunks might not be aligned */ + if (dcache_enabled) + dcache_disable(); + /* Start processing chunks */ blk = info->start; for (chunk = 0; chunk < sparse_header->total_chunks; chunk++) { @@ -248,6 +253,10 @@ int write_sparse_image(struct sparse_storage *info, } } + /* Re-enable data cache it in case it was in the first place */ + if (dcache_enabled) + dcache_enable(); + debug("Wrote %d blocks, expected to write %d blocks\n", total_blocks, sparse_header->total_blks); printf("........ wrote %u bytes to '%s'\n", bytes_written, part_name); -- GitLab