diff options
author | Richard Cochran <richardcochran@gmail.com> | 2010-06-14 12:10:33 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-08-02 04:03:41 -0400 |
commit | 9938424f0c4d208883cbf32083ec2bfcc220f85b (patch) | |
tree | e4f7581c7543673fe63c98f9804e934a77aeb7ef /drivers/mtd/chips | |
parent | 1df620637fc3b252b69c92ced486b5b6b643dd1a (diff) |
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>
Diffstat (limited to 'drivers/mtd/chips')
-rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0001.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index 62f3ea9de848..2fadb0239ba3 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c | |||
@@ -63,6 +63,8 @@ static int cfi_intelext_erase_varsize(struct mtd_info *, struct erase_info *); | |||
63 | static void cfi_intelext_sync (struct mtd_info *); | 63 | static void cfi_intelext_sync (struct mtd_info *); |
64 | static int cfi_intelext_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len); | 64 | static int cfi_intelext_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len); |
65 | static int cfi_intelext_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); | 65 | static int cfi_intelext_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); |
66 | static int cfi_intelext_is_locked(struct mtd_info *mtd, loff_t ofs, | ||
67 | uint64_t len); | ||
66 | #ifdef CONFIG_MTD_OTP | 68 | #ifdef CONFIG_MTD_OTP |
67 | static int cfi_intelext_read_fact_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *); | 69 | static int cfi_intelext_read_fact_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *); |
68 | static int cfi_intelext_read_user_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *); | 70 | 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) | |||
448 | mtd->sync = cfi_intelext_sync; | 450 | mtd->sync = cfi_intelext_sync; |
449 | mtd->lock = cfi_intelext_lock; | 451 | mtd->lock = cfi_intelext_lock; |
450 | mtd->unlock = cfi_intelext_unlock; | 452 | mtd->unlock = cfi_intelext_unlock; |
453 | mtd->is_locked = cfi_intelext_is_locked; | ||
451 | mtd->suspend = cfi_intelext_suspend; | 454 | mtd->suspend = cfi_intelext_suspend; |
452 | mtd->resume = cfi_intelext_resume; | 455 | mtd->resume = cfi_intelext_resume; |
453 | mtd->flags = MTD_CAP_NORFLASH; | 456 | mtd->flags = MTD_CAP_NORFLASH; |
@@ -2139,6 +2142,13 @@ static int cfi_intelext_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) | |||
2139 | return ret; | 2142 | return ret; |
2140 | } | 2143 | } |
2141 | 2144 | ||
2145 | static int cfi_intelext_is_locked(struct mtd_info *mtd, loff_t ofs, | ||
2146 | uint64_t len) | ||
2147 | { | ||
2148 | return cfi_varsize_frob(mtd, do_getlockstatus_oneblock, | ||
2149 | ofs, len, NULL) ? 1 : 0; | ||
2150 | } | ||
2151 | |||
2142 | #ifdef CONFIG_MTD_OTP | 2152 | #ifdef CONFIG_MTD_OTP |
2143 | 2153 | ||
2144 | typedef int (*otp_op_t)(struct map_info *map, struct flchip *chip, | 2154 | typedef int (*otp_op_t)(struct map_info *map, struct flchip *chip, |