Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    T113的spi 不能使用compatible=“spidev”?

    其它全志芯片讨论区
    3
    5
    2713
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      captain LV 5 last edited by

      主控:T113-S3
      SDK:longan_sdk
      配置SPI设备树   compatible = "spidev"; ,会在启动log打印错误日志如下:
      问题1:不能使用spidev 吗?
      问题2:如果不使用 spidev ,那么我怎么去使用 ioctl 函数去控制 spi 接口呢?

      //这是spi的设备树配置
      &spi1 {
          clock-frequency = <100000000>;
          pinctrl-0 = <&spi1_pins_a &spi1_pins_b>;
          pinctrl-1 = <&spi1_pins_c>;
          pinctrl-names = "default", "sleep";
          spi_slave_mode = <0>;
          spi1_cs_number = <1>;
          spi1_cs_bitmap = <1>;
          status = "okay";
          spi_board1@0 {
                  device_type = "spi_board1";
                  compatible = "spidev";
                  spi-max-frequency = <0x5f5e100>;
                  reg = <0x0>;
                  spi-rx-bus-width = <0x8>;
                  spi-tx-bus-width = <0x8>;
                  status = "okay";
          };
      };
      
      //这个是启动log的日志
       WARNING: CPU: 1 PID: 1 at /kernel/linux-5.4/drivers/spi/spidev.c:738 spidev_probe+0x148/0x174
      [    3.350503] /soc@3000000/spi@4026000/spi_board1@0: buggy DT: spidev listed directly in DT
      [    3.359611] Modules linked in:
      [    3.363014] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G        W         5.4.61+ #11
      [    3.371341] Hardware name: Generic DT based system
      [    3.376684] [<c010e2f8>] (unwind_backtrace) from [<c010a8bc>] (show_stack+0x10/0x14)
      [    3.385303] [<c010a8bc>] (show_stack) from [<c0757ff0>] (dump_stack+0x7c/0x98)
      [    3.393354] [<c0757ff0>] (dump_stack) from [<c0119780>] (__warn+0xac/0xdc)
      [    3.401018] [<c0119780>] (__warn) from [<c0119820>] (warn_slowpath_fmt+0x70/0x9c)
      [    3.409350] [<c0119820>] (warn_slowpath_fmt) from [<c047a1c8>] (spidev_probe+0x148/0x174)
      [    3.418450] [<c047a1c8>] (spidev_probe) from [<c0476efc>] (spi_drv_probe+0x78/0xa0)
      [    3.426972] [<c0476efc>] (spi_drv_probe) from [<c042e564>] (really_probe+0x1a8/0x418)
      [    3.435696] [<c042e564>] (really_probe) from [<c042ea3c>] (driver_probe_device+0x10c/0x158)
      [    3.444990] [<c042ea3c>] (driver_probe_device) from [<c042ec14>] (device_driver_attach+0x44/0x5c)
      [    3.454863] [<c042ec14>] (device_driver_attach) from [<c042ecd8>] (__driver_attach+0xac/0xb8)
      [    3.464356] [<c042ecd8>] (__driver_attach) from [<c042cab0>] (bus_for_each_dev+0x64/0xa0)
      [    3.473467] [<c042cab0>] (bus_for_each_dev) from [<c042d9b8>] (bus_add_driver+0xd8/0x1b4)
      [    3.482579] [<c042d9b8>] (bus_add_driver) from [<c042f4b8>] (driver_register+0xb0/0xf8)
      [    3.491492] [<c042f4b8>] (driver_register) from [<c0b1a930>] (spidev_init+0x74/0xb8)
      [    3.500117] [<c0b1a930>] (spidev_init) from [<c0102f6c>] (do_one_initcall+0x7c/0x1bc)
      [    3.508836] [<c0102f6c>] (do_one_initcall) from [<c0b00e04>] (kernel_init_freeable+0x108/0x1cc)
      [    3.518521] [<c0b00e04>] (kernel_init_freeable) from [<c076c69c>] (kernel_init+0x8/0x118)
      [    3.527628] [<c076c69c>] (kernel_init) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
      [    3.536045] Exception stack(0xc6817fb0 to 0xc6817ff8)
      [    3.541671] 7fa0:                                     00000000 00000000 00000000 00000000
      [    3.550767] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      [    3.559865] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000
      [    3.567268] ---[ end trace 80ad20687cc8643a ]---
      
      1 Reply Last reply Reply Quote Share 0
      • Y
        YterAA LV 7 last edited by

        参考 《D1-H_Linux_SPI_开发指南.pdf》

        使用spidev并不需要专门设置compatible = "spidev";。而设置spidev会导致 spidev listed directly in DT 错误。这里使用的虚拟设备可以通过compatible = "rohm,dh2228fv"; 这样的 compatible 设备绕过检测

        可用的spidev如下:
        0a055740-74c0-4b68-8a5d-a1c24fd60a14-image.png

        WARN参考spidev源码:
        8cdcd530-29c1-4c9c-8e4a-db31133219b7-image.png

        C 1 Reply Last reply Reply Quote Share 0
        • Y
          YiXinTai LV 5 last edited by

          372ccb13-b6b9-4a7c-8e69-01e696e316dc-5f7cc806dcbdb231e48bac1c3e1cb2e.jpg

          可以这样设置

          C 1 Reply Last reply Reply Quote Share 0
          • C
            captain LV 5 @YterAA last edited by

            @yteraa
            感谢!改成compatible = "rohm,dh2228fv" 是可以消除那个警告的!

            1 Reply Last reply Reply Quote Share 0
            • C
              captain LV 5 @YiXinTai last edited by

              @yixintai
              这样设置并不能消除那个开机时候的警告吧!只是把 spi_board1 后面的设备地址去掉了。

              1 Reply Last reply Reply Quote Share 0
              • 1 / 1
              • First post
                Last post

              Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

              行为准则 | 用户协议 | 隐私权政策