sina33打开spi0dev0.0/spi1dev1.0的步骤.txt
sina33打开spi0dev0.0、spi1dev1.0的步骤.txt
(全志a33下生成设备节点/dev/spi0dev0.0、/dev/spi1dev1.0)
0、
S:\lichee\tools\pack\chips\sun8iw5p1\configs\default\env.cfg
bootdelay=0
修改为
bootdelay=3
方便按 enter 进u-boot,进行调试。
1、
rootroot@rootroot-E400:~/wyb/sina33/lichee/linux-3.4$
rootroot@rootroot-E400:~/wyb/sina33/lichee/linux-3.4$ make ARCH=arm menuconfig
(sina33的原始menuconfig)
Device Drivers --->
[*] SPI support --->
--- SPI support
[ ] Debug support for SPI drivers
*** SPI Master Controller Drivers ***
< > Altera SPI Controller
< > Utilities for Bitbanging SPI masters
< > GPIO-based bitbanging SPI Master
< > OpenCores tiny SPI
<*> SUNXI SPI Controller
< > Xilinx SPI controller common module
< > DesignWare SPI controller core support
*** SPI Protocol Masters ***
< > User mode SPI device driver support
< > Infineon TLE62X0 (for power switching)
(sina33的修改menuconfig)
Device Drivers --->
[*] SPI support --->
--- SPI support
[ ] Debug support for SPI drivers
*** SPI Master Controller Drivers ***
< > Altera SPI Controller
< > Utilities for Bitbanging SPI masters
< > GPIO-based bitbanging SPI Master
< > OpenCores tiny SPI
<*> SUNXI SPI Controller
< > Xilinx SPI controller common module
< > DesignWare SPI controller core support
*** SPI Protocol Masters ***
(需要打开这里才能够生成设备节点:/dev/spi0dev0.0、/dev/spi1dev1.0)
<*> User mode SPI device driver support
< > Infineon TLE62X0 (for power switching)
2、
S:\lichee\tools\pack\chips\sun8iw5p1\configs\y3\sys_config.fex
;----------------------------------------------------------------------------------
;SPI controller configuration
;spi_used = SPIx enable
;spi_cs_bitmap = SPI bit mapping
;----------------------------------------------------------------------------------
[spi0]
spi_used = 1
spi_cs_bitmap = 1
spi_mosi = port:PC00<3><default><default><default>
spi_miso = port:PC01<3><default><default><default>
spi_sclk = port:PC02<3><default><default><default>
spi_cs0 = port:PC03<3><1><default><default>
[spi1]
spi_used = 1
spi_cs_bitmap = 1
spi_cs0 = port:PA00<2><1><default><default>
spi_sclk = port:PA01<2><default><default><default>
spi_mosi = port:PA02<2><default><default><default>
spi_miso = port:PA03<2><default><default><default>
;----------------------------------------------------------------------------------
;SPI device configuration
;spi_dev_num: number of spi devices
;----------------------------------------------------------------------------------
[spi_devices]
(数量2表示生成2个SPI设备节点:/dev/spi0dev0.0、/dev/spi1dev1.0)
spi_dev_num = 2
;----------------------------------------------------------------------------------
;[spi_board0] spi device configuration
;modalias = spi device name
;max_speed_hz = max transfer speed
;bus_num = bus ID
;chip_select = chip select, 0,1
;mode = SPI transfer mode
;----------------------------------------------------------------------------------
[spi_board0]
;modalias = "at25df641"
modalias = "spi0dev"
max_speed_hz = 50000000
bus_num = 0
chip_select = 0
mode = 0
[spi_board1]
;modalias = "at25df641"
modalias = "spi1dev"
max_speed_hz = 50000000
(!!!!请严重注意,总线变了,这里需要修改,否则出错!进不了spi1dev_probe)
bus_num = 1
chip_select = 0
mode = 0
(引脚复用PC00、PC01、PC02、PC03,将来调试功能的时候可能会出错!!!!)
;----------------------------------------------------------------------------------
;[nandx_para]
;nand_support_2ch = support dual channel
;nand0_used = nand0使能标识
;----------------------------------------------------------------------------------
[nand0_para]
nand_support_2ch = 0
nand0_used = 0
;nand0_we = port:PC00<2><default><default><default>
;nand0_ale = port:PC01<2><default><default><default>
;nand0_cle = port:PC02<2><default><default><default>
;nand0_ce1 = port:PC03<2><default><default><default>
nand0_ce0 = port:PC04<2><default><default><default>
nand0_nre = port:PC05<2><default><default><default>
nand0_rb0 = port:PC06<2><default><default><default>
nand0_rb1 = port:PC07<2><default><default><default>
nand0_d0 = port:PC08<2><default><default><default>
nand0_d1 = port:PC09<2><default><default><default>
nand0_d2 = port:PC10<2><default><default><default>
nand0_d3 = port:PC11<2><default><default><default>
nand0_d4 = port:PC12<2><default><default><default>
nand0_d5 = port:PC13<2><default><default><default>
nand0_d6 = port:PC14<2><default><default><default>
nand0_d7 = port:PC15<2><default><default><default>
nand0_ndqs = port:PC16<2><default><default><default>
nand0_ce2 = port:PC17<2><default><default><default>
nand0_ce3 = port:PC18<2><default><default><default>
(引脚复用PA01、PA02,将来调试功能的时候可能会出错!!!!)
;----------------------------------------------------------------------------------
;virtual device
;virtual device for pinctrl testing
;device have pin PA1 PA2
;----------------------------------------------------------------------------------
[Vdevice]
Vdevice_used = 1
Vdevice_0 = port:PA01<5><1><2><default>
Vdevice_1 = port:PA02<5><1><2><default>
3、
将S:\lichee\linux-3.4\drivers\spi\spidev.c
修改替换成 spi0dev.c、spi1dev.c
编译成模块:spi0dev.ko、spi1dev.ko,插入即可在串口中看见设备节点:spi0dev0.0、spi1dev1.0。
crw------- root root 254, 0 1970-01-01 08:03 rtc0
crw-rw---- keystore keystore 10, 111 1970-01-01 08:03 scdev
drwxr-xr-x root root 1970-01-01 08:03 snd
drwxr-xr-x root root 1970-01-02 08:01 socket
crw------- root root 155, 0 1970-01-02 08:04 spi0dev0.0
crw------- root root 157, 0 1970-01-02 08:04 spi1dev1.0
crw------- root root 10, 60 1970-01-01 08:03 sunxi-reg
crw------- root root 252, 0 1970-01-01 08:03 sunxi_pwm
crw------- root root 10, 58 1970-01-01 08:03 sw_sync
sina33打开spi0dev0.0、spi1dev1.0的步骤.txt
(全志a33下生成设备节点/dev/spi0dev0.0、/dev/spi1dev1.0)
0、
S:\lichee\tools\pack\chips\sun8iw5p1\configs\default\env.cfg
bootdelay=0
修改为
bootdelay=3
方便按 enter 进u-boot,进行调试。
1、
rootroot@rootroot-E400:~/wyb/sina33/lichee/linux-3.4$
rootroot@rootroot-E400:~/wyb/sina33/lichee/linux-3.4$ make ARCH=arm menuconfig
(sina33的原始menuconfig)
Device Drivers --->
[*] SPI support --->
--- SPI support
[ ] Debug support for SPI drivers
*** SPI Master Controller Drivers ***
< > Altera SPI Controller
< > Utilities for Bitbanging SPI masters
< > GPIO-based bitbanging SPI Master
< > OpenCores tiny SPI
<*> SUNXI SPI Controller
< > Xilinx SPI controller common module
< > DesignWare SPI controller core support
*** SPI Protocol Masters ***
< > User mode SPI device driver support
< > Infineon TLE62X0 (for power switching)
(sina33的修改menuconfig)
Device Drivers --->
[*] SPI support --->
--- SPI support
[ ] Debug support for SPI drivers
*** SPI Master Controller Drivers ***
< > Altera SPI Controller
< > Utilities for Bitbanging SPI masters
< > GPIO-based bitbanging SPI Master
< > OpenCores tiny SPI
<*> SUNXI SPI Controller
< > Xilinx SPI controller common module
< > DesignWare SPI controller core support
*** SPI Protocol Masters ***
(需要打开这里才能够生成设备节点:/dev/spi0dev0.0、/dev/spi1dev1.0)
<*> User mode SPI device driver support
< > Infineon TLE62X0 (for power switching)
2、
S:\lichee\tools\pack\chips\sun8iw5p1\configs\y3\sys_config.fex
;----------------------------------------------------------------------------------
;SPI controller configuration
;spi_used = SPIx enable
;spi_cs_bitmap = SPI bit mapping
;----------------------------------------------------------------------------------
[spi0]
spi_used = 1
spi_cs_bitmap = 1
spi_mosi = port:PC00<3><default><default><default>
spi_miso = port:PC01<3><default><default><default>
spi_sclk = port:PC02<3><default><default><default>
spi_cs0 = port:PC03<3><1><default><default>
[spi1]
spi_used = 1
spi_cs_bitmap = 1
spi_cs0 = port:PA00<2><1><default><default>
spi_sclk = port:PA01<2><default><default><default>
spi_mosi = port:PA02<2><default><default><default>
spi_miso = port:PA03<2><default><default><default>
;----------------------------------------------------------------------------------
;SPI device configuration
;spi_dev_num: number of spi devices
;----------------------------------------------------------------------------------
[spi_devices]
(数量2表示生成2个SPI设备节点:/dev/spi0dev0.0、/dev/spi1dev1.0)
spi_dev_num = 2
;----------------------------------------------------------------------------------
;[spi_board0] spi device configuration
;modalias = spi device name
;max_speed_hz = max transfer speed
;bus_num = bus ID
;chip_select = chip select, 0,1
;mode = SPI transfer mode
;----------------------------------------------------------------------------------
[spi_board0]
;modalias = "at25df641"
modalias = "spi0dev"
max_speed_hz = 50000000
bus_num = 0
chip_select = 0
mode = 0
[spi_board1]
;modalias = "at25df641"
modalias = "spi1dev"
max_speed_hz = 50000000
(!!!!请严重注意,总线变了,这里需要修改,否则出错!进不了spi1dev_probe)
bus_num = 1
chip_select = 0
mode = 0
(引脚复用PC00、PC01、PC02、PC03,将来调试功能的时候可能会出错!!!!)
;----------------------------------------------------------------------------------
;[nandx_para]
;nand_support_2ch = support dual channel
;nand0_used = nand0使能标识
;----------------------------------------------------------------------------------
[nand0_para]
nand_support_2ch = 0
nand0_used = 0
;nand0_we = port:PC00<2><default><default><default>
;nand0_ale = port:PC01<2><default><default><default>
;nand0_cle = port:PC02<2><default><default><default>
;nand0_ce1 = port:PC03<2><default><default><default>
nand0_ce0 = port:PC04<2><default><default><default>
nand0_nre = port:PC05<2><default><default><default>
nand0_rb0 = port:PC06<2><default><default><default>
nand0_rb1 = port:PC07<2><default><default><default>
nand0_d0 = port:PC08<2><default><default><default>
nand0_d1 = port:PC09<2><default><default><default>
nand0_d2 = port:PC10<2><default><default><default>
nand0_d3 = port:PC11<2><default><default><default>
nand0_d4 = port:PC12<2><default><default><default>
nand0_d5 = port:PC13<2><default><default><default>
nand0_d6 = port:PC14<2><default><default><default>
nand0_d7 = port:PC15<2><default><default><default>
nand0_ndqs = port:PC16<2><default><default><default>
nand0_ce2 = port:PC17<2><default><default><default>
nand0_ce3 = port:PC18<2><default><default><default>
(引脚复用PA01、PA02,将来调试功能的时候可能会出错!!!!)
;----------------------------------------------------------------------------------
;virtual device
;virtual device for pinctrl testing
;device have pin PA1 PA2
;----------------------------------------------------------------------------------
[Vdevice]
Vdevice_used = 1
Vdevice_0 = port:PA01<5><1><2><default>
Vdevice_1 = port:PA02<5><1><2><default>
3、
将S:\lichee\linux-3.4\drivers\spi\spidev.c
修改替换成 spi0dev.c、spi1dev.c
编译成模块:spi0dev.ko、spi1dev.ko,插入即可在串口中看见设备节点:spi0dev0.0、spi1dev1.0。
crw------- root root 254, 0 1970-01-01 08:03 rtc0
crw-rw---- keystore keystore 10, 111 1970-01-01 08:03 scdev
drwxr-xr-x root root 1970-01-01 08:03 snd
drwxr-xr-x root root 1970-01-02 08:01 socket
crw------- root root 155, 0 1970-01-02 08:04 spi0dev0.0
crw------- root root 157, 0 1970-01-02 08:04 spi1dev1.0
crw------- root root 10, 60 1970-01-01 08:03 sunxi-reg
crw------- root root 252, 0 1970-01-01 08:03 sunxi_pwm
crw------- root root 10, 58 1970-01-01 08:03 sw_sync
crw-rw-rw- root root 5, 0 1970-01-01 08:03 tty
改动的文件(带目录结构)的下载链接:
http://download.csdn.net/detail/wb4916/8789897
sina33备份的文件20150609_2100.7z