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

2023-12-01 Thread Cornelia Huck
On Fri, Dec 01 2023, Haixu Cui  wrote:

>>> +Note: chipselect is an electrical signal controlled by the SPI controller, 
>>> used to select the
>>> +SPI slaves connected to the controller.
>> 
>> I wonder whether another term is now more commonly used... the Wikipedia
>> article uses main/sub, is there a term that is usually used together
>> with "controller"?
>
> In Wikipedia,
>
> "Historically, this arrangement has been called master/slave. But to 
> avoid referencing slavery, alternative names discussed in ยง Alternative 
> namings have been used."
>
> I am not quite sure if main/sub is widely used, but in latest Linux, 
> still use master/slave but master is gradually replaced by "controller".
>
> So I think "controller" here does make sense. What is your suggestion?

"controller" is fine, I'm just wondering if "slave" has started to be
replaced with something else as well... if it hasn't, we probably need
to stick with it to avoid confusing readers.


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



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

2023-12-01 Thread Viresh Kumar
On 01-12-23, 16:21, Haixu Cui wrote:
> 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 device.
> 
> This patch adds the specification for virtio-spi.
> 
> Signed-off-by: Haixu Cui 
> ---
>  device-types/spi/description.tex| 280 
>  device-types/spi/device-conformance.tex |   7 +
>  device-types/spi/driver-conformance.tex |   7 +
>  3 files changed, 294 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..7c81df5
> --- /dev/null
> +++ b/device-types/spi/description.tex
> @@ -0,0 +1,280 @@
> +\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 device,

I feel the terminology here is still a bit confusing:

"the SPI controller under the control of the device"

The Virtio SPI controller is "the device" and it is not under its own control.

As I suggested earlier, maybe this should be written as:

"the SPI controller under the control of the guest"

> +either a physical SPI controller, or an emulated one.

I just skimmed through the rest this time. Thanks for your effort.

Reviewed-by: Viresh Kumar 

-- 
viresh

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



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

2023-12-01 Thread Viresh Kumar
On 01-12-23, 16:21, Haixu Cui wrote:
> SPI master is an outdated term and should use SPI controller.
> 
> Signed-off-by: Haixu Cui 

I already gave my reviewed by tag for this commit. Please remember to add any
such Reviewed-by tags while sending a newer version.

I think Mark also gave Reviewed-by for the other commit, you should include that
too.

> ---
>  content.tex | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/content.tex b/content.tex
> index 0a62dce..1c608eb 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}
>  
> -- 
> 2.17.1

-- 
viresh

-
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 V7 2/2] virtio-spi: add the device specification

2023-12-01 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 device.

This patch adds the specification for virtio-spi.

Signed-off-by: Haixu Cui 
---
 device-types/spi/description.tex| 280 
 device-types/spi/device-conformance.tex |   7 +
 device-types/spi/driver-conformance.tex |   7 +
 3 files changed, 294 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..7c81df5
--- /dev/null
+++ b/device-types/spi/description.tex
@@ -0,0 +1,280 @@
+\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 device,
+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 
slaves 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 not set, there is no limitation for bits_per_word.
+
+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: supports CPHA=0 and CPHA=1;
+0b01: supports CPHA=0 only;
+0b10: supports CPHA=1 only;
+0b11: invalid, must support as least one CPHA setting.
+
+bit 2-3: CPOL feature,
+0b00: supports CPOL=0 and CPOL=1;
+0b01: supports CPOL=0 only;
+0b10: supports CPOL=1 only;
+0b11: invalid, must support as least one CPOL setting.
+
+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
+must always be supported.
+
+Note: CPOL is clock polarity and CPHA is clock phase. If CPOL is 0, the clock 
idles at the logical
+low voltage, ot

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

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

Signed-off-by: Haixu Cui 
---
 content.tex | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/content.tex b/content.tex
index 0a62dce..1c608eb 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}
 
-- 
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 V7 0/2] virtio-spi: add virtual SPI controller

2023-12-01 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 device,
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 |   2 +-
 device-types/spi/description.tex| 280 
 device-types/spi/device-conformance.tex |   7 +
 device-types/spi/driver-conformance.tex |   7 +
 4 files changed, 295 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