Enabling the spi on imx8qm

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Enabling the spi on imx8qm

1,974件の閲覧回数
LS
Contributor II

I want to enable spi on imx8qm evaluation board.

kernel i am using is 5.4.224.

looks like below link is little too old :

https://community.nxp.com/t5/i-MX-Processors/Adding-new-spi-module-on-IMX8-quad-max-with-Yocto/m-p/8...

any leads would be appreciated. thank you.

Regards,

LS

タグ(3)
0 件の賞賛
8 返答(返信)

1,948件の閲覧回数
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi @LS ,

I hope you are doing well.
 
It is to be mentioned that lpspi controller nodes are defined in imx8-ss-adma.dtsi and imx8-ss-dma.dtsi which are included in imx8qm.dtsi files. so no need to define it again as shown in the link.
 
To define slave node and pinctrl property one can refer to root/arch/arm64/boot/dts/freescale/imx8qm-lpddr4-val-lpspi.dts in linux-imx. please make sure your lpspi node contains status = "okay" property.
 
Please make sure that your kernel configuration contains the below-mentioned options.
CONFIG_SPI=y
CONFIG_SPI_FSL_LPSPI=y
 
Thanks & Regards,
Sanket Parekh
0 件の賞賛

1,080件の閲覧回数
davehitchman1
Contributor I

thanks, but none of those files exist for me, where are they actually supposed to be, why wouldnt they exist

0 件の賞賛

1,942件の閲覧回数
LS
Contributor II

thanks for the reply.

i updated : msc-sm2s-imx8mp-module.dtsi with below items.

pinctrl_lpspi0: lpspi0grp {
fsl,pins = <
IMX8QM_SPI0_SCK_DMA_SPI0_SCK 0x600004c
IMX8QM_SPI0_SDO_DMA_SPI0_SDO 0x600004c
IMX8QM_SPI0_SDI_DMA_SPI0_SDI 0x600004c
>;
};
pinctrl_lpspi0_cs: lpspi0cs {
fsl,pins = <
IMX8QM_SPI0_CS0_LSIO_GPIO3_IO05 0x21
>;
};

pinctrl_lpspi3: lpspi3grp {
fsl,pins = <
IMX8QM_SPI3_SCK_DMA_SPI3_SCK 0x600004c
IMX8QM_SPI3_SDO_DMA_SPI3_SDO 0x600004c
IMX8QM_SPI3_SDI_DMA_SPI3_SDI 0x600004c
IMX8QM_SPI3_CS0_DMA_SPI3_CS0 0x600004c
>;
};  

 

 

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

flash: at45db041e@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "atmel,at45", "atmel,dataflash";
spi-max-frequency = <5000000>;
reg = <0>;
};
};

&lpspi3 {
fsl,spi-num-chipselects = <1>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lpspi3>;
status = "okay";

spidev0: spi@0 {
reg = <0>;
compatible = "rohm,dh2228fv";
spi-max-frequency = <30000000>;
};
};.

 

 

but am getting error:

*/build/tmp/work-shared/imx8/kernel-build-artifacts=/usr/src/kernel LD=aarch64-fslc-linux-ld.bfd LOADADDR=0x40480000
| DTC arch/arm64/boot/dts/msc/imx8mp/msc-sm2s-imx8mp-001-module.dtb
| Error: /*/build/tmp/work-shared/imx8/kernel-source/arch/arm64/boot/dts/msc/imx8mp/msc-sm2s-imx8mp-module.dtsi:537.1-8 Label or path lpspi0 not found
| Error: /*/build/tmp/work-shared/imx8/kernel-source/arch/arm64/boot/dts/msc/imx8mp/msc-sm2s-imx8mp-module.dtsi:553.1-8 Label or path lpspi3 not found
| Error: /*/build/tmp/work-shared/imx8/kernel-source/arch/arm64/boot/dts/msc/imx8mp/msc-sm2s-imx8mp-module.dtsi:1359.25-26 syntax error
| FATAL ERROR: Unable to parse input tree
| scripts/Makefile.lib:285: recipe for target 'arch/arm64/boot/dts/msc/imx8mp/msc-sm2s-imx8mp-001-module.dtb' failed
| make[2]: *** [arch/arm64/boot/dts/msc/imx8mp/msc-sm2s-imx8mp-001-module.dtb] Error 1
| /home/commonos/COS_OS/build/tmp/work-shared/imx8/kernel-source/Makefile:1275: recipe for target 'msc/imx8mp/msc-sm2s-imx8mp-001-module.dtb' failed
| make[1]: *** [msc/imx8mp/msc-sm2s-imx8mp-001-module.dtb] Error 2
| /home/commonos/COS_OS/build/tmp/work-shared/imx8/kernel-source/Makefile:179: recipe for target 'sub-make' failed
| make: *** [sub-make] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.

if - include : imx8-ss-dma.dtsi it throws error in imx8-ss-dma.dtsi file

Regards,

LS

0 件の賞賛

1,913件の閲覧回数
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi @LS 

I hope you are doing well.
 
Please make sure that msc-sm2s-imx8mp-module.dtsi contains #include "imx8qm.dtsi".
And confirm that the directory kernel-source/arch/arm64/boot/dts/msc/imx8mp/ contains all included dtsi files and other dependent dtsi files.
 
Please provide me with device tree files and mention other files in the above-mentioned directory for further debugging.
 
Thanks & Regards,
Sanket Parekh

0 件の賞賛

1,908件の閲覧回数
LS
Contributor II

hi sanketh,

Thanks for the reply.

Please do check i have attached the dts.tgz with modifications.

from my kernel source

Regards,

LS

0 件の賞賛

1,900件の閲覧回数
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi @LS ,

I hope you are doing well.
 
From the query, it looks like you want to enable spi on the imx8qm evaluation board.
As you are making changes to msc-sm2s-imx8mp-module.dtsi, it looks contradictory.
 
One can refer to /dts/freescale for imx8qm-based boards.
 
Thanks & Regards,
Sanket Parekh

0 件の賞賛

1,863件の閲覧回数
LS
Contributor II

hi sanket ,

Sorry my bad.

i have to do changes on msc-sm2s-imx8mp-module.dtsi.

which is imx8mp based board.

 

Regards,

LS

 

0 件の賞賛

1,850件の閲覧回数
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi @LS ,

I hope you are doing well.
 
i.MX8MP Application Processor has ECSPI(Enhanced Configurable SPI) modules instead of LPSPI.
Please remove those lpspi and pinctrl_lpspi nodes from  msc-sm2s-imx8mp-module.dtsi 

It is to be mentioned that ecspi controller nodes are defined in imx8mp.dtsi which must be included in msc-sm2s-imx8mp-module.dtsi file. so no need to define it again.
 
Slave node and pinctrl properties are already defined in the msc-sm2s-imx8mp-module.dtsi, please make sure your ecspi node contains status = "okay" property.
 
Please make sure that your kernel configuration contains the below-mentioned options.
CONFIG_SPI=y
CONFIG_SPI_IMX=y
 
To use the User mode SPI driver Please enabled below mentioned option in the kernel configuration
CONFIG_SPI_SPIDEV=y
 
One can refer to examples at root/tools/spi for the user space interface of spi.
 
Thanks & Regards,
Sanket Parekh

0 件の賞賛