此文档基于迅为iTOP-iMX6开发板
1.内核
拷贝rc522驱动到iTOP-iMX6_android6.0.1/kernel_imx/drivers/spi目录下。
打开iTOP-iMX6_android6.0.1/kernel_imx/drivers/spi/Makefile
添加:
obj-$(CONFIG_SPI_RC522) += rc522.o
iTOP-iMX6_android6.0.1/kernel_imx/drivers/spi/Kconfig
在文件末尾添加:
config SPI_RC522
tristate "RC522 Module driver support"
help
This supports RC522 Module drivers.
2.修改设备树文件
iTOP-iMX6_android6.0.1/kernel_imx/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
(1)添加:
&ecspi2 {
fsl,spi-num-chipselects = <1>;
cs-gpios = <&gpio2 27 0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi2>;
status = "okay";
rfid: rc522@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "rc522";
spi-max-frequency = <10000000>;
reg = <0>;
};
};
pinctrl_ecspi2: ecspi2grp {
fsl,pins = <
MX6QDL_PAD_EIM_OE__ECSPI2_MISO 0x100b1
MX6QDL_PAD_EIM_CS1__ECSPI2_MOSI 0x100b1
MX6QDL_PAD_EIM_CS0__ECSPI2_SCLK 0x100b1
MX6QDL_PAD_EIM_LBA__GPIO2_IO27 0x1b0b0
>;
};
(2) 注释语句
MX6QDL_PAD_EIM_CS1__GPIO2_IO24 0x80000000