警告是:
Warning (reg_format): /spi-gpio/m90e32@0:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)
Warning (reg_format): /spi-gpio/m90e32@1:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)
我已经阅读了DTS的文档,我已经看到了一个类似的问题,但这并不适合我的情况。我想念什么?您需要为每个SPI设备的REG属性添加尺寸值。由于这些是SPI设备,因此通常不使用大小(或可以设置为0)。这是校正后的DTS:
spi-gpio {
compatible = "spi-gpio";
#address-cells = <0x1>;
#size-cells = <0x1>; // Ensure this is set to 1
ranges;
status = "okay";
sck-gpios = <&pio 4 9 GPIO_ACTIVE_HIGH>; // PE9
mosi-gpios = <&pio 4 6 GPIO_ACTIVE_HIGH>; // PE6
miso-gpios = <&pio 4 8 GPIO_ACTIVE_HIGH>; // PE8
cs-gpios = <&pio 4 4 GPIO_ACTIVE_HIGH>, // PE4
<&pio 4 17 GPIO_ACTIVE_HIGH>; // PE17
num-chipselects = <2>;
/* Clients */
m90e32@0 {
reg = <0 0>; // Address = 0, Size = 0
compatible = "atmel,m90e32";
spi-max-frequency = <1000>;
reset-gpios = <&pio 4 18 GPIO_ACTIVE_HIGH>; // PE17
};
m90e32@1 {
reg = <1 0>; // Address = 1, Size = 0
compatible = "atmel,m90e32";
spi-max-frequency = <1000>;
reset-gpios = <&pio 4 18 GPIO_ACTIVE_HIGH>; // PE17
};
};
解释
there属性必须匹配由reg
和#address-cells
#size-cells
属性现在具有正确的长度(8个字节:4个字节,用于地址 + 4个字节的大小),它可以解决您要获得的警告。