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