]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - include/cros_ec.h
cros_ec: spi: Add support for EC protocol version 3
[karo-tx-uboot.git] / include / cros_ec.h
index 31661329fd2dba61b5c75c8b20acc895ce09af64..84f9104d36dd33eb18f60191ec5828ee8e774e24 100644 (file)
@@ -33,7 +33,7 @@ struct cros_ec_dev {
        unsigned int bus_num;           /* Bus number (for I2C) */
        unsigned int max_frequency;     /* Maximum interface frequency */
        struct fdt_gpio_state ec_int;   /* GPIO used as EC interrupt line */
-       int cmd_version_is_supported;   /* Device supports command versions */
+       int protocol_version;           /* Protocol version to use */
        int optimise_flash_write;       /* Don't write erased flash blocks */
 
        /*
@@ -260,8 +260,7 @@ int cros_ec_spi_decode_fdt(struct cros_ec_dev *dev, const void *blob);
  * Check whether the LPC interface supports new-style commands.
  *
  * LPC has its own way of doing this, which involves checking LPC values
- * visible to the host. Do this, and update dev->cmd_version_is_supported
- * accordingly.
+ * visible to the host. Do this, and update dev->protocol_version accordingly.
  *
  * @param dev          CROS-EC device to check
  */
@@ -312,6 +311,19 @@ int cros_ec_spi_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version,
                     const uint8_t *dout, int dout_len,
                     uint8_t **dinp, int din_len);
 
+/**
+ * Send a packet to a CROS-EC device and return the response packet.
+ *
+ * Expects the request packet to be stored in dev->dout.  Stores the response
+ * packet in dev->din.
+ *
+ * @param dev          CROS-EC device
+ * @param out_bytes    Size of request packet to output
+ * @param in_bytes     Maximum size of response packet to receive
+ * @return number of bytes in response packet, or <0 on error
+ */
+int cros_ec_spi_packet(struct cros_ec_dev *dev, int out_bytes, int in_bytes);
+
 /**
  * Dump a block of data for a command.
  *