From eb76931e7ae7ddd2eefd0d35ebea9c9b3cb276d9 Mon Sep 17 00:00:00 2001 From: Oliver O'Halloran Date: Wed, 8 Nov 2017 19:59:17 +1100 Subject: gard: Always use MTD to access flash Direct mode is generally either unsafe or unsupported. We should always access the PNOR via an MTD device so make that the default. If someone really needs direct mode, then they can use pflash. Signed-off-by: Oliver O'Halloran Signed-off-by: Stewart Smith --- external/gard/gard.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'external') diff --git a/external/gard/gard.c b/external/gard/gard.c index 1ee54e6..8152434 100644 --- a/external/gard/gard.c +++ b/external/gard/gard.c @@ -879,6 +879,14 @@ int main(int argc, char **argv) #endif } + /* + * Force libflash to do flash accesses via the MTD. Direct mode is + * generally unsafe since it fiddles with the flash controller state + * underneath the kernel. Anyone who needs direct mode can use pflash + * instead. + */ + arch_flash_access(ctx->bl, PNOR_MTD); + if (arch_flash_init(&(ctx->bl), filename, true)) { /* Can fail for a few ways, most likely couldn't open MTD device */ fprintf(stderr, "Can't open %s\n", filename ? filename : "MTD Device. Are you root?"); -- cgit v1.1