mtd: dataflash OTP support
PATCH RESEND 2/2 mtd: dataflash OTP support
From: David Brownell <[email protected]>
Now that we can tell when we have one of the newer DataFlash chips, optionally expose the 128 bytes of OTP memory they provide. Tested on at45db642 revision B and D chips.
Switch mtdchar over to a generic HAVE_MTD_OTP flag instead of adding another #ifdef for each type of chip whose driver has OTP support.
Signed-off-by David Brownell <[email protected]>
---
Refreshed against latest GIT; re-verified on '642d part.
drivers/mtd/Kconfig | 5 drivers/mtd/chips/Kconfig | 1 drivers/mtd/devices/Kconfig | 11 + drivers/mtd/devices/mtd_dataflash.c | 206 ++++++++++++++++++++++++++++++++-- drivers/mtd/mtdchar.c | 4 drivers/mtd/onenand/Kconfig | 1 6 files changed, 219 insertions(+), 9 deletions(-)
drivers/mtd/Kconfig +5 -0
@@ -172,6 +172,11 @@ config MTD_CHAR memory chips, and also use ioctl() to obtain information about the device, or to erase parts of it. +config HAVE_MTD_OTP + bool + help + Enable access to OTP regions using MTD_CHAR. + config MTD_BLKDEVS tristate "Common interface to block layer for MTD 'translation layers'" depends on BLOCK
drivers/mtd/chips/Kconfig +1 -0
@@ -154,6 +154,7 @@ config MTD_CFI_I8 config MTD_OTP bool "Protection Registers aka one-time programmable (OTP) bits" depends on MTD_CFI_ADV_OPTIONS + select HAVE_MTD_OTP default n help This enables support for reading, writing and locking so called
drivers/mtd/devices/Kconfig +11 -0
@@ -59,6 +59,17 @@ config MTD_DATAFLASH Sometimes DataFlash chips are packaged inside MMC-format cards; at this writing, the MMC stack won't handle those. +config MTD_DATAFLASH_OTP + bool "DataFlash OTP support (Security Register)" + depends on MTD_DATAFLASH + select HAVE_MTD_OTP + help + Newer DataFlash chips (revisions C and D) support 128 bytes of + one-time-programmable (OTP) data. The first half may be written + (once) with up to 64 bytes of data, such as a serial number or + other key product data. The second half is programmed with a + unique-to-each-chip bit pattern at the factory. + config MTD_M25P80 tristate "Support most SPI Flash chips (AT26DF, M25P, W25X, ...)" depends on SPI_MASTER && EXPERIMENTAL
drivers/mtd/devices/mtd_dataflash.c +199 -7
249 lines not on this page · raw message
drivers/mtd/mtdchar.c +2 -2
@@ -350,7 +350,7 @@ static void mtdchar_erase_callback (struwake_up ((wait_queue_head_t *)instr->priv); } -#if defined(CONFIG_MTD_OTP ) || defined(CONFIG_MTD_ONENAND_OTP ) +#ifdef CONFIG_HAVE_MTD_OTP static int otp_select_filemode (struct mtd_file_info *mfi,int mode) {struct mtd_info *mtd = mfi->mtd;
@@ -663,7 +663,7 @@ static int mtd_ioctl(struct inode *inodebreak ; } -#if defined(CONFIG_MTD_OTP ) || defined(CONFIG_MTD_ONENAND_OTP ) +#ifdef CONFIG_HAVE_MTD_OTP case OTPSELECT : {int mode;
drivers/mtd/onenand/Kconfig +1 -0
@@ -29,6 +29,7 @@ config MTD_ONENAND_GENERIC config MTD_ONENAND_OTP bool "OneNAND OTP Support" + select HAVE_MTD_OTP help One Block of the NAND Flash Array memory is reserved as a One-Time Programmable Block memory area.