We have 2 SPI slave devices connected to the same colibri standard SPI bus with different chip_selects on our custom carrier board. We are able to communicate with the 1st SPI device using the default SPI driver from the kernel. But what do we do to make the driver work for 2nd one? By reading posts on the forum, my understanding is to add the 2nd device to board device tree file (imx6dl_colibri_eval_v3.dts). So the SPI session of the file looks like this:
/* Colibri SPI */
&ecspi4 {
status = “okay”;
Then compile and copy the the DTB file to a SD card, which is then used to update target device tree (run update_fdt at uboot prompt). However that did not work for me. I did not see a 2nd SPI device appear under /dev folder (first SPI device appears as spidev3.0).
For two SPI slave devices, one would also require two chip selects. Freescale ECSPI driver uses the device node property fsl,spi-num-chipselects to specify the number of chip selects and cs-gpios to specify the GPIO’s to be used as chip selects. Please have a look here at the device tree binding documentation.
Note that the choice of second GPIO for chipselect would be as per one’s pin multiplexing requirements for a custom carrier board or testing. The above is just an example, a custom carrier board dts file would be more apt. Please also have a look at our Device Tree Customization article.
With the above change in place and a device tree update, two spidev nodes would be seen as below.
root@colibri-imx6:~# uname -a
Linux colibri-imx6 3.14.52-v2.6b2+g9ace52b #1 SMP Thu May 26 06:31:06 CEST 2016 armv7l GNU/Linux
root@colibri-imx6:~# ls /dev | grep -i "spidev"
spidev3.0
spidev3.1
I did not test the functioning of two spidev’s but the above should work as expected.
It would be recommended to open a new topic for questions unrelated to the current topic. spidev should not require any modification for communicating with any spi device microcontroller or otherwise.