From: Christian Hohnstaedt <chohnstaedt@innominate.com>
To: linux-mtd@lists.infradead.org
Subject: [PATCH] MTD: otp support for mtd-concat devices
Date: Mon, 12 Jun 2006 17:40:51 +0200 [thread overview]
Message-ID: <20060612154051.GK24758@tweety> (raw)
Uses the otp region of the first sub-device as otp region
of the concat device.
Signed-off-by: Christian Hohnstaedt <chohnstaedt@innominate.com>
---
drivers/mtd/mtdconcat.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 59 insertions(+), 0 deletions(-)
e50d51beab818e66b62f602c2990d27770a04d13
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c
index 1fea631..4468039 100644
--- a/drivers/mtd/mtdconcat.c
+++ b/drivers/mtd/mtdconcat.c
@@ -676,6 +676,50 @@ static int concat_block_markbad(struct m
return err;
}
+#ifdef CONFIG_MTD_OTP
+static int concat_read_user_prot_reg (struct mtd_info *mtd, loff_t from,
+ size_t len, size_t *retlen, u_char *buf)
+{
+ mtd = CONCAT(mtd)->subdev[0];
+ return mtd->read_user_prot_reg (mtd, from, len, retlen, buf);
+}
+
+static int concat_get_user_prot_info (struct mtd_info *mtd,
+ struct otp_info *buf, size_t len)
+{
+ mtd = CONCAT(mtd)->subdev[0];
+ return mtd->get_user_prot_info (mtd, buf, len);
+}
+
+static int concat_read_fact_prot_reg (struct mtd_info *mtd, loff_t from,
+ size_t len, size_t *retlen, u_char *buf)
+{
+ mtd = CONCAT(mtd)->subdev[0];
+ return mtd->read_fact_prot_reg (mtd, from, len, retlen, buf);
+}
+
+static int concat_get_fact_prot_info (struct mtd_info *mtd,
+ struct otp_info *buf, size_t len)
+{
+ mtd = CONCAT(mtd)->subdev[0];
+ return mtd->get_fact_prot_info (mtd, buf, len);
+}
+
+static int concat_write_user_prot_reg (struct mtd_info *mtd, loff_t from,
+ size_t len, size_t *retlen, u_char *buf)
+{
+ mtd = CONCAT(mtd)->subdev[0];
+ return mtd->write_user_prot_reg (mtd, from, len, retlen, buf);
+}
+
+static int concat_lock_user_prot_reg (struct mtd_info *mtd, loff_t from,
+ size_t len)
+{
+ mtd = CONCAT(mtd)->subdev[0];
+ return mtd->lock_user_prot_reg (mtd, from, len);
+}
+#endif
+
/*
* This function constructs a virtual MTD device by concatenating
* num_devs MTD devices. A pointer to the new device object is
@@ -734,6 +778,21 @@ struct mtd_info *mtd_concat_create(struc
concat->mtd.ecc_stats.badblocks = subdev[0]->ecc_stats.badblocks;
+#ifdef CONFIG_MTD_OTP
+ if (subdev[0]->read_user_prot_reg)
+ concat->mtd.read_user_prot_reg = concat_read_user_prot_reg;
+ if (subdev[0]->read_fact_prot_reg)
+ concat->mtd.read_fact_prot_reg = concat_read_fact_prot_reg;
+ if (subdev[0]->write_user_prot_reg)
+ concat->mtd.write_user_prot_reg = concat_write_user_prot_reg;
+ if (subdev[0]->lock_user_prot_reg)
+ concat->mtd.lock_user_prot_reg = concat_lock_user_prot_reg;
+ if (subdev[0]->get_user_prot_info)
+ concat->mtd.get_user_prot_info = concat_get_user_prot_info;
+ if (subdev[0]->get_fact_prot_info)
+ concat->mtd.get_fact_prot_info = concat_get_fact_prot_info;
+#endif
+
concat->subdev[0] = subdev[0];
for (i = 1; i < num_devs; i++) {
--
Christian Hohnstaedt
Software Engineer
Innominate Security Technologies AG /device attached security/
tel: +49.30.6392-3285
fax: +49.30.6392-3307
Albert-Einstein-Str. 14
D-12489 Berlin, Germany
http://www.innominate.com
reply other threads:[~2006-06-12 16:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20060612154051.GK24758@tweety \
--to=chohnstaedt@innominate.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