AW: AW: [PATCH v2] spi: Raise limit on number of chip selects
From: Hohn, Torben
Date: Thu Jul 10 2025 - 12:18:14 EST
-Bruker Confidential-
+AD4- On 07.07.2025 07:30:29, Hohn, Torben wrote:
+AD4- +AD4- +AD4- +AD4- +-+ACM-define SPI+AF8-CS+AF8-CNT+AF8-MAX 16
+AD4- +AD4- +AD4-
+AD4- +AD4- +AD4- +AD4- If this is increased to 24 now, we need to carry another patch on top of mainline again once we add another Chipselect
+AD4- +AD4- +AD4- +AD4- into our FPGA, or into the next iteration of our hardware. We would really prefer that a Kconfig value is used.
+AD4- +AD4- +AD4- +AD4- We have handed a patch to pengutronix, because they can send proper emails.
+AD4- +AD4-
+AD4- +AD4- +AD4- +AD4- In the IIO framework there is a Konfig Value for something similar:
+AD4- +AD4- +AD4- +AD4- https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/iio/trigger.h+ACM-n74
+AD4- +AD4- +AD4-
+AD4- +AD4- +AD4- This doesn't really work, we're supposed to support single kernel image
+AD4- +AD4- +AD4- so putting per platform configuration in Kconfig ends up being at best a
+AD4- +AD4- +AD4- usability problem. At some point it's better to just bite the bullet
+AD4- +AD4- +AD4- and make things dynamic.
+AD4- +AD4-
+AD4- +AD4- After looking a bit more throughly at the code, i dont think it is
+AD4- +AD4- necessary to make this dynamic. The Value at hand is actually the
+AD4- +AD4- number of Chipselects a Device might have and not the the maximum
+AD4- +AD4- number of Chipselects a Controller might have.
+AD4- I think it's both. The struct spi+AF8-controller uses SPI+AF8-CS+AF8-CNT+AF8-MAX:
+AD4-
+AD4- +AHw- struct spi+AF8-controller +AHs-
+AD4- +AFs-...+AF0-
+AD4- +AHw- s8 last+AF8-cs+AFs-SPI+AF8-CS+AF8-CNT+AF8-MAX+AF0AOw-
+AD4- +AHw- u32 last+AF8-cs+AF8-index+AF8-mask : SPI+AF8-CS+AF8-CNT+AF8-MAX+ADs-
This value saves that last chipselect that was active.
Before the multi-cs per device patch, this was a single u8 and no array.
The mask just states which element of last+AF8-cs is valid.
It is in struct spi+AF8-controller but since it just saves the value from one device. It still just the per device value, and unrelated to the
number of chipselects per device.
And the last+AF8-cs ccount an not be more than the maximum number of CS per device.
+AD4- See discussion
+AD4- https://lore.kernel.org/all/49b52941-6205-48bd-b2ae-e334018ac5cd+AEA-sirena.org.uk/
+AD4- for more details.
yeah... see:
https://lore.kernel.org/all/CAOiHx+AD0-mM7kpzR-MOshsgXZM+-CSB0nawfWxMhpt+AD0-tuhmJyMTCzQ+AEA-mail.gmail.com/