i.MX8QXP LPSPI device

cancel
Showing results for 
Search instead for 
Did you mean: 

i.MX8QXP LPSPI device

Jump to solution
1,123 Views
nolan_zinn
Contributor IV

I'm trying to access the lpspi channels on my i.MX8QXP.  From the baseboard schematics, I found where LPSPI0 connects to the Arduino/MikroBus connector.  I have this wired to a spi slave device (an STM32H743ZI development board from ST Micro).  My question is how to get our (Yocto) Linux to recognize the spi device and enumerate it as /dev/spidev0.0 (or something like that).  Once I can actually access the device, I should be able to test with it...

Thanks in advance,

Nolan Z

0 Kudos
1 Solution
928 Views
igorpadykov
NXP TechSupport
NXP TechSupport
0 Kudos
4 Replies
928 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Nolan

one can look at dts example on

fsl-imx8qxp-lpddr4-arm2-lpspi.dts\freescale\dts\boot\arm64\arch - linux-imx - i.MX Linux kernel 

driver

spi-fsl-lpspi.c\spi\drivers - 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
928 Views
nolan_zinn
Contributor IV

Hi igor,

I've tried what you recommended, using the lpspi dts example you gave.  I modified fsl-imx8qxp-mek-ov5640-rpmsg.dts to create spidev0 from lpspi0. When I boot up my imx8, the spidev0.0 still doesn't appear.  Looking down through the inherited devicetree files, I found another definition of lpspi0 at fsl-imxdx.dtsi on line 2735.  Will this conflict with the lpspi0 that I defined?

(I modified fsl-imx8qxp-mek-ov5640-rpmsg.dts because I also need camera functionality on the board.)

fsl-imx8qxp-mek-ov5640-rpmsg.dts

#include "fsl-imx8qxp-mek-rpmsg.dts"
#include "fsl-imx8qxp-mek-ov5640.dtsi"

&i2c_rpbus_5 {
    ov5640ov5640@3c {
        compatible = "ovti,ov5640_v3";
        reg = <0x3c>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_parallel_csi>;
        clocks = <&clk IMX8QXP_PARALLEL_CSI_MISC0_CLK>;
        clock-names = "csi_mclk";
        pwn-gpios = <&gpio3 2 GPIO_ACTIVE_LOW>;
        rst-gpios = <&gpio3 3 GPIO_ACTIVE_HIGH>;
        csi_id = <0>;
        mclk = <24000000>;
        mclk_source = <0>;
        status = "okay";
        port {
            ov5640_ependpoint {
                remote-endpoint = <&parallel_csi_ep>;
            };
        };
    };
};

&iomuxc {
    imxqxp-mek {
        pinctrl_lpspi0lpspi0grp {
            fsl,pins = <
                SC_P_SPI0_SCK_ADMA_SPI0_SCK     0x0600004c
                SC_P_SPI0_SDO_ADMA_SPI0_SDO     0x0600004c
                SC_P_SPI0_SDI_ADMA_SPI0_SDI     0x0600004c
                SC_P_SPI0_CS0_ADMA_SPI0_CS0     0x0600004c
            >;
        };
    };
};

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

    spidev0spi@0 {
        reg = <0>;
        compatible = "rohm, dh2228fv";
        spi-max-fequency = <10000000>;
    };
};

fsl-imx8dx.dtsi

    lpspi0lpspi@5a000000 {
        compatible = "fsl,imx7ulp-spi";
        reg = <0x0 0x5a000000 0x0 0x10000>;
        interrupts = <GIC_SPI 216 IRQ_TYPE_LEVEL_HIGH>;
        interrupt-parent = <&gic>;
        clocks = <&clk IMX8QXP_SPI0_CLK>,
             <&clk IMX8QXP_SPI0_IPG_CLK>;
        clock-names = "per""ipg";
        assigned-clocks = <&clk IMX8QXP_SPI0_CLK>;
        assigned-clock-rates = <20000000>;
        power-domains = <&pd_dma_lpspi0>;
        dma-names = "tx","rx";
        dmas = <&edma2 1 0 0>, <&edma2 0 0 1>;
        status = "disabled";
    };

Thanks,

Nolan Z

0 Kudos
929 Views
igorpadykov
NXP TechSupport
NXP TechSupport
0 Kudos
928 Views
nolan_zinn
Contributor IV

Thanks for that post, it was helpful.  From journalctl, I can now see that the imx8qxp is trying to register the spi device, however it fails with the following:

# journalctl | grep spi
Feb 03 11:30:50 imx8qxpmek kernel: fsl_lpspi 5a000000.lpspi: registered master spi0
Feb 03 11:30:50 imx8qxpmek kernel: spi_master spi0: /lpspi@5a000000/spi@0 has no valid 'spi-max-frequency' property (-22)
Feb 03 11:30:50 imx8qxpmek kernel: spi_master spi0: Failed to create SPI device for /lpspi@5a000000/spi@0

I will attempt removing this line from fsl-imx8qxp-mek-ov5640-rpmsg.dts and see what happens.  Lmk if you have any further suggestions.

EDIT: There was actually a typo.  I put in "spi-max-fequency".  I also had to change the "compatible" line of spidev0 to "spidev" in fsl-imx8qxp-mek-ov5640-rpmsg.dts.

Thanks,

Nolan Z

0 Kudos