SPI slave configuration in iMX8QM

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

SPI slave configuration in iMX8QM

966 Views
ajmalmali
Contributor II

Hi,

We are using imx8qm in our custom hardware,with linux kernel version :5.4.24. Here SPI0 is to be configured as slave which communicates with a RH850 processor (master).In imx8qm spi0 is configured with spi mode as 1 and 1MHz master clock (tried with 2MHz clock also)

Spi connections is as below:

SPI0 Master

MOSI <------------------ M0SI

MISO ------------------> MISO

SS <------------------ SS

SCLK <------------------ SCLK

we made the following update in the dts file:

lpspi0 {
#address-cells = <1>;
#size-cells = <0>;
fsl,spi-num-chipselects = <1>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lpspi0 &pinctrl_lpspi0_cs>;
spi-slave;
status = "okay";
spidev0: slave@0 {
reg = <0>;
compatible = "rohm,dh2228fv";
spi-max-frequency = <10000000>;
status = "okay";
};
};

pinctrl_lpspi0: lpspi0grp {
fsl,pins = <
IMX8QM_SPI0_SCK_DMA_SPI0_SCK 0x0600004c
IMX8QM_SPI0_SDO_DMA_SPI0_SDO 0x0600004c
IMX8QM_SPI0_SDI_DMA_SPI0_SDI 0x0600004c
IMX8QM_SPI0_CS0_DMA_SPI0_CS0 0x0600004c

>;
};

pinctrl_lpspi0_cs: lpspi0cs {
fsl,pins = <
IMX8QM_SPI0_CS0_LSIO_GPIO3_IO05 0x21
>;
};
when we try to recieve 2 bytes of data (from RH850), its getting hang. Can you check whether the dts configuration is correct or not.

Thanks in Advance!

0 Kudos
3 Replies

948 Views
AldoG
NXP TechSupport
NXP TechSupport

Hello,

Please try with the following dts settings for lpspi0 as slave:

lpspi0 {
#address-cells = <0>;
fsl,spi-num-chipselects = <1>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lpspi0>;
spi-slave;
status = "okay";
};

pinctrl_lpspi0: lpspi0grp {
fsl,pins = <
IMX8QM_SPI0_SCK_DMA_SPI0_SCK 0x0600004c
IMX8QM_SPI0_SDO_DMA_SPI0_SDO 0x0600004c
IMX8QM_SPI0_SDI_DMA_SPI0_SDI 0x0600004c
IMX8QM_SPI0_CS0_DMA_SPI0_CS0 0x0600004c
>;
};

I have followed this 2 dts as reference so you may take a look at them as well:

https://source.codeaurora.org/external/imx/linux-imx/tree/arch/arm64/boot/dts/freescale/imx8qm-lpddr...
https://source.codeaurora.org/external/imx/linux-imx/tree/arch/arm64/boot/dts/freescale/imx8qm-lpddr...

Best regards,
Aldo.

0 Kudos

932 Views
ajmalmali
Contributor II

Hi @AldoG ,

 

Thanks for the support.

 

I tried the reference configuration you have shared.

After integrating the updated node. I could not find spidev in "/dev" folder.

 

With my previous changes(dts) I was able to list the spidev in /dev folder.

Can you please check and support me?

Please revert if more details are required.

 

REgards

Ajmal

0 Kudos

926 Views
AldoG
NXP TechSupport
NXP TechSupport

Hi,

Sorry for the confusion, yes you may add the spidev node to it

lpspi0 {
#address-cells = <0>;
fsl,spi-num-chipselects = <1>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lpspi0>;
spi-slave;
status = "okay";

spidev0: slave@0 {

reg = <0>;

compatible = "rohm,dh2228fv";

spi-max-frequency = <10000000>;

status = "okay";

};
};

Best regards,
Aldo.

0 Kudos