基于BBB DT的方法 [英] BBB DT based approach

查看:141
本文介绍了基于BBB DT的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已使用平台设备模型为自定义协议成功实现了基于GPIO的驱动程序. 我想使用设备树方法对其进行升级.因此,对于初学者来说,我有一个beaglebone黑色,并且在显示

I have successfully implemented a GPIO based driver for my custom protocol using platform device model. I want to upgrade it using device tree approach. So for starters I have a beaglebone black, and I have cross compiled the kernel using the device tree config enabled and verified during uboot console messages showing

验证校验和...确定

Verifying Checksum ... OK

位于80f80000的平盘设备树blob

Flattened Device Tree blob at 80f80000

使用fdt blob在0x80f80000引导

Booting using the fdt blob at 0x80f80000

XIP内核映像...确定

XIP Kernel Image ... OK

在80f80000处使用设备树,在80f899de结尾

Using Device Tree in place at 80f80000, end 80f899de

我将条目添加到了板公用文件节点名称my_gpio {compatible ="my_gpio"}

I added my entry into the board common file node name my_gpio {compatible = "my_gpio" }

然后我建立通常的过程,使uImages dtbs LOADADDR....

Then I build the usual process make uImages dtbs LOADADDR....

最后,我用dtb获得了uImage. 在我的驱动程序中,我使用了与.name属性相同的字符串"my_gpio".

Finally i get my uImage with dtb. In my driver i have used the same string "my_gpio" as .name property.

但是我的探测方法没有被调用,之所以称为AFAIK,是因为它找不到任何兼容的设备.

but my probe method is not getting called, which AFAIK is because it is not finding any compatible devices.

任何帮助建议都会很棒.

Any help suggestions would be great.

在我的驱动程序中:

static struct platform_driver d_driver = {
        .driver = {
                        .name = "d_gpio",
                        .of_match_table = d_of_match,
        },
        .probe = D_probe,
        .remove = D_remove
};

谢谢

推荐答案

您需要准备一个struct of_device_id类型的结构,并在该结构上使用compatible属性. 请尝试以下方式:

You need to prepare a structure of type struct of_device_id and use the compatible property on that. Try in the following manner :

static struct of_device_id my_devs[] = {
    { .compatible = "my_gpio" }, /* This should be the name given in the device tree */
    { }
};
MODULE_DEVICE_TABLE(of, my_devs);

现在构建platform_driver结构,并将上面的表传递给它:

Now build the platform_driver structure, and pass the above table into it :

static struct platform_driver my_plat_driver = {
    .probe = my_probe,
    .remove = my_remove,
    .driver = {
        .name = "my_gpio_driver",    /* This name is for sysfs, not for matching */
        .of_match_table = my_devs    /* This turns out as the matching logic */   
    }
};

这篇关于基于BBB DT的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