libmtd: allow write operations when MEMWRITE is not supported
Subsystems (2)
PATCH 1/1 libmtd: allow write operations when MEMWRITE is not supported
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)
--- lib/libmtd.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
lib/libmtd.c +1 -1
@@ -1151,7 +1151,7 @@ int mtd_write(libmtd_t desc, const struct mtd_dev_info *mtd, int fd, int eb, ret =ioctl (fd,MEMWRITE , &ops);if (ret ==0 )return 0 ; -else if (errno !=ENOTTY ) +else if (errno !=ENOTTY && errno !=EOPNOTSUPP )return mtd_ioctl_error (mtd, eb,"MEMWRITE" );/* Fall back to old methods if necessary */
Signature · 1 line
1.7.5.4
Quoted 11 lines · Brian Norris
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_oobinterface (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 <[email protected]>
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?
Quoted 1 line
From
a4699233f927738db633687a2276a9f3e127d799Mon Sep 17 00:00:00 2001
From: Artem Bityutskiy <[email protected]>
Date: Mon, 12 Dec 2011 23:24:59 +0200
Subject: [PATCH] mtd: document that MEMWRITE ioctl is NAND-specific
--- include/mtd/mtd-abi.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
include/mtd/mtd-abi.h +2 -1
@@ -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)
Signature · 1 line
1.7.6.4
Quoted 11 lines · Artem Bityutskiy
Quoted 10 lines · Brian Norris
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_oobinterface (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)
Quoted 6 lines
Quoted 1 line
Signed-off-by Brian Norris <[email protected]>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 think when (somewhat hurriedly) writing this patch, I was considering issues with the libmtd interface (mtd_write) and with the ioctl (MEMWRITE). I kinda mixed them up and wrote something that wasn't really applicable to either one. Deleting "for now" is good.
Another issue: there are strictly non-NAND flash with OOB as well, so my statement ("only supported on NAND flash") isn't quite as good as yours ("not supported for flashes without OOB, e.g., NOR flash"). Not hugely important on a mtd-utils patch though.
Quoted 1 line
I've also just pushed this patch, does it look OK to you?
Yes, it looks fine.
Brian
P.S. FYI, I don't see the mtd-utils "push" yet.
Quoted 9 lines · Brian Norris
Quoted 8 lines · Artem Bityutskiy
Quoted 7 lines · Brian Norris
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_oobinterface (and thus don't support MEMWRITE):
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
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 <[email protected]>I guess this require an urgent mtd-utils release.
OK, I've cut mtd-utils-1.4.9 bug-fix release, this time with my new script, so I hope nothing is forgotten.
Peter, please, update - this release fixes a bad bug which breaks NOR erase operation in not-yet-released 3.2 kernel.
Signature · 2 lines
Best Regards, Artem Bityutskiy
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Artem" == Artem Bityutskiy <[email protected]> writes:
Hi,
Quoted 1 line
Quoted 1 line
Quoted 1 line
I guess this require an urgent mtd-utils release.
Artem> OK, I've cut mtd-utils-1.4.9 bug-fix release, this time with my Artem> new script, so I hope nothing is forgotten.
Artem> Peter, please, update - this release fixes a bad bug which breaks NOR Artem> erase operation in not-yet-released 3.2 kernel.
Thanks for the heads up, I was just about to rebase a NOR-using platform to 3.2.
Updated buildroot. It builds fine here, so it seems like the script is working.
Signature · 1 line
Bye, Peter Korsgaard
Quoted 9 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Artem" == Artem Bityutskiy <[email protected]> writes:
Hi,
Quoted 1 line
Quoted 1 line
Quoted 1 line
I guess this require an urgent mtd-utils release.
Artem> OK, I've cut mtd-utils-1.4.9 bug-fix release, this time with my Artem> new script, so I hope nothing is forgotten.
Quoted 8 lines
Artem> Peter, please, update - this release fixes a bad bug which breaks NOR Artem> erase operation in not-yet-released 3.2 kernel.
Thanks for the heads up, I was just about to rebase a NOR-using platform to 3.2.
Updated buildroot. It builds fine here, so it seems like the script is working.
Notice also than now we also provide the mtd-utils-1.4.9.tar.bz2.asc tarball signature and we also sign the mtd-utils tags.
Signature · 2 lines
Best Regards, Artem Bityutskiy
Quoted 2 lines · Artem Bityutskiy
OK, I've cut mtd-utils-1.4.9 bug-fix release, this time with my new script, so I hope nothing is forgotten.
Well, it seems like you didn't update the master branch; I had to git fetch --tags to get to the v1.4.9 tag, which is ahead of master. I don't know if that needs/requires an update to your release script to ensure you don't miss it in the future?
Brian
Quoted 8 lines · Brian Norris
Quoted 2 lines · Artem Bityutskiy
OK, I've cut mtd-utils-1.4.9 bug-fix release, this time with my new script, so I hope nothing is forgotten.
Well, it seems like you didn't update the master branch; I had to
git fetch --tagsto get to the v1.4.9 tag, which is ahead of master. I don't know if that needs/requires an update to your release script to ensure you don't miss it in the future?
Oh, good point, I've pushed the tag but not the branch :-) Fixed, thanks!
Artem.
Quoted 3 lines · Brian Norris
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.
I've removed "for now, " because I am not sure it will ever be, and pushed this to mtd-utils.git, thanks!
Artem.