I want to use SPI0 and SPI2, each spi connects 2 slave devices.
I found each spi has cs0 and cs1, then I do not need to use GPIO as cs.
&lpspi0 {
num-cs = <2>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lpspi0>;
#address-cells = <1>;
#size-cells = <0>;
dma-names = "no","no";
spidev00: spi@0 {
compatible = "toradex,evalspi";
reg = <0>;
spi-max-frequency = <4000000>;
};
spidev01: spi@1 {
compatible = "toradex,evalspi";
reg = <1>;
spi-max-frequency = <4000000>;
};
};
I use this device tree, but I can not get /dev/spidev0.1, there is only spidev0.0
dmesg | grep spi
[ 0.801484] fsl_lpspi 5a000000.lpspi: cs1 >= max 1
[ 0.806342] spi_master spi0: spi_device register error /lpspi@5a000000/spi@1
[ 0.813404] spi_master spi0: Failed to create SPI device for /lpspi@5a000000/spi@1
[ 0.813529] fsl_lpspi 5a000000.lpspi: dma setup error -19, use pio
It seems that there is only one cs, we can not use cs1.
I read this question:
https://www.toradex.com/community/questions/44621/apalis-imx8-spi-multiple-chip-select.html
then I try to use gpio as cs:
&lpspi0 {
num-cs = <2>;
fsl,espi-num-chipselects = <2>;
cs-gpios =<&gpio6 19 GPIO_ACTIVE_LOW>,
<&gpio6 20 GPIO_ACTIVE_LOW>;
......
it works. I found devices: /dev/spidev0.0, /dev/spidev0.1
so, how can I use spi cs1 pin instead of gpio?