AnsweredAssumed Answered

Configuration of spi slave in device tree files for IMX8 board

Question asked by Erica Magari on May 15, 2019
Latest reply on May 15, 2019 by igorpadykov

Hello, I am writing an SPI SLAVE driver for an imx8qmlpddr4arm2 board with Yocto. I have problems adding the slave entry on the dts file. In particular, when I test the code, my slave keeps waiting for ever to receive something, even if the other board sends data.

My code:

 

fsl-imx8qm.dtsi:

    lpspi0: lpspi@5a000000 {
        compatible = "fsl,imx7ulp-spi";
        reg = <0x0 0x5a000000 0x0 0x10000>;
        interrupts = <GIC_SPI 216 IRQ_TYPE_LEVEL_HIGH>;
        interrupt-parent = <&gic>;
        clocks = <&clk IMX8QM_SPI0_CLK>,
             <&clk IMX8QM_SPI0_IPG_CLK>;
        clock-names = "per", "ipg";
        
        
        power-domains = <&pd_dma_lpspi0>;
        status = "disabled";
    };

 

fsl-imx8qm-lpddr4arm2.dts

        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_CS1_DMA_SPI0_CS1        0x21
            >;
        };

 

&lpspi0 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_lpspi0 &pinctrl_lpspi0_cs>;
    status = "okay";
    spi-slave;

    slave {
        compatible = "linux,spislave";
    };
};

 

Is correct to set the cs pin as DMA or it is better to set it as GPIO? What is the difference?

And the number 0x21, do I need to change something? I am reading the manual but I cannot understend what I have to modify. Can I use 0x0600004c as the other signals? I have not found anything on the web that could help me.

Thank you in advance a lot!

Erica

Outcomes