标签(空格分隔): device_tree
driver使用dts的前提是driver已经是支持platform框架的driver,这样dts才可以发挥作用,因为dts和platform是配合工作的。
step1:创建dts结构体
static struct of_device_id xx_of_match[] = {
{.compatible = "xx_tech,devic_xx",},
{},
};
step3:注册该driver的dts
MODULE_DEVICE_TABLE(of, ali_of_match);
step3:将该结构体加入platform成员
static struct platform_driver nim_platform_driver = {
.probe = xx_probe,
.remove = xx_remove,
.suspend = xx_suspend,
.resume = xx_resume,
.driver = {
.owner = THIS_MODULE,
.name = "x_name", //这个name是用来和注册platform device的时候匹配用的
.of_match_table = xx_of_match,
},
};
step4:在dts文件中加入该节点
device_xx:device_xx1@0x18030000{
compatible = "xx_tech,devic_xx";
}