CubieBoard中文论坛

 找回密码
 立即注册
搜索
热搜: unable
查看: 10780|回复: 6

cb a20 android 下spi设备的结点名字是什么?

[复制链接]
发表于 2013-12-5 17:42:36 | 显示全部楼层 |阅读模式
由于想玩玩CB2的SPI,就使用这里的源码:
http://forum.cubietech.com/forum.php?mod=viewthread&tid=1306

我在kernel的driver里面通过  make ARCH=arm menuconfig 打开了  spi   以及 sun7i_spi的驱动,然后编译进内核

修改sys_config.fex如下:
vim ./tools/pack/chips/sun7i/configs/android/sugar-cubieboard2/sys_config.fex
------------------
  1. 246 ;-------------------------------------------------------------------------------
  2. 247 ;spi configuration
  3. 248 ;-------------------------------------------------------------------------------
  4. 249 [spi0_para]
  5. 250 spi_used            = 1
  6. 251 spi_cs_bitmap       = 1
  7. 252 spi_cs0             = port:PI10<2><default><default><default>
  8. 253 spi_sclk            = port:PI11<2><default><default><default>
  9. 254 spi_mosi            = port:PI12<2><default><default><default>
  10. 255 spi_miso            = port:PI13<2><default><default><default>

  11. 287 ;---------------------------
  12. 288 [spi_devices]
  13. 289 spi_dev_num = 1
  14. 290
  15. 291 [spi_board0]
  16. 292 modalias = "spidev"
  17. 293 max_speed_hz = 12000000
  18. 294 bus_num = 1
  19. 295 chip_select = 1
  20. 296 mode = 0
  21. 297 full_duplex = 1
  22. 298 ;manual_cs = 0

复制代码
然后extrasp  并  pack  生成可烧写的 img,烧录进cubieboard2板子里,
在ubuntu 下 adb shell上去,进入 /dev 目录下,ls 并没有发现我心目中的 spi的名字,比如 "spixxxx"之类的,请问我这个spi成功了吗?成功了,那么它应该像串口那样生产"ttySx"那样的名字啊,请问它是什么名字呢?
如果没成功,那是不是我的配置有什么错误?
求指点下,谢谢!


ps:已经有  spi-sun7i.c的文件了,我想驱动是没问题了,那到底是什么问题导致了这个情况呢?迷茫中...


谢谢!









回复

使用道具 举报

发表于 2014-1-17 11:37:28 | 显示全部楼层

回帖奖励 +5 金钱

linux .config文件添加:
CONFIG_SPI_SUN7I=y
CONFIG_SPI=y
CONFIG_SPI_MASTER=y
CONFIG_EXPERIMENTAL=y
CONFIG_SPI_SPIDEV=y

编译,就会看到 /dev/spidev0.0
回复 支持 反对

使用道具 举报

 楼主| 发表于 2014-1-17 13:11:18 | 显示全部楼层
wolf 发表于 2014-1-17 11:37
linux .config文件添加:
CONFIG_SPI_SUN7I=y
CONFIG_SPI=y

我能直接在driver/spi/Kconfig 里面进行修改吗?  我看了下这个Kconfig文件是这么写的
  1. config SPI_SUN7I
  2.         tristate "SUN7I SPI Controller"
  3.         depends on ARCH_SUN7I
  4.         help
  5.                 Allwinner Soc SPI controller, present on SUN7I chips.

  6. config SUN7I_SPI_NDMA
  7.     bool "SUN7I SPI Normal DMA mode select"
  8.     depends on SPI_SUN7I
  9.     help
  10.         This selects SPI DMA mode with DMA transfer
  11.         Y select NDMA mode and N select DDMA mode

  12. config SUN7I_SPI_NORFLASH
  13.     bool "SUN7I SPI Norflash"
  14.     depends on SPI_SUN7I
  15.     help
  16.         This selects norflash support.
复制代码
回复 支持 反对

使用道具 举报

发表于 2014-1-17 16:54:57 | 显示全部楼层
醉月 发表于 2014-1-17 13:11
我能直接在driver/spi/Kconfig 里面进行修改吗?  我看了下这个Kconfig文件是这么写的 ...

这个我不知道,没研究过, 我就是在linux3.4 下面的 .config改的.

如果在Kconfig里面做的话, 应该配成固定的选项吧.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2014-1-17 16:57:50 | 显示全部楼层
wolf 发表于 2014-1-17 16:54
这个我不知道,没研究过, 我就是在linux3.4 下面的 .config改的.

如果在Kconfig里面做的话, 应该配成固定 ...

好的,谢谢!
回复 支持 反对

使用道具 举报

发表于 2014-7-9 16:28:50 | 显示全部楼层
请问一下:为何我的编译会有这么多错误?

