spi: Support for DTR ops Merge the SPIMEM DTR bits in spi-nor/next so that we can continue the development on top of them.
Showing the changes to include/linux (1 of 6 files). Show all
Unified · Split
| @@ -17,6 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | { \ |
| 18 | 18 | .buswidth = __buswidth, \ |
| 19 | 19 | .opcode = __opcode, \ |
| 20 | + .nbytes = 1, \ | |
| 20 | 21 | } |
| 21 | 22 | |
| 22 | 23 | #define SPI_MEM_OP_ADDR(__nbytes, __val, __buswidth) \ |
| @@ -69,11 +70,15 @@ enum spi_mem_data_dir { · 46 unmodified lines | ||
| 69 | 70 | |
| 70 | 71 | /** |
| 71 | 72 | * struct spi_mem_op - describes a SPI memory operation |
| 73 | + * @cmd.nbytes: number of opcode bytes (only 1 or 2 are valid). The opcode is | |
| 74 | + * sent MSB-first. | |
| 72 | 75 | * @cmd.buswidth: number of IO lines used to transmit the command |
| 73 | 76 | * @cmd.opcode: operation opcode |
| 77 | + * @cmd.dtr: whether the command opcode should be sent in DTR mode or not | |
| 74 | 78 | * @addr.nbytes: number of address bytes to send. Can be zero if the operation |
| 75 | 79 | * does not need to send an address |
| 76 | 80 | * @addr.buswidth: number of IO lines used to transmit the address cycles |
| 81 | + * @addr.dtr: whether the address should be sent in DTR mode or not | |
| 77 | 82 | * @addr.val: address value. This value is always sent MSB first on the bus. |
| 78 | 83 | * Note that only @addr.nbytes are taken into account in this |
| 79 | 84 | * address value, so users should make sure the value fits in the |
| @@ -81,7 +86,9 @@ enum spi_mem_data_dir { · 1 unmodified line | ||
| 81 | 86 | * @dummy.nbytes: number of dummy bytes to send after an opcode or address. Can |
| 82 | 87 | * be zero if the operation does not require dummy bytes |
| 83 | 88 | * @dummy.buswidth: number of IO lanes used to transmit the dummy bytes |
| 89 | + * @dummy.dtr: whether the dummy bytes should be sent in DTR mode or not | |
| 84 | 90 | * @data.buswidth: number of IO lanes used to send/receive the data |
| 91 | + * @data.dtr: whether the data should be sent in DTR mode or not | |
| 85 | 92 | * @data.dir: direction of the transfer |
| 86 | 93 | * @data.nbytes: number of data bytes to send/receive. Can be zero if the |
| 87 | 94 | * operation does not involve transferring data |
| @@ -90,23 +97,28 @@ enum spi_mem_data_dir { · 2 unmodified lines | ||
| 90 | 97 | */ |
| 91 | 98 | struct spi_mem_op { |
| 92 | 99 | struct { |
| 100 | + u8 nbytes; | |
| 93 | 101 | u8 buswidth; |
| 94 | − u8 opcode; | |
| 102 | + u8 dtr : 1; | |
| 103 | + u16 opcode; | |
| 95 | 104 | } cmd; |
| 96 | 105 | |
| 97 | 106 | struct { |
| 98 | 107 | u8 nbytes; |
| 99 | 108 | u8 buswidth; |
| 109 | + u8 dtr : 1; | |
| 100 | 110 | u64 val; |
| 101 | 111 | } addr; |
| 102 | 112 | |
| 103 | 113 | struct { |
| 104 | 114 | u8 nbytes; |
| 105 | 115 | u8 buswidth; |
| 116 | + u8 dtr : 1; | |
| 106 | 117 | } dummy; |
| 107 | 118 | |
| 108 | 119 | struct { |
| 109 | 120 | u8 buswidth; |
| 121 | + u8 dtr : 1; | |
| 110 | 122 | enum spi_mem_data_dir dir; |
| 111 | 123 | unsigned int nbytes; |
| 112 | 124 | union { |