Lines Matching +full:spi +full:- +full:nor

1 /* SPDX-License-Identifier: GPL-2.0 */
21 /* Standard SPI NOR flash operations. */
162 /* Dual SPI */
168 /* Quad SPI */
174 /* Octal SPI */
187 /* Quad SPI */
192 /* Octal SPI */
202 * struct spi_nor_erase_type - Structure to describe a SPI NOR erase type
208 * @opcode: the SPI command op code to erase the sector/block.
223 * struct spi_nor_erase_command - Used for non-uniform erases
226 * are run-length encoded.
231 * @opcode: the SPI command op code to erase the sector/block.
241 * struct spi_nor_erase_region - Structure to describe a SPI NOR erase region
245 * the last in the SPI NOR flash memory and to indicate
257 #define SNOR_ERASE_TYPE_MASK GENMASK_ULL(SNOR_ERASE_TYPE_MAX - 1, 0)
263 #define SNOR_ERASE_FLAGS_MASK GENMASK_ULL(SNOR_ERASE_FLAGS_MAX - 1, 0)
266 * struct spi_nor_erase_map - Structure to describe the SPI NOR erase map
270 * @uniform_region: a pre-allocated erase region for SPI NOR with a uniform
278 * uniform and non-uniform SPI NOR flash memories if they
290 * struct spi_nor_locking_ops - SPI NOR locking methods
291 * @lock: lock a region of the SPI NOR.
292 * @unlock: unlock a region of the SPI NOR.
293 * @is_locked: check if a region of the SPI NOR is completely locked
296 int (*lock)(struct spi_nor *nor, loff_t ofs, u64 len);
297 int (*unlock)(struct spi_nor *nor, loff_t ofs, u64 len);
298 int (*is_locked)(struct spi_nor *nor, loff_t ofs, u64 len);
302 * struct spi_nor_otp_organization - Structure to describe the SPI NOR OTP regions
317 * struct spi_nor_otp_ops - SPI NOR OTP methods
318 * @read: read from the SPI NOR OTP area.
319 * @write: write to the SPI NOR OTP area.
322 * @is_locked: check if an OTP region of the SPI NOR is locked.
325 int (*read)(struct spi_nor *nor, loff_t addr, size_t len, u8 *buf);
326 int (*write)(struct spi_nor *nor, loff_t addr, size_t len,
328 int (*lock)(struct spi_nor *nor, unsigned int region);
329 int (*erase)(struct spi_nor *nor, loff_t addr);
330 int (*is_locked)(struct spi_nor *nor, unsigned int region);
334 * struct spi_nor_otp - SPI NOR OTP grouping structure
344 * struct spi_nor_flash_parameter - SPI NOR flash parameters and settings.
352 * ECC unit size for ECC-ed flashes.
353 * @page_size: the page size of the SPI NOR flash memory.
375 * @otp: SPI NOR OTP info.
376 * @set_octal_dtr: enables or disables SPI NOR octal DTR mode.
377 * @quad_enable: enables SPI NOR quad mode.
378 * @set_4byte_addr_mode: puts the SPI NOR in 4 byte addressing mode.
381 * not a power-of-2.
382 * @setup: (optional) configures the SPI NOR memory. Useful for
383 * SPI NOR flashes that have peculiarities to the SPI NOR
389 * @locking_ops: SPI NOR locking methods.
413 int (*set_octal_dtr)(struct spi_nor *nor, bool enable);
414 int (*quad_enable)(struct spi_nor *nor);
415 int (*set_4byte_addr_mode)(struct spi_nor *nor, bool enable);
416 u32 (*convert_addr)(struct spi_nor *nor, u32 addr);
417 int (*setup)(struct spi_nor *nor, const struct spi_nor_hwcaps *hwcaps);
418 int (*ready)(struct spi_nor *nor);
425 * struct spi_nor_fixups - SPI NOR fixup hooks
430 * @post_sfdp: called after SFDP has been parsed (is also called for SPI NORs
439 * Those hooks can be used to tweak the SPI NOR configuration when the SFDP
443 void (*default_init)(struct spi_nor *nor);
444 int (*post_bfpt)(struct spi_nor *nor,
447 int (*post_sfdp)(struct spi_nor *nor);
448 int (*late_init)(struct spi_nor *nor);
452 * struct spi_nor_id - SPI NOR flash ID.
465 * struct flash_info - SPI NOR flash_info entry.
484 * SPI_NOR_4BIT_BP: flash SR has 4 bit fields (BP0-3) for block
489 * Usually these will power-up in a write-protected
579 * struct spi_nor_manufacturer - SPI NOR manufacturer object
593 * struct sfdp - SFDP data
621 void spi_nor_spimem_setup_op(const struct spi_nor *nor,
624 int spi_nor_write_enable(struct spi_nor *nor);
625 int spi_nor_write_disable(struct spi_nor *nor);
626 int spi_nor_set_4byte_addr_mode_en4b_ex4b(struct spi_nor *nor, bool enable);
627 int spi_nor_set_4byte_addr_mode_wren_en4b_ex4b(struct spi_nor *nor,
629 int spi_nor_set_4byte_addr_mode_brwr(struct spi_nor *nor, bool enable);
630 int spi_nor_set_4byte_addr_mode(struct spi_nor *nor, bool enable);
631 int spi_nor_wait_till_ready(struct spi_nor *nor);
632 int spi_nor_global_block_unlock(struct spi_nor *nor);
633 int spi_nor_prep_and_lock(struct spi_nor *nor);
634 void spi_nor_unlock_and_unprep(struct spi_nor *nor);
635 int spi_nor_sr1_bit6_quad_enable(struct spi_nor *nor);
636 int spi_nor_sr2_bit1_quad_enable(struct spi_nor *nor);
637 int spi_nor_sr2_bit7_quad_enable(struct spi_nor *nor);
638 int spi_nor_read_id(struct spi_nor *nor, u8 naddr, u8 ndummy, u8 *id,
640 int spi_nor_read_sr(struct spi_nor *nor, u8 *sr);
641 int spi_nor_sr_ready(struct spi_nor *nor);
642 int spi_nor_read_cr(struct spi_nor *nor, u8 *cr);
643 int spi_nor_write_sr(struct spi_nor *nor, const u8 *sr, size_t len);
644 int spi_nor_write_sr_and_check(struct spi_nor *nor, u8 sr1);
645 int spi_nor_write_16bit_cr_and_check(struct spi_nor *nor, u8 cr);
647 ssize_t spi_nor_read_data(struct spi_nor *nor, loff_t from, size_t len,
649 ssize_t spi_nor_write_data(struct spi_nor *nor, loff_t to, size_t len,
651 int spi_nor_read_any_reg(struct spi_nor *nor, struct spi_mem_op *op,
653 int spi_nor_write_any_volatile_reg(struct spi_nor *nor, struct spi_mem_op *op,
655 int spi_nor_erase_sector(struct spi_nor *nor, u32 addr);
657 int spi_nor_otp_read_secr(struct spi_nor *nor, loff_t addr, size_t len, u8 *buf);
658 int spi_nor_otp_write_secr(struct spi_nor *nor, loff_t addr, size_t len,
660 int spi_nor_otp_erase_secr(struct spi_nor *nor, loff_t addr);
661 int spi_nor_otp_lock_sr2(struct spi_nor *nor, unsigned int region);
662 int spi_nor_otp_is_locked_sr2(struct spi_nor *nor, unsigned int region);
683 int spi_nor_post_bfpt_fixups(struct spi_nor *nor,
687 void spi_nor_init_default_locking_ops(struct spi_nor *nor);
688 void spi_nor_try_unlock_all(struct spi_nor *nor);
689 void spi_nor_set_mtd_locking_ops(struct spi_nor *nor);
690 void spi_nor_set_mtd_otp_ops(struct spi_nor *nor);
692 int spi_nor_controller_ops_read_reg(struct spi_nor *nor, u8 opcode,
694 int spi_nor_controller_ops_write_reg(struct spi_nor *nor, u8 opcode,
697 int spi_nor_check_sfdp_signature(struct spi_nor *nor);
698 int spi_nor_parse_sfdp(struct spi_nor *nor);
706 * spi_nor_needs_sfdp() - returns true if SFDP parsing is used for this flash.
710 static inline bool spi_nor_needs_sfdp(const struct spi_nor *nor) in spi_nor_needs_sfdp() argument
715 * non-legacy flash entries in flash_info will have a size of zero iff in spi_nor_needs_sfdp()
718 return !nor->info->size; in spi_nor_needs_sfdp()
722 void spi_nor_debugfs_register(struct spi_nor *nor);
725 static inline void spi_nor_debugfs_register(struct spi_nor *nor) {} in spi_nor_debugfs_register() argument