打印
[i.MX]

SPI设备注册

[复制链接]
1870|8
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
qi908542785|  楼主 | 2015-11-5 15:16 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
spi, mx, ESD, ST, sd
本帖最后由 qi908542785 于 2015-11-5 15:22 编辑

imx6 开发板自带的spi设备m25p80,注册设备一直失败。注册设备的代码没有修改过,只是把注册驱动的代码加载进内核中。
注册设备主要代码如下:

static int mx6q_sabresd_spi_cs[] = {
        SABRESD_ECSPI1_CS0,
};

static const struct spi_imx_master mx6q_sabresd_spi_data __initconst = {
        .chipselect     = mx6q_sabresd_spi_cs,
        .num_chipselect = ARRAY_SIZE(mx6q_sabresd_spi_cs),
};

#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
static struct mtd_partition imx6_sabresd_spi_nor_partitions[] = {
        {
         .name = "bootloader",
         .offset = 0,
         .size = 0x00100000,
        },
        {
         .name = "kernel",
         .offset = MTDPART_OFS_APPEND,
         .size = MTDPART_SIZ_FULL,
        },
};

static struct flash_platform_data imx6_sabresd__spi_flash_data = {
        .name = "m25p80",
        .parts = imx6_sabresd_spi_nor_partitions,
        .nr_parts = ARRAY_SIZE(imx6_sabresd_spi_nor_partitions),
        .type = "sst25vf016b",
};
#endif

static struct spi_board_info imx6_sabresd_spi_nor_device[] __initdata = {
#if defined(CONFIG_MTD_M25P80)
        {
                .modalias = "m25p80",
                .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
                .bus_num = 0,
                .chip_select = 0,
                .platform_data = &imx6_sabresd__spi_flash_data,
        },
#endif
};

static void spi_device_init(void)
{
        spi_register_board_info(imx6_sabresd_spi_nor_device,
                                ARRAY_SIZE(imx6_sabresd_spi_nor_device));
}
mx6_sabresd_board_init(void)函数中:
imx6q_add_ecspi(0, &mx6q_sabresd_spi_data);
spi_device_init();


打印信息如下:
root@freescale /sys/bus/spi/drivers$ ls
ad5504  m25p80

root@freescale /sys/bus/spi/devices$ ls
没有设备,说明设备注册失败。

请问SPI注册设备还有什么需要改的吗?

相关帖子

