Lines Matching full:nor
7 #include <linux/mtd/spi-nor.h>
19 static int atmel_at25fs_lock(struct spi_nor *nor, loff_t ofs, uint64_t len) in atmel_at25fs_lock() argument
24 static int atmel_at25fs_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len) in atmel_at25fs_unlock() argument
29 if (ofs || len != nor->params->size) in atmel_at25fs_unlock()
33 ret = spi_nor_write_sr_and_check(nor, 0); in atmel_at25fs_unlock()
35 dev_dbg(nor->dev, "unable to clear BP bits, WP# asserted?\n"); in atmel_at25fs_unlock()
40 static int atmel_at25fs_is_locked(struct spi_nor *nor, loff_t ofs, uint64_t len) in atmel_at25fs_is_locked() argument
51 static void atmel_at25fs_default_init(struct spi_nor *nor) in atmel_at25fs_default_init() argument
53 nor->params->locking_ops = &atmel_at25fs_locking_ops; in atmel_at25fs_default_init()
62 * @nor: pointer to 'struct spi_nor'
69 static int atmel_set_global_protection(struct spi_nor *nor, loff_t ofs, in atmel_set_global_protection() argument
76 if (ofs || len != nor->params->size) in atmel_set_global_protection()
79 ret = spi_nor_read_sr(nor, nor->bouncebuf); in atmel_set_global_protection()
83 sr = nor->bouncebuf[0]; in atmel_set_global_protection()
88 ret = spi_nor_write_sr_and_check(nor, sr); in atmel_set_global_protection()
90 dev_dbg(nor->dev, "unable to clear SRWD bit, WP# asserted?\n"); in atmel_set_global_protection()
109 nor->bouncebuf[0] = sr; in atmel_set_global_protection()
116 return spi_nor_write_sr(nor, nor->bouncebuf, 1); in atmel_set_global_protection()
119 static int atmel_global_protect(struct spi_nor *nor, loff_t ofs, uint64_t len) in atmel_global_protect() argument
121 return atmel_set_global_protection(nor, ofs, len, true); in atmel_global_protect()
124 static int atmel_global_unprotect(struct spi_nor *nor, loff_t ofs, uint64_t len) in atmel_global_unprotect() argument
126 return atmel_set_global_protection(nor, ofs, len, false); in atmel_global_unprotect()
129 static int atmel_is_global_protected(struct spi_nor *nor, loff_t ofs, uint64_t len) in atmel_is_global_protected() argument
133 if (ofs >= nor->params->size || (ofs + len) > nor->params->size) in atmel_is_global_protected()
136 ret = spi_nor_read_sr(nor, nor->bouncebuf); in atmel_is_global_protected()
140 return ((nor->bouncebuf[0] & ATMEL_SR_GLOBAL_PROTECT_MASK) == ATMEL_SR_GLOBAL_PROTECT_MASK); in atmel_is_global_protected()
149 static void atmel_global_protection_default_init(struct spi_nor *nor) in atmel_global_protection_default_init() argument
151 nor->params->locking_ops = &atmel_global_protection_ops; in atmel_global_protection_default_init()