summaryrefslogtreecommitdiff
path: root/include/acpi/acpi_device.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-07-07 13:11:49 -0600
committerBin Meng <bmeng.cn@gmail.com>2020-07-17 14:32:24 +0800
commit70e5e67a4dc7cee0c69eaf9f5cc07b201a59cb59 (patch)
tree21b30aa80c5c2c435fdb4ec242c08c2d9fc08c61 /include/acpi/acpi_device.h
parent31e1787ec15e4a498e940e9ba24b625ca059a3b2 (diff)
downloadu-boot-70e5e67a4dc7cee0c69eaf9f5cc07b201a59cb59.tar.gz
u-boot-70e5e67a4dc7cee0c69eaf9f5cc07b201a59cb59.tar.bz2
u-boot-70e5e67a4dc7cee0c69eaf9f5cc07b201a59cb59.zip
acpi: Support generation of SPI descriptor
Add a function to write a SPI descriptor to the generated ACPI code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'include/acpi/acpi_device.h')
-rw-r--r--include/acpi/acpi_device.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/include/acpi/acpi_device.h b/include/acpi/acpi_device.h
index 7a65dadbb2..62b1295201 100644
--- a/include/acpi/acpi_device.h
+++ b/include/acpi/acpi_device.h
@@ -10,6 +10,7 @@
#define __ACPI_DEVICE_H
#include <i2c.h>
+#include <spi.h>
#include <linux/bitops.h>
struct acpi_ctx;
@@ -186,8 +187,11 @@ struct acpi_gpio {
/* ACPI Descriptors for Serial Bus interfaces */
#define ACPI_SERIAL_BUS_TYPE_I2C 1
+#define ACPI_SERIAL_BUS_TYPE_SPI 2
#define ACPI_I2C_SERIAL_BUS_REVISION_ID 1 /* TODO: upgrade to 2 */
#define ACPI_I2C_TYPE_SPECIFIC_REVISION_ID 1
+#define ACPI_SPI_SERIAL_BUS_REVISION_ID 1
+#define ACPI_SPI_TYPE_SPECIFIC_REVISION_ID 1
/**
* struct acpi_i2c - representation of an ACPI I2C device
@@ -205,6 +209,29 @@ struct acpi_i2c {
};
/**
+ * struct acpi_spi - representation of an ACPI SPI device
+ *
+ * @device_select: Chip select used by this device (typically 0)
+ * @device_select_polarity: Polarity for the device
+ * @wire_mode: Number of wires used for SPI
+ * @speed: Bus speed in Hz
+ * @data_bit_length: Word length for SPI (typically 8)
+ * @clock_phase: Clock phase to capture data
+ * @clock_polarity: Bus polarity
+ * @resource: Resource name for the SPI controller
+ */
+struct acpi_spi {
+ u16 device_select;
+ enum spi_polarity device_select_polarity;
+ enum spi_wire_mode wire_mode;
+ unsigned int speed;
+ u8 data_bit_length;
+ enum spi_clock_phase clock_phase;
+ enum spi_polarity clock_polarity;
+ const char *resource;
+};
+
+/**
* acpi_device_path() - Get the full path to an ACPI device
*
* This gets the full path in the form XXXX.YYYY.ZZZZ where XXXX is the root
@@ -303,4 +330,16 @@ int acpi_device_write_interrupt_or_gpio(struct acpi_ctx *ctx,
*/
int acpi_device_write_i2c_dev(struct acpi_ctx *ctx, const struct udevice *dev);
+/**
+ * acpi_device_write_spi_dev() - Write a SPI device to ACPI
+ *
+ * This writes a serial bus descriptor for the SPI device so that ACPI can use
+ * it
+ *
+ * @ctx: ACPI context pointer
+ * @dev: SPI device to write
+ * @return 0 if OK, -ve on error
+ */
+int acpi_device_write_spi_dev(struct acpi_ctx *ctx, const struct udevice *dev);
+
#endif