我们在imx8qxp-mek开发板上测试LPSPI模块的SPI功能,将fsl-imx8qxp-mek.dtsi文件添加了imx8qxp-lpddr4-val-lpspi.dts/imx8qxp-lpddr4-val-lpspi.dts中的
pinctrl_lpspi0: lpspi0grp {
fsl,pins = <
IMX8QXP_SPI0_SCK_ADMA_SPI0_SCK 0x0600004c
IMX8QXP_SPI0_SDO_ADMA_SPI0_SDO 0x0600004c
IMX8QXP_SPI0_SDI_ADMA_SPI0_SDI 0x0600004c
>;
};
pinctrl_lpspi0_cs: lpspi0cs {
fsl,pins = <
IMX8QXP_SPI0_CS0_LSIO_GPIO1_IO08 0x21
>;
};
&lpspi0 {
fsl,spi-num-chipselects = <1>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lpspi0 &pinctrl_lpspi0_cs>;
cs-gpios = <&lsio_gpio1 8 GPIO_ACTIVE_LOW>; //使用gpio 做片选
status = "okay";
spidev0: spi@0 {
reg = <0>;
compatible = "rohm,xxxx";
spi-max-frequency = <50000000>;
};
};
启动开发板,spi-fsl-lpspi.c的控制器驱动加载注册成功并顺利完成probe函数
但出现一下问题:
1.在/dev/下找不到spidev*设备
2.对应片选信号引脚一直是低电平,并没有像驱动中写的SPI_CS_HIGH
3.我自己做了个slave设备驱动,在insmod之后CS被拉高,且在调用spi_sync()后,CS有拉低且SCK出现时钟,但MOSI没有电平变化
期待您的回复,谢谢!
do you select the spidev in menuconfig?
CONFIG_SPI=y
CONFIG_SPI_FSL_LPSPI=y
CONFIG_SPI_IMX=y
CONFIG_SPI_SPIDEV=y
CONFIG_SPI_MASTER=y
CONFIG_SPI_SLAVE=y
都选了
compatible = "rohm,xxxx" 这个改成 compatible = "rohm,dh2228fv"试一下?
可以找到spidev0.0了,但依然没有输出信号,这个dh2228fv是个虚拟的设备驱动是吗?是为了实例化lpspi controller吗?
这个是spidev.c里面定义的compatible string.
static const struct of_device_id spidev_dt_ids[] = {
{ .compatible = "rohm,dh2228fv" },
{ .compatible = "lineartechnology,ltc2488" },
{ .compatible = "ge,achc" },
{ .compatible = "semtech,sx1301" },
{ .compatible = "lwn,bk4" },
{ .compatible = "dh,dhcom-board" },
{ .compatible = "menlo,m53cpld" },
{},
};