I've been working towards creating a unified (character or SocketCAN) driver model for SPI CAN controller MCP2515 and I found out that SPI_* macro family allow platform-neutral SPI device control but there's one thing I cannot find:
Is it possible to abstract chip select (CS) definition and usage in a similar way? Question arises from the fact that most SPI drivers are initialized (and *de facto supported*) per board but many (if not most) boards offer SPI external connectivity so any *collection* of SPI devices can be connected to any such board Since most drivers are initialized *per board*, any given *supported* device cannot be used in any given board without initialization being "ported" to that board, something a basic user cannot do Another related problem (discussed between Gregory Nutt and Sebastien Lorquet in https://nuttx.yahoogroups.narkive.com/7qv88uHr/proposal-support-multiple-spi-devices-of-same-type) is support of multiple similar devices in the same bus The solution to problem A is to have an abstraction mechanism for CS that can be used not only in driver code but in menuconfig so user is able to configure any possible combination of boards and *external* busses and devices to exploit NuttX device support. Is there or could be such abstraction mechanism to complement SPI_*? For problem B, I've seen hints in Bob Feretich's ADXL372 driver but couldn't find use of it to learn how. I've seen device IDs have an index but I still don't know how its used Any hint or opinion is greatly appreciated TIA Grr