Add NAND chip lock/unlock support
Subsystems (2)
PATCH 1/1 Add NAND chip lock/unlock support
This patch allows the user to define platform-specific NAND lock and unlock functions.
Signed-off-by Steven J. Hill <[email protected]>
drivers/mtd/nand/nand_base.c +10 -2
@@ -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;
include/linux/mtd/nand.h +4 -0
@@ -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,
Quoted 1 line · Steven J. Hill
+ /* check if lock/unlock functions are supported *
Unterminated comment?
drivers/mtd/nand/nand_base.c line 2586
Quoted 4 lines
drivers/mtd/nand/nand_base.c +4
-0+if (!chip->lock) + mtd->lock =NULL ; +else + mtd->lock = chip->lock;
Entirely needless conditional.
Signature · 1 line
dwmw2