[virtio-dev][PATCH V9 2/2] virtio-spi: add the device specification

2023-12-11 Thread Haixu Cui
The Virtio SPI (Serial Peripheral Interface) device is a virtual
SPI controller that allows the driver to operate and use the SPI
controller under the control of the host.

This patch adds the specification for virtio-spi.

Signed-off-by: Haixu Cui 
Reviewed-by: Viresh Kumar 
---
 device-types/spi/description.tex| 281 
 device-types/spi/device-conformance.tex |   7 +
 device-types/spi/driver-conformance.tex |   7 +
 3 files changed, 295 insertions(+)
 create mode 100644 device-types/spi/description.tex
 create mode 100644 device-types/spi/device-conformance.tex
 create mode 100644 device-types/spi/driver-conformance.tex

diff --git a/device-types/spi/description.tex b/device-types/spi/description.tex
new file mode 100644
index 000..b76258c
--- /dev/null
+++ b/device-types/spi/description.tex
@@ -0,0 +1,281 @@
+\section{SPI Controller Device}\label{sec:Device Types / SPI Controller Device}
+
+The Virtio SPI (Serial Peripheral Interface) device is a virtual SPI 
controller that
+allows the driver to operate and use the SPI controller under the control of 
the host,
+either a physical SPI controller, or an emulated one.
+
+The Virtio SPI device has a single virtqueue. SPI transfer requests are placed 
into
+the virtqueue by the driver, and are serviced by the device.
+
+In a typical host and guest architecture with the Virtio SPI device, the 
Virtio SPI driver
+is the front-end running in the guest, and the Virtio SPI device is the 
back-end
+in the host.
+
+\subsection{Device ID}\label{sec:Device Types / SPI Controller Device / Device 
ID}
+45
+
+\subsection{Virtqueues}\label{sec:Device Types / SPI Controller Device / 
Virtqueues}
+
+\begin{description}
+\item[0] requestq
+\end{description}
+
+\subsection{Feature bits}\label{sec:Device Types / SPI Controller Device / 
Feature bits}
+
+None
+
+\subsection{Device configuration layout}\label{sec:Device Types / SPI 
Controller Device / Device configuration layout}
+
+All fields of this configuration are mandatory and read-only for the driver.
+The config space shows the features and settings supported by the device.
+
+\begin{lstlisting}
+struct virtio_spi_config {
+   u8 cs_max_number;
+   u8 cs_change_supported;
+   u8 tx_nbits_supported;
+   u8 rx_nbits_supported;
+   le32 bits_per_word_mask;
+   le32 mode_func_supported;
+   le32 max_freq_hz;
+   le32 max_word_delay_ns;
+   le32 max_cs_setup_ns;
+   le32 max_cs_hold_ns;
+   le32 max_cs_inactive_ns;
+};
+\end{lstlisting}
+
+\field{cs_max_number} is the maximum number of chipselect the device supports.
+
+Note: chipselect is an electrical signal, which is used to select the SPI 
peripherals connected
+to the controller.
+
+\field{cs_change_supported} indicates if the device supports to toggle 
chipselect
+after each transfer in one message:
+0: unsupported, chipselect will be kept in active state throughout the 
message transaction;
+1: supported.
+
+Note: Message here contains a sequence of SPI transfers.
+
+\field{tx_nbits_supported} and \field{rx_nbits_supported} indicate the 
different n-bit transfer
+modes supported by the device, for writing and reading respectively. SINGLE is 
always supported.
+A set bit here indicates that the corresponding n-bit transfer is supported, 
otherwise not:
+bit 0: DUAL;
+bit 1: QUAD;
+bit 2: OCTAL;
+other bits are reserved and must be set as 0 by the device.
+
+Note: The commonly used SPI n-bit transfer options are:
+\begin{itemize}
+\item SINGLE: 1-bit transfer
+\item DUAL: 2-bit transfer
+\item QUAD: 4-bit transfer
+\item OCTAL: 8-bit transfer
+\end{itemize}
+
+\field{bits_per_word_mask} is a mask indicating which values of bits_per_word 
are supported.
+If bit n of \field{bits_per_word_mask} is set, the bits_per_word with value 
(n+1) is supported.
+If all bits are not set, bits_per_word can be any value from 1 to 32.
+
+Note: bits_per_word corresponds to \field{bits_per_word} in \field{struct 
virtio_spi_transfer_head}.
+
+\field{mode_func_supported} indicates whether the following features are 
supported or not:
+bit 0-1: CPHA feature,
+0b00: invalid, must support as least one CPHA setting.
+0b01: supports CPHA=0 only;
+0b10: supports CPHA=1 only;
+0b11: supports CPHA=0 and CPHA=1;
+
+bit 2-3: CPOL feature,
+0b00: invalid, must support as least one CPOL setting.
+0b01: supports CPOL=0 only;
+0b10: supports CPOL=1 only;
+0b11: supports CPOL=0 and CPOL=1;
+
+bit 4: chipselect active high feature, 0 for unsupported and 1 for 
supported,
+chipselect active low must always be supported.
+
+bit 5: LSB first feature, 0 for unsupported and 1 for supported, MSB 
first must always be
+supported.
+
+bit 6: loopback mode feature, 0 for unsupported and 1 for supported, 
normal mode
+mus

