phandle一种错误的用法及改正方法

来源:互联网 发布:明星网络暴力 编辑:程序博客网 时间:2024/05/22 12:51

(1)错误代码由于偷懒,直接把从别处拷贝的添加spi设备节点的代码直接拷贝放到了spi总线后面,如下:&soc {spi: spi@xxxxxxxx { compatible = "xxxx";#address-cells = <1>;#size-cells = <0>;};&spi {spidev@0 {compatible = "rohm,dh2228fv";spi-max-frequency = <0xf4240>;reg = <0x0>;};};};结果编译报错:kernel/arch/arm/boot/dts/xxx/xxx.dtsi:23.1-7 syntax error经过修改验证,如下三种方法是正确的。(2)将&spi那段代码放到soc外面,如下:&soc {spi: spi@xxxxxxxx { compatible = "xxxx";#address-cells = <1>;#size-cells = <0>;};};&spi {spidev@0 {compatible = "rohm,dh2228fv";spi-max-frequency = <0xf4240>;reg = <0x0>;};};(3)将spidev@0放到spi设备节点里面,如下&soc {spi: spi@xxxxxxxx { compatible = "xxxx";#address-cells = <1>;#size-cells = <0>;spidev@0 {compatible = "rohm,dh2228fv";spi-max-frequency = <0xf4240>;reg = <0x0>;};};}(4)指定设备节点,如下&soc {spi: spi@xxxxxxxx { compatible = "xxxx";#address-cells = <1>;#size-cells = <0>;};spi@xxxxxxxx {spidev@0 {compatible = "rohm,dh2228fv";spi-max-frequency = <0xf4240>;reg = <0x0>;};};};至于为什么不能像(1)中那样使用,原因暂时不知,留待以后再查。

阅读全文
0 0