Skip to contentSkip to conversation

spi: Add data loopback OF compatible

PATCH In review Francesco Dolcini 2 participants 9 messages Mar 16 – Mar 22

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover spi: Add data loopback OF compatible

From: Francesco Dolcini <[email protected]>

Add "spi-miso-mosi-loopback" OF compatible, that describes a single wire loopback between the two data signals, MISO and MOSI.

This kind of setup can be used for testing the SPI functionality.

Francesco Dolcini (2):
dt-bindings: trivial-devices: add spi-miso-mosi-loopback
spi: spidev: Add data loopback OF compatible

 Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
 drivers/spi/spidev.c                                   | 2 ++
 2 files changed, 4 insertions(+)
Signature · 1 line
2.47.3
#1 lore raw

PATCH 1/2 dt-bindings: trivial-devices: add spi-miso-mosi-loopback

From: Francesco Dolcini <[email protected]>

Add a compatible to describe a single wire loopback between SPI MISO and MOSI signals.

---
 Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
index a482aeadcd44..2cb973c157f6 100644
@@ -432,6 +432,8 @@ properties:
           - socionext,uniphier-smpctrl
             # SparkFun Qwiic Joystick (COM-15168) with i2c interface
           - sparkfun,qwiic-joystick
+            # Single wire loopback between SPI MISO and MOSI signals
+          - spi-miso-mosi-loopback
             # STMicroelectronics Hot-swap controller stef48h28
           - st,stef48h28
             # Sierra Wireless mangOH Green SPI IoT interface
Signature · 1 line
2.47.3
#2 lore raw

Re: [PATCH v1 1/2] dt-bindings: trivial-devices: add spi-miso-mosi-loopback

Quoted 16 lines · Francesco Dolcini

From: Francesco Dolcini <[email protected]>

Add a compatible to describe a single wire loopback between SPI MISO and MOSI signals.

---
 Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/trivial-devices.yaml +0 -0
index a482aeadcd44..2cb973c157f6 100644

Documentation/devicetree/bindings/trivial-devices.yaml properties: · line 436

Quoted 5 lines
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
@@ -432,6 +432,8 @@ properties:
           - socionext,uniphier-smpctrl
             # SparkFun Qwiic Joystick (COM-15168) with i2c interface
           - sparkfun,qwiic-joystick
+            # Single wire loopback between SPI MISO and MOSI signals
+          - spi-miso-mosi-loopback

If you decided to go against my approach, then at least document it in proper place - incomplete-devices - so this won't be ever used in DTS.

Best regards,
Krzysztof

#3 lore raw

Re: [PATCH v1 1/2] dt-bindings: trivial-devices: add spi-miso-mosi-loopback

Quoted 12 lines · Krzysztof Kozlowski
Quoted 11 lines · Francesco Dolcini

From: Francesco Dolcini <[email protected]>

Add a compatible to describe a single wire loopback between SPI MISO and MOSI signals.

---
 Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
 1 file changed, 2 insertions(+)
Quoted 14 lines

Documentation/devicetree/bindings/trivial-devices.yaml properties: · line 436

Quoted 10 lines
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
index a482aeadcd44..2cb973c157f6 100644
@@ -432,6 +432,8 @@ properties:
           - socionext,uniphier-smpctrl
             # SparkFun Qwiic Joystick (COM-15168) with i2c interface
           - sparkfun,qwiic-joystick
+            # Single wire loopback between SPI MISO and MOSI signals
+          - spi-miso-mosi-loopback

If you decided to go against my approach, then at least document it in proper place - incomplete-devices - so this won't be ever used in DTS.

... and then you will notice existing linux,spi-loopback-test, so explain the differences and why spi-loopback-test cannot be used for your loopback test.

Best regards,
Krzysztof

#4 lore raw

Re: [PATCH v1 1/2] dt-bindings: trivial-devices: add spi-miso-mosi-loopback

Hello Krzysztof,
thanks for taking the time to answer this

Quoted 28 lines · Krzysztof Kozlowski
Quoted 12 lines · Krzysztof Kozlowski
Quoted 11 lines · Francesco Dolcini

From: Francesco Dolcini <[email protected]>

Add a compatible to describe a single wire loopback between SPI MISO and MOSI signals.

---
 Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
 1 file changed, 2 insertions(+)
Quoted 14 lines

Documentation/devicetree/bindings/trivial-devices.yaml properties: · line 436

Quoted 10 lines
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
index a482aeadcd44..2cb973c157f6 100644
@@ -432,6 +432,8 @@ properties:
           - socionext,uniphier-smpctrl
             # SparkFun Qwiic Joystick (COM-15168) with i2c interface
           - sparkfun,qwiic-joystick
+            # Single wire loopback between SPI MISO and MOSI signals
+          - spi-miso-mosi-loopback

If you decided to go against my approach, then at least document it in proper place - incomplete-devices - so this won't be ever used in DTS.

Quoted 3 lines

... and then you will notice existing linux,spi-loopback-test, so explain the differences and why spi-loopback-test cannot be used for your loopback test.

Yes, this spi-loopback-test will work.

