如题,最近有空搞一下啊f1c200s,准备移植一个esp-hosted玩玩是使用spi控制,成功编译出驱动文件,加载驱动文件的时候报如下错误,请教一下看看是什么错误。
# ls
esp32_spi.ko
# modprobe esp32_spi.ko
[ 117.876915] esp32_spi: loading out-of-tree module taints kernel.
[ 118.101904] sun6i-spi 1c06000.spi: cs135 >= max 4
[ 118.106646] esp32_spi: spi_dev_init: Failed to add new SPI device
[ 118.551630] esp32_spi: spi_init: Failed Init SPI device
通过初始化函数可以知道是死在了spi_new_device里面
static int spi_dev_init(int spi_clk_mhz)
{
int status = 0;
struct spi_board_info esp_board = {{0}};
struct spi_master *master = NULL;
strscpy(esp_board.modalias, "esp_spi", sizeof(esp_board.modalias));
esp_board.mode = SPI_MODE_2;
esp_board.max_speed_hz = spi_clk_mhz * NUMBER_1M;
esp_board.bus_num = 1;
esp_board.chip_select = 135;
master = spi_busnum_to_master(esp_board.bus_num);
if (!master) {
esp_err("Failed to obtain SPI master handle\n");
return -ENODEV;
}
spi_context.esp_spi_dev = spi_new_device(master, &esp_board);
if (!spi_context.esp_spi_dev) {
esp_err("Failed to add new SPI device\n");
return -ENODEV;
}
status = spi_setup(spi_context.esp_spi_dev);
if (status) {
esp_err("Failed to setup new SPI device");
return status;
}
不是太明白这个un6i-spi 1c06000.spi: cs135 >= max 4是啥意思,难道不能定义大于4的cs引脚吗
离线
将esp_board.bus_num = 1;改为esp_board.bus_num = 0;就可以正常加载驱动了,但是并没有在dev下面生成设备,是不能使用spi1吗,在设备树里面已经将spi1设置为0k了
离线