Hello NXP team,
I've been trying to set up lpspi0 in a i.MX8QXP-MEK (CPU + BaseBoard) connected to a SLB9670 TPM2.0 device thorough the Arduino Header port in the BB (J29) with DMA. Device was correctly detected, but I've been having DMA setup problems, and spi config is switching to PIO:
root@imx8qxpc0mek:~# dmesg | grep spi
[ 1.464934] fsl_lpspi 5a000000.spi: spi_register_controller error.
[ 1.479991] spi-nor spi0.0: mt35xu512aba (65536 Kbytes)
[ 3.087588] fsl_lpspi 5a000000.spi: dma setup error -19, use pio
[ 3.103069] tpm_tis_spi spi1.0: 2.0 TPM (device-id 0x1B, rev-id 22)
root@imx8qxpc0mek:~# dmesg | grep tpm
[ 3.103069] tpm_tis_spi spi1.0: 2.0 TPM (device-id 0x1B, rev-id 22)
[ 3.115911] tpm tpm0: A TPM error (256) occurred attempting the self test
[ 3.127689] tpm tpm0: starting up the TPM manually
Distro is set up with release LF5.10.72_2.2.0 (hardnott), though I have seen the same issue in release LF5.15.32_2.0.0 (kirkstone) as well. Both set up according to the IMXLXYOCTOUG document. Default linux-imx kernel & fsl-lpspi.c driver source as well.
DMA config for lpspi0 was set up following the device tree file imx8-ss-dma.dtsi. Only difference is the assigned clock rate, from 20 MHz to 60 MHz:
lpspi0: spi@5a000000 {
//compatible = "fsl,imx7ulp-spi", "fsl,imx8qxp-spi";
compatible = "fsl,imx7ulp-spi";
reg = <0x5a000000 0x10000>;
#address-cells = <1>;
#size-cells = <0>;
interrupts = <GIC_SPI 336 IRQ_TYPE_LEVEL_HIGH>;
interrupt-parent = <&gic>;
clocks = <&spi0_lpcg 0>,
<&spi0_lpcg 1>;
clock-names = "per", "ipg";
assigned-clocks = <&clk IMX_SC_R_SPI_0 IMX_SC_PM_CLK_PER>;
assigned-clock-rates = <60000000>;
//assigned-clock-rates = <20000000>;
power-domains = <&pd IMX_SC_R_SPI_0>;
dma-names = "tx","rx";
dmas = <&edma2 1 0 0>, <&edma2 0 0 1>;
status = "disabled";
};
And for the actual device node itself, in imx8x-mek.dtsi:
&lpspi0 {
#address-cells = <1>;
#size-cells = <0>;
fsl,spi-num-chipselects = <1>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lpspi0 &pinctrl_lpspi0_cs>;
cs-gpios = <&lsio_gpio1 8 GPIO_ACTIVE_LOW>;
status = "okay";
tpm: slb9670@0 {
reg = <0>;
//compatible = "infineon,slb9670", "tcg,tpm_tis-spi";
compatible = "infineon,slb9670";
spi-max-frequency = <2000000>;
status = "okay";
};
spidev0: spi@0 {
reg = <0>;
compatible = "rohm,dh2228fv", "spidev";
spi-max-frequency = <1000000>;
status = "disabled";
};
};
Currently using CS as GPIO - as seem in the node for the NOR flash in imx8qm-lpddr4-val-lpspi.dts, which has been working as expected. Changing the default assigned-clock-rate property to 60000000 was effective in achieving the desired up the clock line the the SPI slave (2[MHz]).LPSPI0 bus activity between processor and SLB9670 device.
What could be the cause of the DMA error in this scenario?
已解决! 转到解答。
Hi @guilhermes,
Could you please check if there is another device-tree node using SPI gpio?
Best Regards,
Dhruvit.
Hello @Dhruvit, we checked and there is not another device-tree node using this SPI. But we managed to get the communication working; seems to be a signal issue in our hardware.
Thanks and sorry for the late reply!