* [DISCUSSION] spi multi chipselect support
@ 2018-07-18 16:35 Sebastian Reichel
2018-07-18 17:19 ` Lars-Peter Clausen
0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Reichel @ 2018-07-18 16:35 UTC (permalink / raw)
To: Rob Herring, Mark Brown; +Cc: linux-kernel, linux-spi, devicetree, kernel
[-- Attachment #1: Type: text/plain, Size: 1140 bytes --]
Hi Mark,
Some SPI slave devices have more than one chip select [0]. Rob suggested
to use the following DT notation for this [1]:
spi-controller {
slave@0 {
reg = <0>, <1>;
};
};
I think this makes sense from a DT point of view, but this needs
quite some changes in the SPI core. I tried to find out, how to
implement the suggestion in the last few days and I see two
possibilities:
1. Register two SPI Linux devices from one DT node. This needs the
fewest changes in SPI core. But we loose the one-to-one mapping
of DT nodes to devices. I have a feeling, that this will backfire.
2. Add support for multiple chip-select to spi_device and modify
the transfer functions to make use of this. Unfortunately this
would require changing all spi controller as far as I can see?
Can you please advise me how to proceed?
Thanks,
-- Sebastian
[0] For example microcontrollers with ISP (in-system programming)
interface, like the NXP Kinetis K20 series or the MRF89XA,
which has one chip-select for configuration register access
and one for FIFO access
[1] https://patchwork.kernel.org/patch/10310109/
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [DISCUSSION] spi multi chipselect support
2018-07-18 16:35 [DISCUSSION] spi multi chipselect support Sebastian Reichel
@ 2018-07-18 17:19 ` Lars-Peter Clausen
2018-07-19 13:25 ` Mark Brown
0 siblings, 1 reply; 3+ messages in thread
From: Lars-Peter Clausen @ 2018-07-18 17:19 UTC (permalink / raw)
To: Sebastian Reichel, Rob Herring, Mark Brown
Cc: linux-kernel, linux-spi, devicetree, kernel
On 07/18/2018 06:35 PM, Sebastian Reichel wrote:
> Hi Mark,
>
> Some SPI slave devices have more than one chip select [0]. Rob suggested
> to use the following DT notation for this [1]:
>
> spi-controller {
> slave@0 {
> reg = <0>, <1>;
> };
> };
>
> I think this makes sense from a DT point of view, but this needs
> quite some changes in the SPI core. I tried to find out, how to
> implement the suggestion in the last few days and I see two
> possibilities:
>
> 1. Register two SPI Linux devices from one DT node. This needs the
> fewest changes in SPI core. But we loose the one-to-one mapping
> of DT nodes to devices. I have a feeling, that this will backfire.
>
> 2. Add support for multiple chip-select to spi_device and modify
> the transfer functions to make use of this. Unfortunately this
> would require changing all spi controller as far as I can see?
>
Hi,
I believe that has been discussed before recently, but I can't find it in
the archives.
My preferred solution would to have something like
i2c_new_secondary_device(), but for SPI. This way the driver that binds to
the compatible string can allocate devices for additional chip selects as
necessary. Also make use of the reg-names property the same way as in I2C.
The only catch here is that locking in the SPI core needs to be re-worked,
since you can't allocate SPI devices from within another SPI device's probe
function. Something like
https://github.com/analogdevicesinc/linux/commit/b5cc8460b959e530413ffbf9b93d8012c80d05df
- Lars
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [DISCUSSION] spi multi chipselect support
2018-07-18 17:19 ` Lars-Peter Clausen
@ 2018-07-19 13:25 ` Mark Brown
0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2018-07-19 13:25 UTC (permalink / raw)
To: Lars-Peter Clausen
Cc: Sebastian Reichel, Rob Herring, linux-kernel, linux-spi,
devicetree, kernel
[-- Attachment #1: Type: text/plain, Size: 477 bytes --]
On Wed, Jul 18, 2018 at 07:19:19PM +0200, Lars-Peter Clausen wrote:
> My preferred solution would to have something like
> i2c_new_secondary_device(), but for SPI. This way the driver that binds to
> the compatible string can allocate devices for additional chip selects as
> necessary. Also make use of the reg-names property the same way as in I2C.
Yes, that's at least the most consistent way forwards if nothing else.
I don't really have any more appealing ideas anyway.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-07-19 13:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-18 16:35 [DISCUSSION] spi multi chipselect support Sebastian Reichel
2018-07-18 17:19 ` Lars-Peter Clausen
2018-07-19 13:25 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).