明远智睿技术论坛
标题:
IMX8M ECSPI的设备节点配置
[打印本页]
作者:
KWH
时间:
2020-3-12 11:07
标题:
IMX8M ECSPI的设备节点配置
MY-IMX8M由于管脚复用问题,默认是没有配置SPI节点,如果需要使用SPI,可以在源码设备树中进行相关的配置。
一、MY-IMX8M-EK300原理图:
[attach]662[/attach]
二、在设备树中进行相关配置(myimx8mq.dts):
1.把复用管脚注释:
/*pinctrl_spi1_uart3_bt_rts: spi1_uart3_bt_rts_grp { fsl,pins = <
MX8MQ_IOMUXC_ECSPI1_SS0_UART3_DCE_RTS_B 0x49
>;
};
pinctrl_spi1_ts_int: spi1_ts_int_grp {
fsl,pins = <
MX8MQ_IOMUXC_ECSPI1_MOSI_GPIO5_IO7 0x19
>;
};
pinctrl_spi1_uart3_bt_cts: spi1_uart3_bt_cts_grp {
fsl,pins = <
MX8MQ_IOMUXC_ECSPI1_MISO_UART3_DCE_CTS_B 0x49
>;
};
pinctrl_spi1_bt_cts_gpio: spi1_bt_cts_gpio_grp {
fsl,pins = <
MX8MQ_IOMUXC_ECSPI1_MISO_GPIO5_IO8 0x19
>;
};
pinctrl_spi1_dsi_en: spi1_dsi_en_grp {
fsl,pins = <
MX8MQ_IOMUXC_ECSPI1_SCLK_GPIO5_IO6 0x19
>;
};*/
2.ECSPI管脚配置:
pinctrl_spi1_ss0_gpio: spi1_ss0_gpio_grp {
fsl,pins = <
MX8MQ_IOMUXC_ECSPI1_SS0_GPIO5_IO9 0x40000
>;
};
pinctrl_ecspi1_ecspi1: ecspi1_grp {
fsl,pins = <
MX8MQ_IOMUXC_ECSPI1_MOSI_ECSPI1_MOSI 0x82
MX8MQ_IOMUXC_ECSPI1_MISO_ECSPI1_MISO 0x82
MX8MQ_IOMUXC_ECSPI1_SCLK_ECSPI1_SCLK 0x82
>;
};
3.把复用管脚的节点也注释掉:
&i2c3 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c_i2c3>;
status = "okay";
/*synaptics_dsx_ts: synaptics_dsx_ts@20 {
compatible = "synaptics_dsx";
reg = <0x20>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_spi1_ts_int &pinctrl_gpio_ts_rst>;
interrupt-parent = <&gpio5>;
interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
synaptics,diagonal-rotation;
status = "disabled";
};*/
};
/*&uart3 { /* BT *
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart_uart3 &pinctrl_spi1_uart3_bt_rts &pinctrl_spi1_uart3_bt_cts>;
assigned-clocks = <&clk IMX8MQ_CLK_UART3>;
assigned-clock-parents = <&clk IMX8MQ_SYS1_PLL_80M>;
fsl,uart-has-rtscts;
resets = <&modem_reset>;
status = "okay";
};*/
4.添加SPI节点和设备子节点:
&ecspi1 {
fsl,spi-num-chipselects = <1>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_spi1_ss0_gpio &pinctrl_ecspi1_ecspi1>;
cs-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>;
status = "okay";
spidev1: spi@0 {
compatible = "rohm,dh2228fv";
reg = <0>;
spi-max-frequency = <20000000>;
};
};
三、重新编译设备树并烧录到开发板中
烧录完成后可在开发板中看到/dev/spidev0.0
附件:SPI测试源码
欢迎光临 明远智睿技术论坛 (http://bbs.myzr.com.cn/)
Powered by Discuz! X3.2