Linux2.6.32下SPI驱动的移植如下图所示:
下面需要修改部分内核代码,具体操作如下: 1. 修改arch/arm/mach-s3c2440/mach-mini2440.c文件
在include头文件代码行之后增加如下代码
//spi add by shiguang
#include <linux/spi/spi.h>
#include <mach/spi.h>
static struct spi_board_info s3c2410_spi0_board[] = {
[0] = {
.modalias = "spidev",
.bus_num = 0,
.chip_select = 0,
.irq = IRQ_EINT9,
.max_speed_hz = 500*1000,
},
};
static struct s3c2410_spi_info s3c2410_spi0_platdata = {
.pin_cs = S3C2410_GPG(2),
.num_cs = 1,
.bus_num = 0,
};
//end add spi
然后在函数__initmini2440_machine_init的开头增加下列代码
//spi add by shiguang
s3c_device_spi0.dev.platform_data=&s3c2410_spi0_platdata;
spi_register_board_info(s3c2410_spi0_board,ARRAY_SIZE(s3c2410_spi0_board));
//end spi
在mini2440_devices数组的最后中添加
&s3c_device_spi0,// add by shiguang