SPI: chipselect 0 already in use

Hi, here is my idea:

  1. clone BeagleBoard.org / BeagleBoard-DeviceTrees · GitLab;

  2. create a separate branch (based on v5.10.x-ti-unified);

  3. under /src/arm/overlay copy BB-SPIDEV0-00A0.dts into BB-SPIDEV0-CUSTOM-00A0.dts;

  4. comment out chip select pin config.
    BB-SPIDEV0-CUSTOM-00A0.dts (1.9 KB)

  5. transfer BB-SPIDEV0-CUSTOM-00A0.dtbo to BBB;

  6. copy BB-SPIDEV0-00A0.dtbo into /lib/firmware;

  7. enable it in /boot/uEnv.txt (uboot_overlay_addr6=/lib/firmware/BB-SPIDEV0-CUSTOM-00A0.dtbo);

  8. reboot BBB;

  9. run: sudo modprobe spidev;

  10. insert custom interface spi driver. It reads ADXL345 ID.
    adxl345-driver.c (1.8 KB)

  11. custom driver fails with the message:
    chipselect 0 already in use

Is it possible to make spidev not to control chip select pin and do this by custom interface driver?
in other words: in device tree how to assign chip select pin to my custom driver?

I found probably similar case on stackoverflow: linux - How to add an SPI device driver, if a device is already accessed by the "spidev" driver? - Stack Overflow
Here is the answer:
“You can’t register two drivers for one HW device. Your alternative is to write your own SPI chip (client) driver according to Linux SPI driver model.”
That is ok, but at the same time it raises another question.
Working on the same adxl345 over I2C I used the same approach as I tried with SPI.

  1. enable I2C in /boot/uEnv.txt:
    uboot_overlay_addr6=BB-I2C1-00A0.dtbo
  2. develop kernel module and insert it:
    sudo insmod adxl345-driver.ko
  3. run application, which refers to /dev/adxl345-i2c and read data.
    So, in this case two drives works with the same HW.

Apple’s and Orange’s…

BB-I2C1-00A0.dtbo just enables the i2c bus… it doesn’t load a driver…

loading SPIDEV.dtbo enables the spi bus and loads the spidev driver…

Regards,