[MTD] User interface to Protection Registers

This is implemented using a ioctl to switch the MTD char device into
one of the different OTP "modes", at which point read/write/seek can
operate on the selected OTP area.  Also some extra ioctls to query
for size and lock protection segments or groups.  Some example user
space utilities are provided.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
Nicolas Pitre
2005-02-08 17:45:55 +00:00
committed by Thomas Gleixner
parent f77814dd57
commit 31f4233bae
2 changed files with 120 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: mtd-abi.h,v 1.8 2005/02/08 17:11:16 nico Exp $
* $Id: mtd-abi.h,v 1.9 2005/02/08 17:45:52 nico Exp $
*
* Portions of MTD ABI definition which are shared by kernel and user space
*/
@ -61,6 +61,11 @@ struct mtd_oob_buf {
#define MTD_NANDECC_AUTOPLACE 2 // Use the default placement scheme
#define MTD_NANDECC_PLACEONLY 3 // Use the given placement in the structure (Do not store ecc result on read)
/* OTP mode selection */
#define MTD_OTP_OFF 0
#define MTD_OTP_FACTORY 1
#define MTD_OTP_USER 2
struct mtd_info_user {
uint8_t type;
uint32_t flags;
@ -98,6 +103,10 @@ struct otp_info {
#define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo)
#define MEMGETBADBLOCK _IOW('M', 11, loff_t)
#define MEMSETBADBLOCK _IOW('M', 12, loff_t)
#define OTPSELECT _IOR('M', 13, int)
#define OTPGETREGIONCOUNT _IOW('M', 14, int)
#define OTPGETREGIONINFO _IOW('M', 15, struct otp_info)
#define OTPLOCK _IOR('M', 16, struct otp_info)
struct nand_oobinfo {
uint32_t useecc;