|
11 | 11 | #define __LINUX_MTD_SPI_NOR_H |
12 | 12 |
|
13 | 13 | /* Flash opcodes. */ |
14 | | -#define OPCODE_WREN 0x06 /* Write enable */ |
15 | | -#define OPCODE_RDSR 0x05 /* Read status register */ |
16 | | -#define OPCODE_WRSR 0x01 /* Write status register 1 byte */ |
17 | | -#define OPCODE_NORM_READ 0x03 /* Read data bytes (low frequency) */ |
18 | | -#define OPCODE_FAST_READ 0x0b /* Read data bytes (high frequency) */ |
19 | | -#define OPCODE_DUAL_READ 0x3b /* Read data bytes (Dual SPI) */ |
20 | | -#define OPCODE_QUAD_READ 0x6b /* Read data bytes (Quad SPI) */ |
21 | | -#define OPCODE_PP 0x02 /* Page program (up to 256 bytes) */ |
22 | | -#define OPCODE_BE_4K 0x20 /* Erase 4KiB block */ |
23 | | -#define OPCODE_BE_4K_PMC 0xd7 /* Erase 4KiB block on PMC chips */ |
24 | | -#define OPCODE_BE_32K 0x52 /* Erase 32KiB block */ |
25 | | -#define OPCODE_CHIP_ERASE 0xc7 /* Erase whole flash chip */ |
26 | | -#define OPCODE_SE 0xd8 /* Sector erase (usually 64KiB) */ |
27 | | -#define OPCODE_RDID 0x9f /* Read JEDEC ID */ |
28 | | -#define OPCODE_RDCR 0x35 /* Read configuration register */ |
| 14 | +#define OPCODE_WREN 0x06 /* Write enable */ |
| 15 | +#define OPCODE_RDSR 0x05 /* Read status register */ |
| 16 | +#define OPCODE_WRSR 0x01 /* Write status register 1 byte */ |
| 17 | +#define OPCODE_NORM_READ 0x03 /* Read data bytes (low frequency) */ |
| 18 | +#define OPCODE_FAST_READ 0x0b /* Read data bytes (high frequency) */ |
| 19 | +#define OPCODE_DUAL_READ 0x3b /* Read data bytes (Dual SPI) */ |
| 20 | +#define OPCODE_QUAD_READ 0x6b /* Read data bytes (Quad SPI) */ |
| 21 | +#define OPCODE_PP 0x02 /* Page program (up to 256 bytes) */ |
| 22 | +#define OPCODE_BE_4K 0x20 /* Erase 4KiB block */ |
| 23 | +#define OPCODE_BE_4K_PMC 0xd7 /* Erase 4KiB block on PMC chips */ |
| 24 | +#define OPCODE_BE_32K 0x52 /* Erase 32KiB block */ |
| 25 | +#define OPCODE_CHIP_ERASE 0xc7 /* Erase whole flash chip */ |
| 26 | +#define OPCODE_SE 0xd8 /* Sector erase (usually 64KiB) */ |
| 27 | +#define OPCODE_RDID 0x9f /* Read JEDEC ID */ |
| 28 | +#define OPCODE_RDCR 0x35 /* Read configuration register */ |
29 | 29 |
|
30 | 30 | /* 4-byte address opcodes - used on Spansion and some Macronix flashes. */ |
31 | | -#define OPCODE_NORM_READ_4B 0x13 /* Read data bytes (low frequency) */ |
32 | | -#define OPCODE_FAST_READ_4B 0x0c /* Read data bytes (high frequency) */ |
33 | | -#define OPCODE_DUAL_READ_4B 0x3c /* Read data bytes (Dual SPI) */ |
34 | | -#define OPCODE_QUAD_READ_4B 0x6c /* Read data bytes (Quad SPI) */ |
35 | | -#define OPCODE_PP_4B 0x12 /* Page program (up to 256 bytes) */ |
36 | | -#define OPCODE_SE_4B 0xdc /* Sector erase (usually 64KiB) */ |
| 31 | +#define OPCODE_NORM_READ_4B 0x13 /* Read data bytes (low frequency) */ |
| 32 | +#define OPCODE_FAST_READ_4B 0x0c /* Read data bytes (high frequency) */ |
| 33 | +#define OPCODE_DUAL_READ_4B 0x3c /* Read data bytes (Dual SPI) */ |
| 34 | +#define OPCODE_QUAD_READ_4B 0x6c /* Read data bytes (Quad SPI) */ |
| 35 | +#define OPCODE_PP_4B 0x12 /* Page program (up to 256 bytes) */ |
| 36 | +#define OPCODE_SE_4B 0xdc /* Sector erase (usually 64KiB) */ |
37 | 37 |
|
38 | 38 | /* Used for SST flashes only. */ |
39 | | -#define OPCODE_BP 0x02 /* Byte program */ |
40 | | -#define OPCODE_WRDI 0x04 /* Write disable */ |
41 | | -#define OPCODE_AAI_WP 0xad /* Auto address increment word program */ |
| 39 | +#define OPCODE_BP 0x02 /* Byte program */ |
| 40 | +#define OPCODE_WRDI 0x04 /* Write disable */ |
| 41 | +#define OPCODE_AAI_WP 0xad /* Auto address increment word program */ |
42 | 42 |
|
43 | 43 | /* Used for Macronix and Winbond flashes. */ |
44 | | -#define OPCODE_EN4B 0xb7 /* Enter 4-byte mode */ |
45 | | -#define OPCODE_EX4B 0xe9 /* Exit 4-byte mode */ |
| 44 | +#define OPCODE_EN4B 0xb7 /* Enter 4-byte mode */ |
| 45 | +#define OPCODE_EX4B 0xe9 /* Exit 4-byte mode */ |
46 | 46 |
|
47 | 47 | /* Used for Spansion flashes only. */ |
48 | | -#define OPCODE_BRWR 0x17 /* Bank register write */ |
| 48 | +#define OPCODE_BRWR 0x17 /* Bank register write */ |
49 | 49 |
|
50 | 50 | /* Status Register bits. */ |
51 | | -#define SR_WIP 1 /* Write in progress */ |
52 | | -#define SR_WEL 2 /* Write enable latch */ |
| 51 | +#define SR_WIP 1 /* Write in progress */ |
| 52 | +#define SR_WEL 2 /* Write enable latch */ |
53 | 53 | /* meaning of other SR_* bits may differ between vendors */ |
54 | | -#define SR_BP0 4 /* Block protect 0 */ |
55 | | -#define SR_BP1 8 /* Block protect 1 */ |
56 | | -#define SR_BP2 0x10 /* Block protect 2 */ |
57 | | -#define SR_SRWD 0x80 /* SR write protect */ |
| 54 | +#define SR_BP0 4 /* Block protect 0 */ |
| 55 | +#define SR_BP1 8 /* Block protect 1 */ |
| 56 | +#define SR_BP2 0x10 /* Block protect 2 */ |
| 57 | +#define SR_SRWD 0x80 /* SR write protect */ |
58 | 58 |
|
59 | | -#define SR_QUAD_EN_MX 0x40 /* Macronix Quad I/O */ |
| 59 | +#define SR_QUAD_EN_MX 0x40 /* Macronix Quad I/O */ |
60 | 60 |
|
61 | 61 | /* Configuration Register bits. */ |
62 | | -#define CR_QUAD_EN_SPAN 0x2 /* Spansion Quad I/O */ |
| 62 | +#define CR_QUAD_EN_SPAN 0x2 /* Spansion Quad I/O */ |
63 | 63 |
|
64 | 64 | enum read_mode { |
65 | 65 | SPI_NOR_NORMAL = 0, |
@@ -95,7 +95,7 @@ struct spi_nor_xfer_cfg { |
95 | 95 | u8 dummy_cycles; |
96 | 96 | }; |
97 | 97 |
|
98 | | -#define SPI_NOR_MAX_CMD_SIZE 8 |
| 98 | +#define SPI_NOR_MAX_CMD_SIZE 8 |
99 | 99 | enum spi_nor_ops { |
100 | 100 | SPI_NOR_OPS_READ = 0, |
101 | 101 | SPI_NOR_OPS_WRITE, |
|
0 commit comments