Lines Matching full:nor
7 #include <linux/mtd/spi-nor.h>
19 static int at25fs_nor_lock(struct spi_nor *nor, loff_t ofs, uint64_t len) in at25fs_nor_lock() argument
24 static int at25fs_nor_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len) in at25fs_nor_unlock() argument
29 if (ofs || len != nor->params->size) in at25fs_nor_unlock()
33 ret = spi_nor_write_sr_and_check(nor, 0); in at25fs_nor_unlock()
35 dev_dbg(nor->dev, "unable to clear BP bits, WP# asserted?\n"); in at25fs_nor_unlock()
40 static int at25fs_nor_is_locked(struct spi_nor *nor, loff_t ofs, uint64_t len) in at25fs_nor_is_locked() argument
51 static int at25fs_nor_late_init(struct spi_nor *nor) in at25fs_nor_late_init() argument
53 nor->params->locking_ops = &at25fs_nor_locking_ops; in at25fs_nor_late_init()
64 * @nor: pointer to 'struct spi_nor'
71 static int atmel_nor_set_global_protection(struct spi_nor *nor, loff_t ofs, in atmel_nor_set_global_protection() argument
78 if (ofs || len != nor->params->size) in atmel_nor_set_global_protection()
81 ret = spi_nor_read_sr(nor, nor->bouncebuf); in atmel_nor_set_global_protection()
85 sr = nor->bouncebuf[0]; in atmel_nor_set_global_protection()
90 ret = spi_nor_write_sr_and_check(nor, sr); in atmel_nor_set_global_protection()
92 dev_dbg(nor->dev, "unable to clear SRWD bit, WP# asserted?\n"); in atmel_nor_set_global_protection()
111 nor->bouncebuf[0] = sr; in atmel_nor_set_global_protection()
118 return spi_nor_write_sr(nor, nor->bouncebuf, 1); in atmel_nor_set_global_protection()
121 static int atmel_nor_global_protect(struct spi_nor *nor, loff_t ofs, in atmel_nor_global_protect() argument
124 return atmel_nor_set_global_protection(nor, ofs, len, true); in atmel_nor_global_protect()
127 static int atmel_nor_global_unprotect(struct spi_nor *nor, loff_t ofs, in atmel_nor_global_unprotect() argument
130 return atmel_nor_set_global_protection(nor, ofs, len, false); in atmel_nor_global_unprotect()
133 static int atmel_nor_is_global_protected(struct spi_nor *nor, loff_t ofs, in atmel_nor_is_global_protected() argument
138 if (ofs >= nor->params->size || (ofs + len) > nor->params->size) in atmel_nor_is_global_protected()
141 ret = spi_nor_read_sr(nor, nor->bouncebuf); in atmel_nor_is_global_protected()
145 return ((nor->bouncebuf[0] & ATMEL_SR_GLOBAL_PROTECT_MASK) == ATMEL_SR_GLOBAL_PROTECT_MASK); in atmel_nor_is_global_protected()
154 static int atmel_nor_global_protection_late_init(struct spi_nor *nor) in atmel_nor_global_protection_late_init() argument
156 nor->params->locking_ops = &atmel_nor_global_protection_ops; in atmel_nor_global_protection_late_init()