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 */
36 * 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) */
52 #define SPINOR_OP_READ_1_1_8 0x8b /* Read data bytes (Octal Output SPI) */
53 #define SPINOR_OP_READ_1_8_8 0xcb /* Read data bytes (Octal I/O SPI) */
72 /* 4-byte address opcodes - used on Spansion and some Macronix flashes. */
75 #define SPINOR_OP_READ_1_1_2_4B 0x3c /* Read data bytes (Dual Output SPI) */
76 #define SPINOR_OP_READ_1_2_2_4B 0xbc /* Read data bytes (Dual I/O SPI) */
77 #define SPINOR_OP_READ_1_1_4_4B 0x6c /* Read data bytes (Quad Output SPI) */
78 #define SPINOR_OP_READ_1_4_4_4B 0xec /* Read data bytes (Quad I/O SPI) */
79 #define SPINOR_OP_READ_1_1_8_4B 0x7c /* Read data bytes (Octal Output SPI) */
80 #define SPINOR_OP_READ_1_8_8_4B 0xcc /* Read data bytes (Octal I/O SPI) */
90 /* Double Transfer Rate opcodes - defined in JEDEC JESD216B. */
117 #define SPINOR_OP_EN4B 0xb7 /* Enter 4-byte mode */
118 #define SPINOR_OP_EX4B 0xe9 /* Exit 4-byte mode */
161 /* Supported SPI protocols */
256 * struct flash_info - Forward declaration of a structure used internally by
265 * struct spi_nor - Structure for defining a the SPI NOR layer
268 * @dev: point to a spi device, or a spi nor controller device.
269 * @info: spi-nor part JDEC MFR id and other info
270 * @page_size: the page size of the SPI NOR
280 * @flags: flag options for the current SPI-NOR (SNOR_F_*)
281 * @read_proto: the SPI protocol for read operations
282 * @write_proto: the SPI protocol for write operations
283 * @reg_proto the SPI protocol for read_reg/write_reg/erase operations
289 * @read_reg: [DRIVER-SPECIFIC] read out the register
290 * @write_reg: [DRIVER-SPECIFIC] write data to the register
291 * @read: [DRIVER-SPECIFIC] read data from the SPI NOR
292 * @write: [DRIVER-SPECIFIC] write data to the SPI NOR
293 * @erase: [DRIVER-SPECIFIC] erase a sector of the SPI NOR
295 * spi-nor will send the erase opcode via write_reg()
296 * @flash_lock: [FLASH-SPECIFIC] lock a region of the SPI NOR
297 * @flash_unlock: [FLASH-SPECIFIC] unlock a region of the SPI NOR
298 * @flash_is_locked: [FLASH-SPECIFIC] check if a region of the SPI NOR is
299 * @quad_enable: [FLASH-SPECIFIC] enables SPI NOR quad mode
306 struct spi_slave *spi; member
326 int (*prepare)(struct spi_nor *nor, enum spi_nor_ops ops);
327 void (*unprepare)(struct spi_nor *nor, enum spi_nor_ops ops);
328 int (*read_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len);
329 int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len);
331 ssize_t (*read)(struct spi_nor *nor, loff_t from,
333 ssize_t (*write)(struct spi_nor *nor, loff_t to,
335 int (*erase)(struct spi_nor *nor, loff_t offs);
337 int (*flash_lock)(struct spi_nor *nor, loff_t ofs, uint64_t len);
338 int (*flash_unlock)(struct spi_nor *nor, loff_t ofs, uint64_t len);
339 int (*flash_is_locked)(struct spi_nor *nor, loff_t ofs, uint64_t len);
340 int (*quad_enable)(struct spi_nor *nor);
350 static inline void spi_nor_set_flash_node(struct spi_nor *nor, in spi_nor_set_flash_node() argument
353 mtd_set_of_node(&nor->mtd, np); in spi_nor_set_flash_node()
357 device_node *spi_nor_get_flash_node(struct spi_nor *nor) in spi_nor_get_flash_node() argument
359 return mtd_get_of_node(&nor->mtd); in spi_nor_get_flash_node()
363 * struct spi_nor_hwcaps - Structure for describing the hardware capabilies
364 * supported by the SPI controller (bus master).
374 * As a matter of performances, it is relevant to use Octo SPI protocols first,
375 * then Quad SPI protocols before Dual SPI protocols, Fast Read and lastly
404 * Like (Fast) Read capabilities, Octo/Quad SPI protocols are preferred to the
405 * legacy SPI 1-1-1 protocol.
407 * JEDEC/SFDP standard to define them. Also at this moment no SPI flash memory
424 * spi_nor_scan() - scan the SPI NOR
425 * @nor: the spi_nor structure
427 * The drivers can use this function to scan the SPI NOR.
433 int spi_nor_scan(struct spi_nor *nor);