From: "Steven J. Hill" <sjhill@realitydiluted.com>
To: linux-mtd@lists.infradead.org
Subject: [PATCH] Add NAND chip lock/unlock support
Date: Wed, 18 Jul 2007 23:31:14 -0500 [thread overview]
Message-ID: <469EE912.6080307@realitydiluted.com> (raw)
[-- 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 --]
next reply other threads:[~2007-07-19 4:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-19 4:31 Steven J. Hill [this message]
2007-07-23 10:52 ` [PATCH] Add NAND chip lock/unlock support David Woodhouse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=469EE912.6080307@realitydiluted.com \
--to=sjhill@realitydiluted.com \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox