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 | .buswidth = __buswidth, \ | 18 | .buswidth = __buswidth, \ |
| 19 | .opcode = __opcode, \ | 19 | .opcode = __opcode, \ |
| 20 | .nbytes = 1, \ | ||
| 20 | } | 21 | } |
| 21 | 22 | ||
| 22 | #define SPI_MEM_OP_ADDR(__nbytes, __val, __buswidth) \ | 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 | * struct spi_mem_op - describes a SPI memory operation | 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 | * @cmd.buswidth: number of IO lines used to transmit the command | 75 | * @cmd.buswidth: number of IO lines used to transmit the command |
| 73 | * @cmd.opcode: operation opcode | 76 | * @cmd.opcode: operation opcode |
| 77 | * @cmd.dtr: whether the command opcode should be sent in DTR mode or not | ||
| 74 | * @addr.nbytes: number of address bytes to send. Can be zero if the operation | 78 | * @addr.nbytes: number of address bytes to send. Can be zero if the operation |
| 75 | * does not need to send an address | 79 | * does not need to send an address |
| 76 | * @addr.buswidth: number of IO lines used to transmit the address cycles | 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 | * @addr.val: address value. This value is always sent MSB first on the bus. | 82 | * @addr.val: address value. This value is always sent MSB first on the bus. |
| 78 | * Note that only @addr.nbytes are taken into account in this | 83 | * Note that only @addr.nbytes are taken into account in this |
| 79 | * address value, so users should make sure the value fits in the | 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 | * @dummy.nbytes: number of dummy bytes to send after an opcode or address. Can | 86 | * @dummy.nbytes: number of dummy bytes to send after an opcode or address. Can |
| 82 | * be zero if the operation does not require dummy bytes | 87 | * be zero if the operation does not require dummy bytes |
| 83 | * @dummy.buswidth: number of IO lanes used to transmit the dummy bytes | 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 | * @data.buswidth: number of IO lanes used to send/receive the data | 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 | * @data.dir: direction of the transfer | 92 | * @data.dir: direction of the transfer |
| 86 | * @data.nbytes: number of data bytes to send/receive. Can be zero if the | 93 | * @data.nbytes: number of data bytes to send/receive. Can be zero if the |
| 87 | * operation does not involve transferring data | 94 | * operation does not involve transferring data |
| @@ -90,23 +97,28 @@ enum spi_mem_data_dir { · 2 unmodified lines | |||
| 90 | */ | 97 | */ |
| 91 | struct spi_mem_op { | 98 | struct spi_mem_op { |
| 92 | struct { | 99 | struct { |
| 100 | u8 nbytes; | ||
| 93 | u8 buswidth; | 101 | u8 buswidth; |
| 94 | u8 opcode; | 102 | u8 dtr : 1; |
| 103 | u16 opcode; | ||
| 95 | } cmd; | 104 | } cmd; |
| 96 | 105 | ||
| 97 | struct { | 106 | struct { |
| 98 | u8 nbytes; | 107 | u8 nbytes; |
| 99 | u8 buswidth; | 108 | u8 buswidth; |
| 109 | u8 dtr : 1; | ||
| 100 | u64 val; | 110 | u64 val; |
| 101 | } addr; | 111 | } addr; |
| 102 | 112 | ||
| 103 | struct { | 113 | struct { |
| 104 | u8 nbytes; | 114 | u8 nbytes; |
| 105 | u8 buswidth; | 115 | u8 buswidth; |
| 116 | u8 dtr : 1; | ||
| 106 | } dummy; | 117 | } dummy; |
| 107 | 118 | ||
| 108 | struct { | 119 | struct { |
| 109 | u8 buswidth; | 120 | u8 buswidth; |
| 121 | u8 dtr : 1; | ||
| 110 | enum spi_mem_data_dir dir; | 122 | enum spi_mem_data_dir dir; |
| 111 | unsigned int nbytes; | 123 | unsigned int nbytes; |
| 112 | union { | 124 | union { |