Lines Matching full:region
28 * 256). Thus one "security register" maps to one OTP region.
155 static int spi_nor_otp_lock_bit_cr(unsigned int region) in spi_nor_otp_lock_bit_cr() argument
159 if (region >= ARRAY_SIZE(lock_bits)) in spi_nor_otp_lock_bit_cr()
162 return lock_bits[region]; in spi_nor_otp_lock_bit_cr()
166 * spi_nor_otp_lock_sr2() - lock the OTP region
168 * @region: OTP region
170 * Lock the OTP region by writing the status register-2. This method is used on
175 int spi_nor_otp_lock_sr2(struct spi_nor *nor, unsigned int region) in spi_nor_otp_lock_sr2() argument
180 lock_bit = spi_nor_otp_lock_bit_cr(region); in spi_nor_otp_lock_sr2()
188 /* no need to write the register if region is already locked */ in spi_nor_otp_lock_sr2()
198 * spi_nor_otp_is_locked_sr2() - get the OTP region lock status
200 * @region: OTP region
202 * Retrieve the OTP region lock bit by reading the status register-2. This
207 int spi_nor_otp_is_locked_sr2(struct spi_nor *nor, unsigned int region) in spi_nor_otp_is_locked_sr2() argument
212 lock_bit = spi_nor_otp_lock_bit_cr(region); in spi_nor_otp_is_locked_sr2()
223 static loff_t spi_nor_otp_region_start(const struct spi_nor *nor, unsigned int region) in spi_nor_otp_region_start() argument
227 return org->base + region * org->offset; in spi_nor_otp_region_start()
236 static loff_t spi_nor_otp_region_to_offset(struct spi_nor *nor, unsigned int region) in spi_nor_otp_region_to_offset() argument
238 return region * spi_nor_otp_region_len(nor); in spi_nor_otp_region_to_offset()
288 unsigned int region; in spi_nor_mtd_otp_range_is_locked() local
295 for (region = spi_nor_otp_offset_to_region(nor, ofs); in spi_nor_mtd_otp_range_is_locked()
296 region <= spi_nor_otp_offset_to_region(nor, ofs + len - 1); in spi_nor_mtd_otp_range_is_locked()
297 region++) { in spi_nor_mtd_otp_range_is_locked()
298 locked = ops->is_locked(nor, region); in spi_nor_mtd_otp_range_is_locked()
315 unsigned int region; in spi_nor_mtd_otp_read_write() local
346 * file offsets to the address of an OTP region as used in the in spi_nor_mtd_otp_read_write()
349 region = spi_nor_otp_offset_to_region(nor, ofs); in spi_nor_mtd_otp_read_write()
350 rstart = spi_nor_otp_region_start(nor, region); in spi_nor_mtd_otp_read_write()
353 * The size of a OTP region is expected to be a power of two, in spi_nor_mtd_otp_read_write()
355 * a region. in spi_nor_mtd_otp_read_write()
359 /* don't access beyond one OTP region */ in spi_nor_mtd_otp_read_write()
400 unsigned int region; in spi_nor_mtd_otp_erase() local
431 region = spi_nor_otp_offset_to_region(nor, from); in spi_nor_mtd_otp_erase()
432 rstart = spi_nor_otp_region_start(nor, region); in spi_nor_mtd_otp_erase()
453 unsigned int region; in spi_nor_mtd_otp_lock() local
468 region = spi_nor_otp_offset_to_region(nor, from); in spi_nor_mtd_otp_lock()
469 ret = ops->lock(nor, region); in spi_nor_mtd_otp_lock()