天嵌 ARM开发社区

 找回密码
 注册
查看: 3418|回复: 1

2416 SPI驱动移植

[复制链接]
lihx 发表于 2015-2-3 14:49:09 | 显示全部楼层 |阅读模式
使用天嵌2416开发板的BSP中的kernel 3.1在做SPI移植时遇到这样的问题,求指教
1、内核配置支持SPI
2、修   linux-3.1-kernel/arch/arm/mach-s3c2416/mach-tq2416.c
添加了
69 #include <linux/spi/spi.h>
70 #include <mach/spi.h>
71
72 static struct spi_board_info s3c2410_spi0_board[] = {
73         [0] = {
74                  .modalias = "spidev",
75                 .bus_num        = 0,
76                 .chip_select        = 0,
77                 .irq = IRQ_EINT9,
78                 .max_speed_hz         = 500*1000,
79         },
80 };
81
82 static struct s3c2410_spi_info s3c2410_spi0_platdata = {
83         .pin_cs = S3C2410_GPL(13),
84         .num_cs = 1,
85         .bus_num = 0,
86 };

在*tq2416_devices[] __initdata中添加了
&s3c_device_spi0,


在 tq2416_machine_init 中添加了
794     s3c_device_spi0.dev.platform_data= &s3c2410_spi0_platdata;
795     spi_register_board_info(s3c2410_spi0_board, ARRAY_SIZE(s3c2410_spi0_board));


3、开SPI的时钟
在   linux-3.1-kernel/arch/arm/plat-s3c24xx/s3c2443-clock.c中添加
348     {
349         .name       = "spi",
350         .parent     = &clk_p,
351         .enable     = s3c2443_clkcon_enable_p,
352         .ctrlbit    = S3C2443_PCLKCON_SPI0,
353     }


然后编译内核,此时DEV下会有SPI的设备结点,
使用        linux-3.1-kernel/Documentation/spi/ spidev_test.c 测试程序会出现下图情况

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号 )

GMT+8, 2024-4-25 21:03 , Processed in 1.078125 second(s), 20 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表