I was not aware of it (no-one mentioned it in the email thread I opened) and I misread your answer as an alternative suggestion, and not as a nack.

There is still an open question, I can any driver probe/bind to the actual SPI device? My plan, once this discussion is settled, is to send patches to add dtso file enabling this test, however, according to trivial-devices.yaml, I cannot submit such a DT file using linux,spi-loopback-test as a compatible.

On the actual HW I have a pins header and a wire between MISO/MOSI.

I am clearly missing something obvious, any advise is appreciated.

Thanks,
Francesco

#5 lore raw

Re: [PATCH v1 1/2] dt-bindings: trivial-devices: add spi-miso-mosi-loopback

Quoted 38 lines · Francesco Dolcini

Hello Krzysztof,
thanks for taking the time to answer this

Quoted 28 lines · Krzysztof Kozlowski
Quoted 12 lines · Krzysztof Kozlowski
Quoted 11 lines · Francesco Dolcini

From: Francesco Dolcini <[email protected]>

Add a compatible to describe a single wire loopback between SPI MISO and MOSI signals.

---
 Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
 1 file changed, 2 insertions(+)
Quoted 14 lines

Documentation/devicetree/bindings/trivial-devices.yaml properties: · line 436

Quoted 10 lines
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
index a482aeadcd44..2cb973c157f6 100644
@@ -432,6 +432,8 @@ properties:
           - socionext,uniphier-smpctrl
             # SparkFun Qwiic Joystick (COM-15168) with i2c interface
           - sparkfun,qwiic-joystick
+            # Single wire loopback between SPI MISO and MOSI signals
+          - spi-miso-mosi-loopback

If you decided to go against my approach, then at least document it in proper place - incomplete-devices - so this won't be ever used in DTS.

Quoted 3 lines

... and then you will notice existing linux,spi-loopback-test, so explain the differences and why spi-loopback-test cannot be used for your loopback test.

Yes, this spi-loopback-test will work.

Quoted 7 lines

I was not aware of it (no-one mentioned it in the email thread I opened) and I misread your answer as an alternative suggestion, and not as a nack.

There is still an open question, I can any driver probe/bind to the actual SPI device? My plan, once this discussion is settled, is to send patches to add dtso file enabling this test, however, according to trivial-devices.yaml, I cannot submit such a DT file using

I think you meant incomplete-devices and then yes, such DT upstream is not allowed.

Quoted 3 lines

linux,spi-loopback-test as a compatible.

On the actual HW I have a pins header and a wire between MISO/MOSI.

pins header, if I understood correctly what you are talking about, is a connector. Connecting there a jumper to short circuit there is out of scope, because it is not part of the board. Thus cannot be send upstream DTS, unless it is really embedded in the design like USB-A dongles which could not be removed by end user.

Otherwise you could say that every evalkit board can have such device, because they all have pin headers...

Quoted 2 lines

I am clearly missing something obvious, any advise is appreciated.

Describe your hardware... Nothing in this patchset helps in understanding it.

Best regards,
Krzysztof

#6 lore raw

Re: [PATCH v1 1/2] dt-bindings: trivial-devices: add spi-miso-mosi-loopback

Hello Krzysztof,

Quoted 42 lines · Krzysztof Kozlowski
Quoted 41 lines · Francesco Dolcini

Hello Krzysztof,
thanks for taking the time to answer this

Quoted 28 lines · Krzysztof Kozlowski
Quoted 12 lines · Krzysztof Kozlowski
Quoted 11 lines · Francesco Dolcini

From: Francesco Dolcini <[email protected]>

Add a compatible to describe a single wire loopback between SPI MISO and MOSI signals.

---
 Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
 1 file changed, 2 insertions(+)
Quoted 14 lines

Documentation/devicetree/bindings/trivial-devices.yaml properties: · line 436

Quoted 10 lines
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
index a482aeadcd44..2cb973c157f6 100644
@@ -432,6 +432,8 @@ properties:
           - socionext,uniphier-smpctrl
             # SparkFun Qwiic Joystick (COM-15168) with i2c interface
           - sparkfun,qwiic-joystick
+            # Single wire loopback between SPI MISO and MOSI signals
+          - spi-miso-mosi-loopback

If you decided to go against my approach, then at least document it in proper place - incomplete-devices - so this won't be ever used in DTS.

Quoted 3 lines

... and then you will notice existing linux,spi-loopback-test, so explain the differences and why spi-loopback-test cannot be used for your loopback test.

Yes, this spi-loopback-test will work.

I was not aware of it (no-one mentioned it in the email thread I opened) and I misread your answer as an alternative suggestion, and not as a nack.

Quoted 7 lines
Quoted 4 lines

There is still an open question, I can any driver probe/bind to the actual SPI device? My plan, once this discussion is settled, is to send patches to add dtso file enabling this test, however, according to trivial-devices.yaml, I cannot submit such a DT file using

I think you meant incomplete-devices and then yes, such DT upstream is not allowed.

yes, thanks for correcting me.

Quoted 10 lines
Quoted 3 lines

linux,spi-loopback-test as a compatible.

