diff mbox series

[002/108] spi: Add SPI mode enums

Message ID 20200126220508.2.I83a459a3914c56ca81dcdfa7e01d83c54f7ab914@changeid
State RFC
Delegated to: Bin Meng
Headers show
Series RFC: dm: Add programatic generation of ACPI tables | expand

Commit Message

Simon Glass Jan. 27, 2020, 5:05 a.m. UTC
With ACPI we need to describe the settings of the SPI bus. Add enums to
handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 include/spi.h | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

Comments

Bin Meng Feb. 8, 2020, 2:53 p.m. UTC | #1
On Mon, Jan 27, 2020 at 1:08 PM Simon Glass <sjg@chromium.org> wrote:
>
> With ACPI we need to describe the settings of the SPI bus. Add enums to
> handle this.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  include/spi.h | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
diff mbox series

Patch

diff --git a/include/spi.h b/include/spi.h
index ef5d87f476..77fa3800fd 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -62,6 +62,39 @@  struct dm_spi_slave_platdata {
 	uint mode;
 };
 
+/**
+ * enum spi_clock_phase - indicates  the clock phase to use for SPI (CPHA)
+ *
+ * @SPI_CLOCK_PHASE_FIRST: Data sampled on the first phase
+ * @SPI_CLOCK_PHASE_SECOND: Data sampled on the second phase
+ */
+enum spi_clock_phase {
+	SPI_CLOCK_PHASE_FIRST,
+	SPI_CLOCK_PHASE_SECOND
+};
+
+/**
+ * enum spi_wire_mode - indicates the number of wires used for SPI
+ *
+ * @SPI_4_WIRE_MODE: Normal bidirectional mode with MOSI and MISO
+ * @SPI_3_WIRE_MODE: Unidirectional version with a single data line SISO
+ */
+enum spi_wire_mode {
+	SPI_4_WIRE_MODE,
+	SPI_3_WIRE_MODE
+};
+
+/**
+ * enum spi_polarity - indicates the polarity of the SPI bus (CPOL)
+ *
+ * @SPI_POLARITY_LOW: Clock is low in idle state
+ * @SPI_POLARITY_HIGH: Clock is high in idle state
+ */
+enum spi_polarity {
+	SPI_POLARITY_LOW,
+	SPI_POLARITY_HIGH
+};
+
 #endif /* CONFIG_DM_SPI */
 
 /**