Lines Matching +full:spi +full:- +full:nor
1 // SPDX-License-Identifier: GPL-2.0
23 #define SNOR_MFR_ST CFI_MFR_ST /* ST Micro <--> Micron */
24 #define SNOR_MFR_MICRON CFI_MFR_MICRON /* ST Micro <--> Micron */
37 * requires a 4-byte (32-bit) address.
48 #define SPINOR_OP_READ_1_1_2 0x3b /* Read data bytes (Dual Output SPI) */
49 #define SPINOR_OP_READ_1_2_2 0xbb /* Read data bytes (Dual I/O SPI) */
50 #define SPINOR_OP_READ_1_1_4 0x6b /* Read data bytes (Quad Output SPI) */
51 #define SPINOR_OP_READ_1_4_4 0xeb /* Read data bytes (Quad I/O SPI) */
68 /* 4-byte address opcodes - used on Spansion and some Macronix flashes. */
71 #define SPINOR_OP_READ_1_1_2_4B 0x3c /* Read data bytes (Dual Output SPI) */
72 #define SPINOR_OP_READ_1_2_2_4B 0xbc /* Read data bytes (Dual I/O SPI) */
73 #define SPINOR_OP_READ_1_1_4_4B 0x6c /* Read data bytes (Quad Output SPI) */
74 #define SPINOR_OP_READ_1_4_4_4B 0xec /* Read data bytes (Quad I/O SPI) */
82 /* Double Transfer Rate opcodes - defined in JEDEC JESD216B. */
108 #define SPINOR_OP_EN4B 0xb7 /* Enter 4-byte mode */
109 #define SPINOR_OP_EX4B 0xe9 /* Exit 4-byte mode */
118 #define SPINOR_OP_EX4B_CYPRESS 0xB8 /* Exit 4-byte mode */
165 /* Supported SPI protocols */
260 * struct flash_info - Forward declaration of a structure used internally by
269 * struct spi_nor - Structure for defining a the SPI NOR layer
272 * @dev: point to a spi device, or a spi nor controller device.
273 * @info: spi-nor part JDEC MFR id and other info
274 * @page_size: the page size of the SPI NOR
284 * @flags: flag options for the current SPI-NOR (SNOR_F_*)
285 * @read_proto: the SPI protocol for read operations
286 * @write_proto: the SPI protocol for write operations
287 * @reg_proto the SPI protocol for read_reg/write_reg/erase operations
293 * @read_reg: [DRIVER-SPECIFIC] read out the register
294 * @write_reg: [DRIVER-SPECIFIC] write data to the register
295 * @read: [DRIVER-SPECIFIC] read data from the SPI NOR
296 * @write: [DRIVER-SPECIFIC] write data to the SPI NOR
297 * @erase: [DRIVER-SPECIFIC] erase a sector of the SPI NOR
299 * spi-nor will send the erase opcode via write_reg()
300 * @flash_lock: [FLASH-SPECIFIC] lock a region of the SPI NOR
301 * @flash_unlock: [FLASH-SPECIFIC] unlock a region of the SPI NOR
302 * @flash_is_locked: [FLASH-SPECIFIC] check if a region of the SPI NOR is
303 * @quad_enable: [FLASH-SPECIFIC] enables SPI NOR quad mode
310 struct spi_slave *spi; member
330 int (*prepare)(struct spi_nor *nor, enum spi_nor_ops ops);
331 void (*unprepare)(struct spi_nor *nor, enum spi_nor_ops ops);
332 int (*read_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len);
333 int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len);
335 ssize_t (*read)(struct spi_nor *nor, loff_t from,
337 ssize_t (*write)(struct spi_nor *nor, loff_t to,
339 int (*erase)(struct spi_nor *nor, loff_t offs);
341 int (*flash_lock)(struct spi_nor *nor, loff_t ofs, uint64_t len);
342 int (*flash_unlock)(struct spi_nor *nor, loff_t ofs, uint64_t len);
343 int (*flash_is_locked)(struct spi_nor *nor, loff_t ofs, uint64_t len);
344 int (*quad_enable)(struct spi_nor *nor);
345 int (*flash_lock_by_host_ctrl)(struct spi_nor *nor, u32 ofs, size_t len);
346 int (*flash_unlock_by_host_ctrl)(struct spi_nor *nor, u32 ofs, size_t len);
356 static inline void spi_nor_set_flash_node(struct spi_nor *nor, in spi_nor_set_flash_node() argument
359 mtd_set_of_node(&nor->mtd, np); in spi_nor_set_flash_node()
363 device_node *spi_nor_get_flash_node(struct spi_nor *nor) in spi_nor_get_flash_node() argument
365 return mtd_get_of_node(&nor->mtd); in spi_nor_get_flash_node()
369 * struct spi_nor_hwcaps - Structure for describing the hardware capabilies
370 * supported by the SPI controller (bus master).
380 * As a matter of performances, it is relevant to use Octo SPI protocols first,
381 * then Quad SPI protocols before Dual SPI protocols, Fast Read and lastly
410 * Like (Fast) Read capabilities, Octo/Quad SPI protocols are preferred to the
411 * legacy SPI 1-1-1 protocol.
413 * JEDEC/SFDP standard to define them. Also at this moment no SPI flash memory
430 * spi_nor_scan() - scan the SPI NOR
431 * @nor: the spi_nor structure
433 * The drivers can use this function to scan the SPI NOR.
439 int spi_nor_scan(struct spi_nor *nor);