summaryrefslogtreecommitdiffstats
path: root/mtdutils/bml_over_mtd.c
diff options
context:
space:
mode:
Diffstat (limited to 'mtdutils/bml_over_mtd.c')
-rw-r--r--mtdutils/bml_over_mtd.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/mtdutils/bml_over_mtd.c b/mtdutils/bml_over_mtd.c
index c40179281..a68950e40 100644
--- a/mtdutils/bml_over_mtd.c
+++ b/mtdutils/bml_over_mtd.c
@@ -31,6 +31,10 @@
#include "mtdutils.h"
+#ifdef RK3066
+ #include "rk30hack.h"
+#endif
+
typedef struct BmlOverMtdReadContext {
const MtdPartition *partition;
char *buffer;
@@ -518,11 +522,19 @@ static ssize_t bml_over_mtd_write_block(int fd, ssize_t erase_size, char* data)
erase_info.length = size;
int retry;
for (retry = 0; retry < 2; ++retry) {
+#ifdef RK3066
+ if (rk30_zero_out(fd, pos, size) < 0) {
+ fprintf(stderr, "mtd: erase failure at 0x%08lx (%s)\n",
+ pos, strerror(errno));
+ continue;
+ }
+#else
if (ioctl(fd, MEMERASE, &erase_info) < 0) {
fprintf(stderr, "mtd: erase failure at 0x%08lx (%s)\n",
pos, strerror(errno));
continue;
}
+#endif
if (lseek(fd, pos, SEEK_SET) != pos ||
write(fd, data, size) != size) {
fprintf(stderr, "mtd: write error at 0x%08lx (%s)\n",