Humming Bird A20 SPI2 using compilation
Yao.guet 2014-07-17, please specify the source:Http://blog.csdn.net/Yao_GUET
The A20 has 4 SPI interfaces, because humming Bird A20 only leads to SPI2, so here's an example of Spi2. See how the Fex file is set.
Because I get the Linux kernel is already has the Spi-sun7i drive code file. People democracy so without the code of the same shoe to download the patch package for yourself.
Depending on the documentation used by the SPI in Linux-sunxi, you need to change the kernel's compilation configuration:
Config_spi_sun4i=y
Config_spi=y
Config_spi_master=y
Config_experimental=y
Config_spi_spidev=y
After this step, you need to change the Fex file. Because I'm using an Android system. Therefore, the configuration file location is as follows:
A20_hummingbird_v3.0_v4/lichee/tools/pack/chips/sun7i/configs/android/wing-k70/sys_config.fex
configuration for "Spi2_para":
[Spi2_para]spi_used = 1spi_cs_bitmap = 1spi_cs0 = port:pb14<2><default><default> <DEFAULT>SPI_SCLK = Port:pb15<2><default><default><default>spi_mosi = port :P B16<2><default><default><default>spi_miso = port:pb17<2><default>< Default><default>
Of
Spi_used: =1 is used, =0 means no use;
Spi_cs_bitmap:=1 indicates that the chip selection uses the spi2_cs0,=2 to indicate that the chip selection uses the spi2_cs1,=3 to use Spi2_cs0 and SPI2_CS1;
I'm using Pb14-pb17, a set of SPI2 interfaces, where 2 of the angle brackets represent the choice of the Multiplexing function (SPI).
spi_devices Device Quantity setup
[Spi_devices]spi_dev_num = 1
Spi_dev_num: Represents the total number of SPI used, here I only use one so write 1, this need to be with the back "Spi_board" this use.
For example, my number is 1, then I will use the "spi_board0" in the back. Num=3, then there is a need for 3 SPI configuration "spi_board0". "Spi_board1". "Spi_board2", each corresponding to an SPI interface.
Spi_board Settings
[Spi_board0]modalias = "Spidev" max_speed_hz = 12000000bus_num = 2chip_select = 0mode = 0full_duplex = 0manual_cs = 0
Name of the MODALIAS:SPI device
Max_speed_hz: Maximum transfer speed
Bus_num: This is more important. The Spi_board is the corresponding SPI bus number, here I use Spi2, so "bus_num=2"
Mode: This is mainly about setting the polarity and phase of the synchronization time
SPI MODE |
Cpol |
Cpha |
Sample edges |
0 |
0 |
0 |
Rising Edge |
1 |
0 |
1 |
Falling Edge |
2 |
1 |
0 |
Falling Edge |
3 |
1 |
1 |
Rising Edge |
Full_Duplex and Manual_cs These two parameters, in my hand this part of the spi-sun7i code is not read. There should be no support,,,
Interested in the same shoes can also see their own spi-sun7i code. It's in/linux/drivers/spi/spi-sun7i.c.
Compile the kernel, then package build img file, burn write boot system, you will find spidev2.0 the device in the/dev folder, which shows that spi2 you should be able to use,,,
Copyright notice: This article blog original article. Blogs, without consent, may not be reproduced.
Humming Bird A20 SPI2 driver compilation