SPI loopback tests
Hello all,
I am writing to you SPI, test and DT people with reference to some need we see in our testing infrastructure.
On our embedded boards we regularly (on mailine linux, on Linux LTS, and on multiple hardware) run SPI tests, using a loopback connection (SPI MISO/MOSI are connected together). The HW provide just some pin header and there is no actual SPI slave device connected.
So far to test this we had some out-of-tree DT overlay abusing the spidev compatible, however we'd like to move away from this approach and have a solution that is 100% in mainline.
Manually unbinding/binding the driver in userspace does not seems as an option, because there is no device node.
One option that I could think of would be to add a new compatible that to describe this single wire loopback connection (something like linux,spi-miso-mosi-loopback) that would bind to the spidev driver.
I am aware that you all DT maintainers shared in a pretty clear way your view on the abuse of the spidev multiple times.
What would you be your advice to handle the need of an SPI loopback test? Am I missing something and there is a solution already available?
Thanks in advance,
Francesco
Mark Brown
maintainerQuoted 11 lines · Francesco Dolcini
So far to test this we had some out-of-tree DT overlay abusing the spidev compatible, however we'd like to move away from this approach and have a solution that is 100% in mainline.
Manually unbinding/binding the driver in userspace does not seems as an option, because there is no device node.
One option that I could think of would be to add a new compatible that to describe this single wire loopback connection (something like
linux,spi-miso-mosi-loopback) that would bind to the spidev driver.
Quoted 5 lines
I am aware that you all DT maintainers shared in a pretty clear way your view on the abuse of the spidev multiple times.
What would you be your advice to handle the need of an SPI loopback test? Am I missing something and there is a solution already available?
I'm not aware of any idiomatic way to deal with this with DT unfortunately. Perhaps the DT people have some ideas here?
Quoted 13 lines · Mark Brown
Quoted 10 lines · Francesco Dolcini
So far to test this we had some out-of-tree DT overlay abusing the spidev compatible, however we'd like to move away from this approach and have a solution that is 100% in mainline.
Manually unbinding/binding the driver in userspace does not seems as an option, because there is no device node.
One option that I could think of would be to add a new compatible that to describe this single wire loopback connection (something like
linux,spi-miso-mosi-loopback) that would bind to the spidev driver.
Quoted 8 lines
Quoted 5 lines
I am aware that you all DT maintainers shared in a pretty clear way your view on the abuse of the spidev multiple times.
What would you be your advice to handle the need of an SPI loopback test? Am I missing something and there is a solution already available?
I'm not aware of any idiomatic way to deal with this with DT unfortunately. Perhaps the DT people have some ideas here?
I dunno, the suggestion seems fairly reasonable to me. I don't think it's really abuse of anything, because the compatible would represent a real hardware configuration. The only think that feels "abusive" is the fake reg property you'd need.
Not sure that there should be a "linux," vendor prefix though, there's nothing linux-specific about doing loopback. Probably should be vendor-less?
Mark Brown
maintainerQuoted 9 lines · Conor Dooley
Quoted 7 lines · Mark Brown
Quoted 5 lines · Francesco Dolcini
I am aware that you all DT maintainers shared in a pretty clear way your view on the abuse of the spidev multiple times.
What would you be your advice to handle the need of an SPI loopback test? Am I missing something and there is a solution already available?
Quoted 7 lines
Quoted 2 lines
I'm not aware of any idiomatic way to deal with this with DT unfortunately. Perhaps the DT people have some ideas here?
I dunno, the suggestion seems fairly reasonable to me. I don't think it's really abuse of anything, because the compatible would represent a real hardware configuration. The only think that feels "abusive" is the fake reg property you'd need.
In theory we should have a compatible specifically for loopback usage I suppose. Depending on how the device does it's loopbacks there may actually be a genuine reg (if there's a chip select that's still selecting.
Quoted 3 lines
Not sure that there should be a "linux," vendor prefix though, there's nothing linux-specific about doing loopback. Probably should be vendor-less?
I think at this point it's old enough that it's just ABI and adding the option of having it vendorless would just cause people to ask why.
Quoted 18 lines · Mark Brown
Quoted 9 lines · Conor Dooley
Quoted 7 lines · Mark Brown
Quoted 5 lines · Francesco Dolcini
I am aware that you all DT maintainers shared in a pretty clear way your view on the abuse of the spidev multiple times.
What would you be your advice to handle the need of an SPI loopback test? Am I missing something and there is a solution already available?
Quoted 7 lines
Quoted 2 lines
I'm not aware of any idiomatic way to deal with this with DT unfortunately. Perhaps the DT people have some ideas here?
I dunno, the suggestion seems fairly reasonable to me. I don't think it's really abuse of anything, because the compatible would represent a real hardware configuration. The only think that feels "abusive" is the fake reg property you'd need.
Quoted 4 lines
In theory we should have a compatible specifically for loopback usage I suppose. Depending on how the device does it's loopbacks there may actually be a genuine reg (if there's a chip select that's still selecting.
Okay, fair enough.
Quoted 6 lines
Quoted 3 lines
Not sure that there should be a "linux," vendor prefix though, there's nothing linux-specific about doing loopback. Probably should be vendor-less?
I think at this point it's old enough that it's just ABI and adding the option of having it vendorless would just cause people to ask why.
I'm not sure what you mean by "it's old enough", as this proposed loopback compatible is new, right? Don't think this is any different to i2c-mux or regulator-fixed etc etc. Unless you thought that I was saying that "spidev" should be a compatible? Definitely was not suggesting that!
Mark Brown
maintainerQuoted 7 lines · Conor Dooley
Quoted 5 lines · Mark Brown
Quoted 3 lines · Conor Dooley
Not sure that there should be a "linux," vendor prefix though, there's nothing linux-specific about doing loopback. Probably should be vendor-less?
Quoted 7 lines
Quoted 2 lines
I think at this point it's old enough that it's just ABI and adding the option of having it vendorless would just cause people to ask why.
I'm not sure what you mean by "it's old enough", as this proposed loopback compatible is new, right? Don't think this is any different to i2c-mux or regulator-fixed etc etc. Unless you thought that I was saying that "spidev" should be a compatible? Definitely was not suggesting that!
It sounded like you were suggesting using spidev, yes.
Quoted 11 lines · Mark Brown
Quoted 9 lines · Conor Dooley
Quoted 8 lines · Mark Brown
Quoted 3 lines · Conor Dooley
Not sure that there should be a "linux," vendor prefix though, there's nothing linux-specific about doing loopback. Probably should be vendor-less?
I think at this point it's old enough that it's just ABI and adding the option of having it vendorless would just cause people to ask why.
Quoted 6 lines
Quoted 4 lines
I'm not sure what you mean by "it's old enough", as this proposed loopback compatible is new, right? Don't think this is any different to i2c-mux or regulator-fixed etc etc. Unless you thought that I was saying that "spidev" should be a compatible? Definitely was not suggesting that!
It sounded like you were suggesting using spidev, yes.
Ah ye no, not at all. Francesco suggested using "linux,spi-miso-mosi-loopback" and it was that I think the "linux," should be culled from.
Quoted 14 lines · Francesco Dolcini
Hello all,
I am writing to you SPI, test and DT people with reference to some need we see in our testing infrastructure.
On our embedded boards we regularly (on mailine linux, on Linux LTS, and on multiple hardware) run SPI tests, using a loopback connection (SPI MISO/MOSI are connected together). The HW provide just some pin header and there is no actual SPI slave device connected.
So far to test this we had some out-of-tree DT overlay abusing the spidev compatible, however we'd like to move away from this approach and have a solution that is 100% in mainline.
Quoted 6 lines
Manually unbinding/binding the driver in userspace does not seems as an option, because there is no device node.
One option that I could think of would be to add a new compatible that to describe this single wire loopback connection (something like
linux,spi-miso-mosi-loopback) that would bind to the spidev driver.
Or the modern board file way: a module which in initcall creates several SW nodes and instantiates the spidev. You still would need to insmode it of course, but that way no DT would be directly involved.
Quoted 6 lines
I am aware that you all DT maintainers shared in a pretty clear way your view on the abuse of the spidev multiple times.
What would you be your advice to handle the need of an SPI loopback test? Am I missing something and there is a solution already available?
Best regards,
Krzysztof