* [PATCH] Add NAND chip lock/unlock support
@ 2007-07-19 4:31 Steven J. Hill
2007-07-23 10:52 ` David Woodhouse
0 siblings, 1 reply; 2+ messages in thread
From: Steven J. Hill @ 2007-07-19 4:31 UTC (permalink / raw)
To: linux-mtd
[-- Attachment #1.1: Type: text/plain, Size: 152 bytes --]
This patch allows the user to define platform-specific NAND lock and
unlock functions.
Signed-off-by: Steven J. Hill <sjhill1@rockwellcollins.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: nand-chip-lock-unlock.patch --]
[-- Type: text/x-patch; name="nand-chip-lock-unlock.patch", Size: 2188 bytes --]
diff -ur linux-2.6.22/drivers/mtd/nand/nand_base.c linux-2.6.22-patched/drivers/mtd/nand/nand_base.c
--- linux-2.6.22/drivers/mtd/nand/nand_base.c 2007-07-08 18:32:17.000000000 -0500
+++ linux-2.6.22-patched/drivers/mtd/nand/nand_base.c 2007-07-14 22:44:27.339339341 -0500
@@ -2574,13 +2574,21 @@
mtd->read_oob = nand_read_oob;
mtd->write_oob = nand_write_oob;
mtd->sync = nand_sync;
- mtd->lock = NULL;
- mtd->unlock = NULL;
mtd->suspend = nand_suspend;
mtd->resume = nand_resume;
mtd->block_isbad = nand_block_isbad;
mtd->block_markbad = nand_block_markbad;
+ /* check if lock/unlock functions are supported *
+ if (!chip->lock)
+ mtd->lock = NULL;
+ else
+ mtd->lock = chip->lock;
+ if (!chip->unlock)
+ mtd->unlock = NULL;
+ else
+ mtd->unlock = chip->unlock;
+
/* propagate ecc.layout to mtd_info */
mtd->ecclayout = chip->ecc.layout;
diff -ur linux-2.6.22/include/linux/mtd/nand.h linux-2.6.22-patched/include/linux/mtd/nand.h
--- linux-2.6.22/include/linux/mtd/nand.h 2007-07-14 22:39:16.514896979 -0500
+++ linux-2.6.22-patched/include/linux/mtd/nand.h 2007-07-14 22:41:26.745129936 -0500
@@ -313,6 +313,8 @@
* @read_buf: [REPLACEABLE] read data from the chip into the buffer
* @verify_buf: [REPLACEABLE] verify buffer contents against the chip data
* @select_chip: [REPLACEABLE] select chip nr
+ * @lock: [REPLACEABLE] lock a chip or sector
+ * @unlock: [REPLACEABLE] unlock a chip or sector
* @block_bad: [REPLACEABLE] check, if the block is bad
* @block_markbad: [REPLACEABLE] mark the block bad
* @cmd_ctrl: [BOARDSPECIFIC] hardwarespecific funtion for controlling
@@ -372,6 +374,8 @@
void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len);
int (*verify_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
void (*select_chip)(struct mtd_info *mtd, int chip);
+ int (*lock)(struct mtd_info *mtd, loff_t ofs, size_t len);
+ int (*unlock)(struct mtd_info *mtd, loff_t ofs, size_t len);
int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip);
int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
void (*cmd_ctrl)(struct mtd_info *mtd, int dat,
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Add NAND chip lock/unlock support
2007-07-19 4:31 [PATCH] Add NAND chip lock/unlock support Steven J. Hill
@ 2007-07-23 10:52 ` David Woodhouse
0 siblings, 0 replies; 2+ messages in thread
From: David Woodhouse @ 2007-07-23 10:52 UTC (permalink / raw)
To: Steven J. Hill; +Cc: linux-mtd
On Wed, 2007-07-18 at 23:31 -0500, Steven J. Hill wrote:
> + /* check if lock/unlock functions are supported *
Unterminated comment?
> + if (!chip->lock)
> + mtd->lock = NULL;
> + else
> + mtd->lock = chip->lock;
Entirely needless conditional.
--
dwmw2
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-07-23 10:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-19 4:31 [PATCH] Add NAND chip lock/unlock support Steven J. Hill
2007-07-23 10:52 ` David Woodhouse
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox