|
介绍:
MYS-SAM9G45开发板SPI1管脚为PB14(SPI1_MISO),PB15(SPI1_MOSI),PB16(SPI1_SPCK),PB17(SPI1_NPCS0)引出到J4扩展板上。内核没有对SPI1进行配置,所以需要对内核做一些改动。下面介绍配置SPI1步骤:
步骤:
1.内核配置push buttons时占用了SPI1管脚,首先应先去掉这部分配置。修改arch/arm/mach-at91/board-sam9m10g45ek.c文件,找到ek_buttons相关代码,修改后如下:
[mw_shl_code=c,true]#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
static struct gpio_keys_button ek_buttons[] = {
{ /* BP1, "leftclic" */
.code = BTN_LEFT,
.gpio = AT91_PIN_PB6,
.active_low = 1,
.desc = "left_click",
.wakeup = 1,
},
{ /* BP2, "rightclic" */
.code = BTN_RIGHT,
.gpio = AT91_PIN_PB7,
.active_low = 1,
.desc = "right_click",
.wakeup = 1,
},
/* BP3, "joystick" */
/*{
.code = KEY_LEFT,
.gpio = AT91_PIN_PB14,
.active_low = 1,
.desc = "Joystick Left",
},
{
.code = KEY_RIGHT,
.gpio = AT91_PIN_PB15,
.active_low = 1,
.desc = "Joystick Right",
},
{
.code = KEY_UP,
.gpio = AT91_PIN_PB16,
.active_low = 1,
.desc = "Joystick Up",
},
{
.code = KEY_DOWN,
.gpio = AT91_PIN_PB17,
.active_low = 1,
.desc = "Joystick Down",
},
{
.code = KEY_ENTER,
.gpio = AT91_PIN_PB18,
.active_low = 1,
.desc = "Joystick Press",
},*/
};[/mw_shl_code]
2.在arch/arm/mach-at91/board-sam9m10g45ek.c中找到结构体数组ek_spi_devices[],在数组中添加SPI1配置如下:
[mw_shl_code=c,true]/*
* SPI devices.
*/
static struct spi_board_info ek_spi_devices[] = {
{ /* DataFlash chip */
.modalias = "mtd_dataflash",
.chip_select = 0,
.max_speed_hz = 15 * 1000 * 1000,
.bus_num = 0,
},
{ /* spidev1.0*/
.modalias = "spidev",
.chip_select = 0,
.max_speed_hz = 15 * 1000 * 1000,
.bus_num = 1,
},
};[/mw_shl_code]
3.配置内核,导出spidev节点:
进入mys-sam9g45-linux-2.6.30目录,依次执行如下命令:
[mw_shl_code=bash,true](1)配置.config
$ make ARCH=arm MYS-SAM9G45_4.3lcd_defconfig
(2)添加spidev设备支持,选上User mode SPI device driver support
$ make ARCH=arm menuconfig
Device Drivers --->
SPI support --->
<*> User mode SPI device driver support
(3)编译内核
$ make ARCH=arm uImage CROSS_COMPILE=/usr/local/arm-2007q1/bin/arm-none-linux-gnueabi-[/mw_shl_code]
4.重新烧写系统就可以在/dev下看到SPI1的设备节点。
|
|