mtd: add an ioctl to query the lock status of a flash sector
This patchs adds a way for user space programs to find out whether a flash sector is locked. An optional driver method in the mtd_info struct provides the information. Signed-off-by: Richard Cochran <richard.cochran@omicron.at> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:

committed by
David Woodhouse

parent
1df620637f
commit
9938424f0c
@@ -63,6 +63,8 @@ static int cfi_intelext_erase_varsize(struct mtd_info *, struct erase_info *);
|
||||
static void cfi_intelext_sync (struct mtd_info *);
|
||||
static int cfi_intelext_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
|
||||
static int cfi_intelext_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
|
||||
static int cfi_intelext_is_locked(struct mtd_info *mtd, loff_t ofs,
|
||||
uint64_t len);
|
||||
#ifdef CONFIG_MTD_OTP
|
||||
static int cfi_intelext_read_fact_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
|
||||
static int cfi_intelext_read_user_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
|
||||
@@ -448,6 +450,7 @@ struct mtd_info *cfi_cmdset_0001(struct map_info *map, int primary)
|
||||
mtd->sync = cfi_intelext_sync;
|
||||
mtd->lock = cfi_intelext_lock;
|
||||
mtd->unlock = cfi_intelext_unlock;
|
||||
mtd->is_locked = cfi_intelext_is_locked;
|
||||
mtd->suspend = cfi_intelext_suspend;
|
||||
mtd->resume = cfi_intelext_resume;
|
||||
mtd->flags = MTD_CAP_NORFLASH;
|
||||
@@ -2139,6 +2142,13 @@ static int cfi_intelext_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int cfi_intelext_is_locked(struct mtd_info *mtd, loff_t ofs,
|
||||
uint64_t len)
|
||||
{
|
||||
return cfi_varsize_frob(mtd, do_getlockstatus_oneblock,
|
||||
ofs, len, NULL) ? 1 : 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MTD_OTP
|
||||
|
||||
typedef int (*otp_op_t)(struct map_info *map, struct flchip *chip,
|
||||
|
Reference in New Issue
Block a user