SPI CS pin control issue on Colibri VF61

Dear Support Team,

we current use Colibri VF61 with Linux BSP V2.4, and on our product we connect 4 SPI devices on SPI interface. one of them we use the SPI CS pin(Colibri SODIMM pin 86) as chip selection, the others we use general GPIOs as chip selection.

Now we met issue to control the SPI CS pin, how could we control it as other GPIOs to switch between 4 different SPI devices? is that work to modify default device tree changing pin mux of SPI CS (VF610_PAD_PTD5__DSPI1_CS0), delete it from default dspi1 and add to addtionalgpio?

Otherwise could you advise some other solution?
Thanks.

You may mix and match GPIO and regular HW chip selects as indicated in the kernel documentation:

http://git.toradex.com/cgit/linux-toradex.git/tree/Documentation/devicetree/bindings/spi/spi-bus.txt?h=toradex_vf_4.1#n15

Please don’t forget to adjust the pin muxing as indicated in the following article on our developer website:

You can use GPIO’s as additional chip selects as @marcel.ziswiler suggests, and therefor virtually any pin as chip select. Keep in mind that this is software based.

If possible, I would try to use the hardware chip selects. Refer to chapter 5.10 SPI of the Colibri VFxx Datasheet. Table Table 5-15 specifies the additional chip selects available for DSPI1 instance as SPI1_PCS1, SPI1_PCS2 and SPI1_PCS3. With that, you can add additional devices by simply using additional SPI slave nodes: see vf-colibri-eval-v3.dtsi (replace the number after the @ and the reg = with the chip select.

thanks Marcel, we will try on this.

thanks Stefan, if we have chance to modify our HW later, will follow this way.

Hi Stefan,
@stefan.agner
further question, if we use hardware chip selects as SPI1_PCS1 and others, due to by default the pin function for these pins are not SPI CS, for example SPI1_PCS1, it’s either “Camera Input Data<5>” or “USBH_PEN”, so we still need to modify the pin mux for these pins to assign them to SPI1 pin mux, and delete default pin definition, right?

thanks.