Lines Matching refs:ofs
50 static void spi_nor_get_locked_range_sr(struct spi_nor *nor, u8 sr, loff_t *ofs,
66 *ofs = 0;
78 *ofs = 0;
80 *ofs = mtd->size - *len;
87 static bool spi_nor_check_lock_status_sr(struct spi_nor *nor, loff_t ofs,
99 offs_max = ofs + len;
103 return (offs_max <= lock_offs_max) && (ofs >= lock_offs);
106 return (ofs >= lock_offs_max) || (offs_max <= lock_offs);
109 static bool spi_nor_is_locked_sr(struct spi_nor *nor, loff_t ofs, uint64_t len,
112 return spi_nor_check_lock_status_sr(nor, ofs, len, sr, true);
115 static bool spi_nor_is_unlocked_sr(struct spi_nor *nor, loff_t ofs,
118 return spi_nor_check_lock_status_sr(nor, ofs, len, sr, false);
154 static int spi_nor_sr_lock(struct spi_nor *nor, loff_t ofs, uint64_t len)
173 if (spi_nor_is_locked_sr(nor, ofs, len, status_old))
177 if (!spi_nor_is_locked_sr(nor, 0, ofs, status_old))
181 if (!spi_nor_is_locked_sr(nor, ofs + len, mtd->size - (ofs + len),
193 lock_len = mtd->size - ofs;
195 lock_len = ofs + len;
244 static int spi_nor_sr_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len)
263 if (spi_nor_is_unlocked_sr(nor, ofs, len, status_old))
267 if (!spi_nor_is_unlocked_sr(nor, 0, ofs, status_old))
271 if (!spi_nor_is_unlocked_sr(nor, ofs + len, mtd->size - (ofs + len),
283 lock_len = mtd->size - (ofs + len);
285 lock_len = ofs;
329 static int spi_nor_sr_is_locked(struct spi_nor *nor, loff_t ofs, uint64_t len)
337 return spi_nor_is_locked_sr(nor, ofs, len, nor->bouncebuf[0]);
351 static int spi_nor_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
360 ret = nor->params->locking_ops->lock(nor, ofs, len);
366 static int spi_nor_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
375 ret = nor->params->locking_ops->unlock(nor, ofs, len);
381 static int spi_nor_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
390 ret = nor->params->locking_ops->is_locked(nor, ofs, len);