Humming bird A20 spi2 driver Compilation

Source: Internet
Author: User

Humming bird A20 spi2 compilation and use

Yao. guet, reprinted please indicate the source: http://blog.csdn.net/Yao_GUET

There are four SPI interfaces on A20. Since humming bird A20 only introduces spi2, we will take spi2 as an example to see how the Fex file is set.

Because I got the Linux kernel is already spi-sun7i driver code file, the democratic so no code with the shoes to download the patch package.

According to the document used by SPI in Linux-sunxi, You need to modify the kernel compilation Configuration:

Config_spi_sun4i = y
Config_spi = y
Config_spi_master = y
Config_experimental = y
Config_spi_spidev = y


After completing this step, you also need to modify the Fex file. Because I use the Android system, the configuration file is located as follows:

A20_hummingbird_v3.0_v4/lichee/tools/Pack/chips/sun7i/configs/Android/wing-k70/sys_config.fex

Configuration of "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:PB16<2><default><default><default>spi_miso            = port:PB17<2><default><default><default>
Where:

Spi_used: = 1 indicates use, = 0 indicates not use;

Spi_cs_bitmap: = 1 indicates that spi2_cs0 is selected for a piece. = 2 indicates that spi2_cs1 is selected for a piece. = 3 indicates that spi2_cs0 and spi2_cs1 are selected for a piece;

I am using the spi2 interface set of PB14-PB17 here, and 2 in angle brackets represents the choice of reuse function (SPI ).


Number of spi_devices Devices
[spi_devices]spi_dev_num = 1
Spi_dev_num: indicates the total number of SPI used. Here I only use one, so write 1. This must be used with the "spi_board. For example, if the number is 1, "spi_board0" will be used later ". Num = 3, then the following three SPI configurations are required: "spi_board0", "spi_board1", and "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
Modalias: SPI device name

Max_speed_hz: maximum transmission speed

Bus_num: the bus number of the SPI corresponding to the spi_board. Here I use spi2, so "bus_num = 2"
Mode: This mainly sets the polarity and phase of the synchronization time.

SPI Mode Cpol Cpha Sampling edge
0 0 0 Rising edge
1 0 1 Descent edge
2 1 0 Descent edge
3 1 1 Rising edge
Full_duplex and manual_cs parameters, in my hand in this spi-sun7i code is not read, should not be supported ,,,

Interested in the same shoes can also look at the spi-sun7i code, just in/Linux/Drivers/SPI/spi-sun7i.c


Compile the kernel, package and generate the imgfile, and run the script to start the system. You will find the spidev2.0 device in the/dev directory. This indicates that spi2 can be used normally ,,,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.