沙发
音乐发烧友| | 2015-11-5 15:42 | 只看该作者
我是路过打酱油的,不明真相,先围观~
nanjinfp.wikidot.com,sjzkaifp.wikidot.com,fuzkfp.wikidot.com,issuu.com/027kfp,issuu.com/023kfp,issuu.com/028kfp,imgur.com/sjttTek,imgur.com/I6L9oYi,imgur.com/blDJNNl,imgur.com/E4ajGiG,imgur.com/T1RODXG,imgur.com/0DEGR9f,imgur.com/8Wf91AJ,imgur.com/IXwxKVc,imgur.com/upvyZTl,imgur.com/tmnYdhp,imgur.com/TMjglFp,imgur.com/68YAXZq,imgur.com/mtf9DPp,imgur.com/v7nK8y2,imgur.com/T7iQqcO,imgur.com/AckabRw,imgur.com/O3rem23,imgur.com/U6dzhyK,imgur.com/dBJi8TB,imgur.com/b2otDSk,imgur.com/0VViS4A,imgur.com/HZPDVue,imgur.com/2gCqSOg,imgur.com/QRbZw70,imgur.com/wx9DU6S,imgur.com/NhioMHp,imgur.com/zc6vmxT,xypf.tumblr.com,dgkfap.tumblr.com,nckaifp.tumblr.com,wzkaifp.tumblr.com,tykfap.tumblr.com,wxkf.tumblr.com,ytkfap.tumblr.com,szdkf.tumblr.com,zzkafp.tumblr.com,cskfap.tumblr.com,hfkaifp.tumblr.com,fsfap.tumblr.com,tskaifp.tumblr.com,sjkfp.tumblr.com,fuzkfp.tumblr.com,nnkaifp.tumblr.com,sykfpw.tumblr.com,kmkfap.tumblr.com,bjkfpw.tumblr.com,whkfap.tumblr.com,qdkaifp.tumblr.com,shhfp.tumblr.com,hebfp.tumblr.com,kmfap.tumblr.com,wxfap.tumblr.com,0351kfp.weebly.com,whkp.weebly.com,021kfp.weebly.com,fosfp.weebly.com,sjzkfpw.weebly.com,njfpw.weebly.com,hebfpw.weebly.com,sykfp.weebly.com,cskaifp.weebly.com,qdkfp.weebly.com,bjfpw.weebly.com,cqkaifp.weebly.com,0791dy.weebly.com,023kfpw.weebly.com,gzkp.weebly.com,0571dy.weebly.com,010kfpw.weebly.com,cckaifp.weebly.com,0371dy.weebly.com,0551fp.weebly.com,sykaifp.weebly.com,0531dy.weebly.com,029kfp.weebly.com,hfkaifp.weebly.com,029dy.weebly.com,0431fp.weebly.com,cdkaifp.weebly.com,023dy.weebly.com,0532fp.weebly.com,hebkfpw.weebly.com,025dy.weebly.com,hangzfp.weebly.com,0551dy.weebly.com,xakaifp.weebly.com,028dy.weebly.com,nbkpf.weebly.com,0755dy.weebly.com,qdkaifp.weebly.com,cq000.weebly.com,dldkfp.weebly.com,cq111.weebly.com,cqkp.weebly.com,cq222.weebly.com,bjkp.weebly.com,cq333.weebly.com,njkp.weebly.com,cq444.weebly.com,jnkfp.weebly.com,cq55.weebly.com,cdkp.weebly.com,cq666.weebly.com,hzkaifp.weebly.com,cq777.weebly.com,xakp.weebly.com,cq888.weebly.com,nbkaifp.weebly.com,cq999.weebly.com,qingdaokp.weebly.com,jinankaifp.weebly.com,shenzhenkp.weebly.com,wuxifp.weebly.com,nanjingfp.weebly.com

使用特权

评论回复
板凳
FSL_TICS_Rita| | 2015-11-5 15:55 | 只看该作者
楼主你好,请问你这里使用的是官网的开发板还是自己设计的板子呢?

使用特权

评论回复
地板
qi908542785|  楼主 | 2015-11-5 16:38 | 只看该作者
FSL_TICS_Rita 发表于 2015-11-5 15:55
楼主你好,请问你这里使用的是官网的开发板还是自己设计的板子呢?

自己的开发板,但是spi、nor flash都和官方的开发板一致,没有改动过。

使用特权

评论回复
5
ach_dmatek| | 2015-11-5 17:49 | 只看该作者
你的板子有设计SPI接口的Nor FLASH吗?

使用特权

评论回复
6
芙蓉洞| | 2015-11-5 20:15 | 只看该作者
我不太清楚您说的,只能帮顶了

使用特权

评论回复
7
mini1986| | 2015-11-6 10:46 | 只看该作者
make menuconfig的时候没有添加M25P80的驱动吧......

使用特权

评论回复
8
huahua1122| | 2015-12-4 17:08 | 只看该作者
我不太清楚您说的,只能帮顶了
sdasdasd.maoyi365.com,fsdfsd.maoyi365.com,dsfwerwer.maoyi365.com,dasdwe.maoyi365.com,sdfwe.maoyi365.com,sfsdf.maoyi365.com,daewe.maoyi365.com,dsfdf.maoyi365.com,sfdf.maoyi365.com,dffds.maoyi365.com,dfsdf.maoyi365.com,sadsad.maoyi365.com,dasdsa.maoyi365.com,adasd.maoyi365.com,dsaas.maoyi365.com,dsada.maoyi365.com,sdfsdf.maoyi365.com,rwer.maoyi365.com,dsdf.maoyi365.com,asdas.maoyi365.com,sdad.maoyi365.com,sadas.maoyi365.com,dsad.maoyi365.com,rwer1.maoyi365.com,fsdfsd1.maoyi365.com,ddsadas.maoyi365.com,sadasd.maoyi365.com,fsdfs1d.maoyi365.com,sdfdsf.maoyi365.com

使用特权

评论回复
9
quray1985| | 2015-12-5 19:33 | 只看该作者
楼主问题解决了吗,能否分享下解决方法呢

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

8

主题

14

帖子

0

粉丝