Modifications in dts file to add spi slave support

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Modifications in dts file to add spi slave support

2,277 Views
s233199
Contributor II

Hello, I want to add spi slave support on a imx8qmlpddr4arm2 board. I added the slave entry on dts file but I do not understand if I have to change something in the pins configuration. Do I have to specify in the dts that the chip select must be set as input?

This is the pin description used for spi master mode:

pinctrl_lpspi0: lpspi0grp {
            fsl,pins = <
                SC_P_SPI0_SCK_DMA_SPI0_SCK        0x0600004c
                SC_P_SPI0_SDO_DMA_SPI0_SDO        0x0600004c
                SC_P_SPI0_SDI_DMA_SPI0_SDI        0x0600004c
            >;
        };

        pinctrl_lpspi0_cs: lpspi0cs {
            fsl,pins = <
                SC_P_SPI0_CS0_LSIO_GPIO3_IO05        0x21
            >;
        };

&lpspi0 {
    #address-cells = <1>;
    #size-cells = <0>;
    fsl,spi-num-chipselects = <1>;
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_lpspi0 &pinctrl_lpspi0_cs>;
    cs-gpios = <&gpio3 5 GPIO_ACTIVE_LOW>;
    status = "okay";
 

    spi:spi@0 {
         spi-max-frequency = <0x7a120>;
         reg = <0x0>;
         compatible = "linux,spimaster";
    };
};

What are the modifications I need to apply for slave mode?

Thank you in advance, I am new to dts files.

0 Kudos
1 Reply

1,701 Views
igorpadykov
NXP Employee
NXP Employee

Hi Erica

one can look at lpspi device tree documentation:

spi-fsl-lpspi.txt\spi\bindings\devicetree\Documentation - linux-imx - i.MX Linux kernel 

fsl-imx8qm-device.dtsi\freescale\dts\boot\arm64\arch - linux-imx - i.MX Linux kernel 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos