一、功能配置
1、make menuconfig
2、修改设备树
&spi3 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spi3m1_cs0 &spi3m1_pins>;
spi_test@00 {
compatible = "rockchip,rk-spidev";
reg = <0>;
spi-max-frequency = <5000000>;
};
};
3、修改驱动文件
vim spidev.c
增加compatible 匹配设备树参数。
static const struct spi_device_id spidev_spi_ids[] = {
{ .name = "dh2228fv" },
{ .name = "ltc2488" },
{ .name = "sx1301" },
{ .name = "bk4" },
{ .name = "dhcom-board" },
{ .name = "m53cpld" },
{ .name = "spi-petra" },
{ .name = "spi-authenta" },
{ .name = "rk-spidev" },
{},
};
static const struct of_device_id spidev_dt_ids[] = {
{ .compatible = "rohm,dh2228fv", .data = &spidev_of_check },
{ .compatible = "lineartechnology,ltc2488", .data = &spidev_of_check },
{ .compatible = "semtech,sx1301", .data = &spidev_of_check },
{ .compatible = "lwn,bk4", .data = &spidev_of_check },
{ .compatible = "dh,dhcom-board", .data = &spidev_of_check },
{ .compatible = "menlo,m53cpld", .data = &spidev_of_check },
{ .compatible = "cisco,spi-petra", .data = &spidev_of_check },
{ .compatible = "micron,spi-authenta", .data = &spidev_of_check },
{ .compatible = "rockchip,rk-spidev", .data = &spidev_of_check },
{},
};
二、测试spidev设备