Merge branch '2022-02-08-Kconfig-updates'
[platform/kernel/u-boot.git] / include / spi-mem.h
index 8bd4459..32ffdc2 100644 (file)
@@ -17,6 +17,7 @@ struct udevice;
        {                                                       \
                .buswidth = __buswidth,                         \
                .opcode = __opcode,                             \
+               .nbytes = 1,                                    \
        }
 
 #define SPI_MEM_OP_ADDR(__nbytes, __val, __buswidth)           \
@@ -69,6 +70,8 @@ enum spi_mem_data_dir {
 
 /**
  * struct spi_mem_op - describes a SPI memory operation
+ * @cmd.nbytes: number of opcode bytes (only 1 or 2 are valid). The opcode is
+ *             sent MSB-first.
  * @cmd.buswidth: number of IO lines used to transmit the command
  * @cmd.opcode: operation opcode
  * @cmd.dtr: whether the command opcode should be sent in DTR mode or not
@@ -92,9 +95,10 @@ enum spi_mem_data_dir {
  */
 struct spi_mem_op {
        struct {
+               u8 nbytes;
                u8 buswidth;
-               u8 opcode;
                u8 dtr : 1;
+               u16 opcode;
        } cmd;
 
        struct {
@@ -245,6 +249,11 @@ spi_controller_dma_unmap_mem_op_data(struct spi_controller *ctlr,
 int spi_mem_adjust_op_size(struct spi_slave *slave, struct spi_mem_op *op);
 
 bool spi_mem_supports_op(struct spi_slave *slave, const struct spi_mem_op *op);
+bool spi_mem_dtr_supports_op(struct spi_slave *slave,
+                            const struct spi_mem_op *op);
+
+bool spi_mem_default_supports_op(struct spi_slave *slave,
+                                const struct spi_mem_op *op);
 
 int spi_mem_exec_op(struct spi_slave *slave, const struct spi_mem_op *op);