On the actual HW I have a pins header and a wire between MISO/MOSI.

pins header, if I understood correctly what you are talking about, is a connector. Connecting there a jumper to short circuit there is out of scope, because it is not part of the board. Thus cannot be send upstream DTS, unless it is really embedded in the design like USB-A dongles which could not be removed by end user.

Quoted 8 lines

Otherwise you could say that every evalkit board can have such device, because they all have pin headers...

Quoted 2 lines

I am clearly missing something obvious, any advise is appreciated.

Describe your hardware... Nothing in this patchset helps in understanding it.

Let me describe the need first, and after that I'll describe the HW.

The need we have is to have a way, with Linux mainline kernel, to test the SPI functionality (subsystem, driver and the actual HW). So far this was done using the spidev out-of-tree and with a loopback between the SPI MOSI and MISO signals.

We have a variety of HW that have various signals available on some sort of connector or pins headers [1].

This https://docs.toradex.com/112710-mallow-carrier-board_back.png is just one example, I know you are familiar with this kind of HW, I am writing it here the link just for completness and for everyone else.

So yes, your understanding is correct.

About the HW, we have various test boards, that plugs into this connector(s), as test fixture, and, with traces on the PCB, they do connect together the SPI MISO and MOSI signals.

Here a couple of picture as an example, of the "Aquila Lava HAT",
https://gist.github.com/dolcini/33c332f0b2174a9d495baf7c79341abf

Francesco

[1] https://en.wikipedia.org/wiki/Pin_header

#7 lore raw

Re: [PATCH v1 1/2] dt-bindings: trivial-devices: add spi-miso-mosi-loopback

Quoted 27 lines · Francesco Dolcini
Quoted 11 lines
Quoted 4 lines

linux,spi-loopback-test as a compatible.

On the actual HW I have a pins header and a wire between MISO/MOSI.

pins header, if I understood correctly what you are talking about, is a connector. Connecting there a jumper to short circuit there is out of scope, because it is not part of the board. Thus cannot be send upstream DTS, unless it is really embedded in the design like USB-A dongles which could not be removed by end user.

Quoted 8 lines

Otherwise you could say that every evalkit board can have such device, because they all have pin headers...

Quoted 2 lines

I am clearly missing something obvious, any advise is appreciated.

Describe your hardware... Nothing in this patchset helps in understanding it.

Let me describe the need first, and after that I'll describe the HW.

The need we have is to have a way, with Linux mainline kernel, to test the SPI functionality (subsystem, driver and the actual HW). So far this was done using the spidev out-of-tree and with a loopback between the SPI MOSI and MISO signals.

Quoted 6 lines

We have a variety of HW that have various signals available on some sort of connector or pins headers [1].

This https://docs.toradex.com/112710-mallow-carrier-board_back.png is just one example, I know you are familiar with this kind of HW, I am writing it here the link just for completness and for everyone else.

Looks like a specific device (hat), not a jumper connecting two pins on the header.

Quoted 9 lines

So yes, your understanding is correct.

About the HW, we have various test boards, that plugs into this connector(s), as test fixture, and, with traces on the PCB, they do connect together the SPI MISO and MOSI signals.

Here a couple of picture as an example, of the "Aquila Lava HAT",
https://gist.github.com/dolcini/33c332f0b2174a9d495baf7c79341abf

I don't think this is anyhow different than all existing cases of people submitting spidev patches.

You can have only two choices:
1. Connector. You cannot send bindings for spidev or loopback claiming it is a connector.

2. Actual device plugged there. You need specific compatible for this actual device. The compatible cannot be used for anything else.

Best regards,
Krzysztof

#8 lore raw

PATCH 2/2 spi: spidev: Add data loopback OF compatible

In reply to Francesco Dolcini

From: Francesco Dolcini <[email protected]>

Add "spi-miso-mosi-loopback" OF compatible, that describes a single wire loopback between the two data signals, MISO and MOSI.

This kind of setup can be used for testing the SPI functionality.

---
 drivers/spi/spidev.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/spi/spidev.c +2 -0
index 638221178384..3874fd449580 100644
@@ -701,6 +701,7 @@ static const struct spi_device_id spidev_spi_ids[] = {
 	{ .name = /* semtech */ "sx1301" },
 	{ .name = /* silabs */ "em3581" },
 	{ .name = /* silabs */ "si3210" },
+	{ .name = "spi-miso-mosi-loopback" },
 	{},
 };
 MODULE_DEVICE_TABLE(spi, spidev_spi_ids);
@@ -735,6 +736,7 @@ static const struct of_device_id spidev_dt_ids[] = {
 	{ .compatible = "semtech,sx1301", .data = &spidev_of_check },
 	{ .compatible = "silabs,em3581", .data = &spidev_of_check },
 	{ .compatible = "silabs,si3210", .data = &spidev_of_check },
+	{ .compatible = "spi-miso-mosi-loopback", .data = &spidev_of_check },
 	{},
 };
 MODULE_DEVICE_TABLE(of, spidev_dt_ids);
Signature · 1 line
2.47.3