[virtio-dev][PATCH V9 1/2] content: Rename SPI master to SPI controller

2023-12-11 Thread Haixu Cui
SPI master is an outdated term and should use SPI controller.

Signed-off-by: Haixu Cui 
Reviewed-by: Viresh Kumar 
---
 content.tex | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/content.tex b/content.tex
index 0a62dce..84bc68f 100644
--- a/content.tex
+++ b/content.tex
@@ -737,7 +737,7 @@ \chapter{Device Types}\label{sec:Device Types}
 \hline
 44 &   ISM device \\
 \hline
-45 &   SPI master \\
+45 &   SPI controller \\
 \hline
 \end{tabular}
 
@@ -767,6 +767,7 @@ \chapter{Device Types}\label{sec:Device Types}
 \input{device-types/scmi/description.tex}
 \input{device-types/gpio/description.tex}
 \input{device-types/pmem/description.tex}
+\input{device-types/spi/description.tex}
 
 \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
 
-- 
2.17.1


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev][PATCH V9 0/2] virtio-spi: add virtual SPI controller

2023-12-11 Thread Haixu Cui
The Virtio SPI (Serial Peripheral Interface) device is a virtual SPI controller 
that
allows the driver to operate and use the SPI controller under the control of 
the host,
either a physical SPI controller, or an emulated one.

Patch summary:
patch 1 rename virtual SPI device name
patch 2 add the specification for virtio-spi

Haixu Cui (2):
  content: Rename SPI master to SPI controller
  virtio-spi: add the device specification

 content.tex |   3 +-
 device-types/spi/description.tex| 281 
 device-types/spi/device-conformance.tex |   7 +
 device-types/spi/driver-conformance.tex |   7 +
 4 files changed, 297 insertions(+), 1 deletion(-)
 create mode 100644 device-types/spi/description.tex
 create mode 100644 device-types/spi/device-conformance.tex
 create mode 100644 device-types/spi/driver-conformance.tex

-- 
2.17.1


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] virtio 1.3: update

2023-12-11 Thread Cornelia Huck
You may have been wondering what the current state of virtio 1.3 is; the
tl;dr is: we have to deal with some unfortunate delays, but it is really
nearing release now.

The current state
-

virtio-1.3-csd01 (committee specification draft) has been out for public
review, and that 30 day period has just finished, with no additional
comments being received. This means we're ready to start the process to
get the committee specification draft released as an actual committee
specification.

The current issue
-

Moving from CSD to CS requires that the TC votes on it. Unfortunately,
this will not be possible to fit into the remaining time before the
OASIS infrastructure downtime due to the upcoming migration. While we
hope that the new infrastructure will be in place quickly, it is
unlikely that we will be able to do a vote before many/most of the
voting members will be away for end-of-year holidays. [We actually need
*two* votes in the end, with each ballot open for seven days.]

The current plan


We'll do any preparation work (which should be really minor) now, and
start the voting process early in January. I'm reasonably confident
that, once triggered, we should have finished the process in early
February the latest.

Apologies again for the numerous delays the spec encountered along the
way, it's been pretty frustrating.


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org