Lines Matching refs:nor

7 #include <linux/mtd/spi-nor.h>
16 static int sst26vf_nor_lock(struct spi_nor *nor, loff_t ofs, uint64_t len)
21 static int sst26vf_nor_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len)
26 if (ofs != 0 || len != nor->params->size)
29 ret = spi_nor_read_cr(nor, nor->bouncebuf);
33 if (!(nor->bouncebuf[0] & SST26VF_CR_BPNV)) {
34 dev_dbg(nor->dev, "Any block has been permanently locked\n");
38 return spi_nor_global_block_unlock(nor);
41 static int sst26vf_nor_is_locked(struct spi_nor *nor, loff_t ofs, uint64_t len)
52 static int sst26vf_nor_late_init(struct spi_nor *nor)
54 nor->params->locking_ops = &sst26vf_nor_locking_ops;
129 struct spi_nor *nor = mtd_to_spi_nor(mtd);
133 dev_dbg(nor->dev, "to 0x%08x, len %zd\n", (u32)to, len);
135 ret = spi_nor_prep_and_lock(nor);
139 ret = spi_nor_write_enable(nor);
143 nor->sst_write_second = false;
147 nor->program_opcode = SPINOR_OP_BP;
150 ret = spi_nor_write_data(nor, to, 1, buf);
154 ret = spi_nor_wait_till_ready(nor);
164 nor->program_opcode = SPINOR_OP_AAI_WP;
167 ret = spi_nor_write_data(nor, to, 2, buf + actual);
171 ret = spi_nor_wait_till_ready(nor);
175 nor->sst_write_second = true;
177 nor->sst_write_second = false;
179 ret = spi_nor_write_disable(nor);
183 ret = spi_nor_wait_till_ready(nor);
189 ret = spi_nor_write_enable(nor);
193 nor->program_opcode = SPINOR_OP_BP;
194 ret = spi_nor_write_data(nor, to, 1, buf + actual);
198 ret = spi_nor_wait_till_ready(nor);
204 ret = spi_nor_write_disable(nor);
208 spi_nor_unlock_and_unprep(nor);
212 static int sst_nor_late_init(struct spi_nor *nor)
214 if (nor->info->mfr_flags & SST_WRITE)
215 nor->mtd._write = sst_nor_write;