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,