drivers/spi/spi-sun7i.c: In function ‘sun7i_spi_set_gpio’:
drivers/spi/spi-sun7i.c:1241:13: error: implicit declaration of function ‘gpio_request_ex’ [-Werror=implicit-function-declaration]
drivers/spi/spi-sun7i.c:1295:13: error: implicit declaration of function ‘gpio_release’ [-Werror=implicit-function-declaration]
drivers/spi/spi-sun7i.c: At top level:
drivers/spi/spi-sun7i.c:1748:18: error: ‘SW_INT_IRQNO_SPI00’ undeclared here (not in a function)
drivers/spi/spi-sun7i.c:1800:18: error: ‘SW_INT_IRQNO_SPI01’ undeclared here (not in a function)
drivers/spi/spi-sun7i.c:1800:9: error: initializer element is not constant
drivers/spi/spi-sun7i.c:1800:9: error: (near initialization for ‘sun7i_spi1_resources[3].start’)
drivers/spi/spi-sun7i.c:1801:9: error: initializer element is not constant
drivers/spi/spi-sun7i.c:1801:9: error: (near initialization for ‘sun7i_spi1_resources[3].end’)
drivers/spi/spi-sun7i.c:1846:18: error: ‘SW_INT_IRQNO_SPI02’ undeclared here (not in a function)
drivers/spi/spi-sun7i.c:1846:9: error: initializer element is not constant
drivers/spi/spi-sun7i.c:1846:9: error: (near initialization for ‘sun7i_spi2_resources[3].start’)
drivers/spi/spi-sun7i.c:1847:9: error: initializer element is not constant
drivers/spi/spi-sun7i.c:1847:9: error: (near initialization for ‘sun7i_spi2_resources[3].end’)
drivers/spi/spi-sun7i.c:1898:18: error: ‘SW_INT_IRQNO_SPI3’ undeclared here (not in a function)
drivers/spi/spi-sun7i.c:1898:9: error: initializer element is not constant
drivers/spi/spi-sun7i.c:1898:9: error: (near initialization for ‘sun7i_spi3_resources[3].start’)
drivers/spi/spi-sun7i.c:1899:9: error: initializer element is not constant
drivers/spi/spi-sun7i.c:1899:9: error: (near initialization for ‘sun7i_spi3_resources[3].end’)
drivers/spi/spi-sun7i.c: In function ‘sun7i_spi_register_spidev’:
drivers/spi/spi-sun7i.c:1930:5: error: implicit declaration of function ‘script_parser_fetch’ [-Werror=implicit-function-declaration]
drivers/spi/spi-sun7i.c:1931:15: error: ‘SCRIPT_PARSER_OK’ undeclared (first use in this function)
drivers/spi/spi-sun7i.c:1931:15: note: each undeclared identifier is reported only once for each function it appears in
drivers/spi/spi-sun7i.c:1931:12: warning: comparison between pointer and integer [enabled by default]
drivers/spi/spi-sun7i.c:1951:16: warning: comparison between pointer and integer [enabled by default]
drivers/spi/spi-sun7i.c:1956:16: warning: comparison between pointer and integer [enabled by default]
drivers/spi/spi-sun7i.c:1961:16: warning: comparison between pointer and integer [enabled by default]
drivers/spi/spi-sun7i.c:1966:16: warning: comparison between pointer and integer [enabled by default]
drivers/spi/spi-sun7i.c:1971:16: warning: comparison between pointer and integer [enabled by default]
drivers/spi/spi-sun7i.c:1976:10: warning: comparison between pointer and integer [enabled by default]
drivers/spi/spi-sun7i.c: In function ‘sun7i_spi_get_cfg_csbitmap’:
drivers/spi/spi-sun7i.c:2021:15: error: ‘SCRIPT_PARSER_OK’ undeclared (first use in this function)
drivers/spi/spi-sun7i.c:2021:12: warning: comparison between pointer and integer [enabled by default]
drivers/spi/spi-sun7i.c: At top level:
drivers/spi/spi-sun7i.c:2068:20: warning: ‘sun7i_spi_norflash’ defined but not used [-Wunused-function]
cc1: some warnings being treated as errors
make[2]: *** [drivers/spi/spi-sun7i.o] Error 1

回复 支持 反对

使用道具 举报

发表于 2014-7-9 18:16:23 | 显示全部楼层
Jimmyxu 发表于 2014-7-9 16:28
请问一下:为何我的编译会有这么多错误?

drivers/spi/spi-sun7i.c: In function ‘sun7i_spi_set_gpio’: ...

原来我的kernel是3.3.0的版本,arch/arm/下没有plat-sun7i这个folder,少了几个.h所以编译会找不到!!

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|粤ICP备13051116号|cubie.cc---深刻的嵌入式技术讨论社区

GMT+8, 2024-11-23 22:59 , Processed in 0.024611 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2012 Comsenz Inc. | Style by Coxxs

返回顶部