|
I2C4 添加设备 读写失败
发表于 2017-2-25 11:42:17
浏览:8113
|
回复:2
打印
只看该作者
[复制链接]
楼主
参考wiki 在I2C4 上添加了个设备,dts 配置如下,i2c_add_driver返回值也是0,;开机后,用i2cdetect -y 4,检测出0x36位置显示"UU";
但是执行读写操作时,返回-6,(No such device or address );求大神
&i2c4 {
status = "okay";
dlpc34@36 {
compatible = "dlpc34";
//gpio-sw = <&gpio7 GPIO_D3 GPIO_ACTIVE_LOW>;
reg = <0x36>;
};
};
代码:
static const struct i2c_device_id dlpc34_id[] = {
{ "dlpc34", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, dlpc34_id);
static const struct of_device_id dlpc34_of_match[] = {
{ .compatible = "dlpc34" },
{}
};
static struct i2c_driver dlpc34_driver = {
.driver = {
.name = "dlpc34",
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(dlpc34_of_match),
},
.probe = dlpc34_probe,
.remove = dlpc34_remove,
.id_table = dlpc34_id,
};
module_i2c_driver(dlpc34_driver);
|
|