[PATCH] libmtd: allow write operations when MEMWRITE is not supported

Artem Bityutskiy dedekind1 at gmail.com
Mon Dec 12 16:26:43 EST 2011


On Fri, 2011-12-09 at 11:45 -0800, Brian Norris wrote:
> MEMWRITE is a recently introduced write interface for MTD; however, it
> is, for now, only supported on NAND flash. mtd-utils should fall back to
> old write methods when either ENOTTY or EOPNOTSUPP are returned.
> 
> This is a showstopper when, for instance, using ubiformat on NOR, which
> don't have a mtd->write_oob interface (and thus don't support MEMWRITE):
> 
>   ubiformat: formatting eraseblock 2 --  1 % complete  libmtd: error!: MEMWRITE ioctl failed for eraseblock 2 (mtd3)
>           error 122 (Operation not supported)
> 
> Signed-off-by: Brian Norris <computersforpeace at gmail.com>

I guess this require an urgent mtd-utils release.

Also, why you say 'for now', does even make-sense to implement this for
NOR?

I've also just pushed this patch, does it look OK to you?

>From a4699233f927738db633687a2276a9f3e127d799 Mon Sep 17 00:00:00 2001
From: Artem Bityutskiy <Artem.Bityutskiy at linux.intel.com>
Date: Mon, 12 Dec 2011 23:24:59 +0200
Subject: [PATCH] mtd: document that MEMWRITE ioctl is NAND-specific

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at linux.intel.com>
---
 include/mtd/mtd-abi.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index 1a7e1d2..36eace0 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -198,7 +198,8 @@ struct otp_info {
 #define MEMISLOCKED		_IOR('M', 23, struct erase_info_user)
 /*
  * Most generic write interface; can write in-band and/or out-of-band in various
- * modes (see "struct mtd_write_req")
+ * modes (see "struct mtd_write_req"). This ioctl is not supported for flashes
+ * without OOB, e.g., NOR flash.
  */
 #define MEMWRITE		_IOWR('M', 24, struct mtd_write_req)
 
-- 
1.7.6.4






More information about the linux-mtd mailing list