设备树在根部创建设备
我正在编写一个用于位的NAND的UBOOT驱动程序,需要将其添加到设备树中。 因为此设备不在任何总线上,而仅引用GPIO引脚,所以我想将其直接放在设备树根上(就像它完成的 gpio-leds
)
/ {
nand {
status = "ok";
compatible = "onfi,bitbang-nand";
pinctrl-0 = <&nand_pins>;
pinctrl-names = "default";
nand-bus-width = <8>;
data-gpios = <&gpio 40 0>,
<&gpio 41 0>,
<&gpio 42 0>,
<&gpio 43 0>,
<&gpio 44 0>,
<&gpio 45 0>,
<&gpio 46 0>,
<&gpio 47 0>;
ale-gpios = <&gpio 38 0>;
cle-gpios = <&gpio 39 0>;
nre-gpios = <&gpio 36 0>;
nwe-gpios = <&gpio 35 0>;
nce-gpios = <&gpio 44 0>;
nwp-gpios = <&gpio 44 0>;
rdy-gpios = <&gpio 47 0>;
};
};
/blob/master/arch/mips/dts/huawei%2chg556a.dts“ rel = ” 无法识别设备,甚至在设备树节点绑定日志中甚至都不存在。当我将子节点添加到设备中时,Uboot将nand
作为设备识别:
/ {
nand {
compatible = "onfi,bitbang-nand";
#address-cells = <1>;
#size-cells = <1>;
pinctrl-0 = <&nand_pins>;
pinctrl-names = "default";
nand@0 {
status = "ok";
nand-bus-width = <8>;
data-gpios = <&gpio 40 0>,
<&gpio 41 0>,
<&gpio 42 0>,
<&gpio 43 0>,
<&gpio 44 0>,
<&gpio 45 0>,
<&gpio 46 0>,
<&gpio 47 0>;
ale-gpios = <&gpio 38 0>;
cle-gpios = <&gpio 39 0>;
nre-gpios = <&gpio 36 0>;
nwe-gpios = <&gpio 35 0>;
nce-gpios = <&gpio 44 0>;
nwp-gpios = <&gpio 44 0>;
rdy-gpios = <&gpio 47 0>;
};
};
};
为什么第一个示例不被视为设备而第二个示例是?我找不到规范的任何相关内容。
I'm writing a UBoot driver for bitbanged NAND and need to add it to the device tree.
Because this device is not on any bus and only references GPIO pins, I want to put it directly at the device tree root (like it's done for gpio-leds
):
/ {
nand {
status = "ok";
compatible = "onfi,bitbang-nand";
pinctrl-0 = <&nand_pins>;
pinctrl-names = "default";
nand-bus-width = <8>;
data-gpios = <&gpio 40 0>,
<&gpio 41 0>,
<&gpio 42 0>,
<&gpio 43 0>,
<&gpio 44 0>,
<&gpio 45 0>,
<&gpio 46 0>,
<&gpio 47 0>;
ale-gpios = <&gpio 38 0>;
cle-gpios = <&gpio 39 0>;
nre-gpios = <&gpio 36 0>;
nwe-gpios = <&gpio 35 0>;
nce-gpios = <&gpio 44 0>;
nwp-gpios = <&gpio 44 0>;
rdy-gpios = <&gpio 47 0>;
};
};
When the device is declared as such, UBoot does not recognize the device, and it's not even present in device tree node binding log. When I add a subnode to the device, UBoot recognizes nand
as a device:
/ {
nand {
compatible = "onfi,bitbang-nand";
#address-cells = <1>;
#size-cells = <1>;
pinctrl-0 = <&nand_pins>;
pinctrl-names = "default";
nand@0 {
status = "ok";
nand-bus-width = <8>;
data-gpios = <&gpio 40 0>,
<&gpio 41 0>,
<&gpio 42 0>,
<&gpio 43 0>,
<&gpio 44 0>,
<&gpio 45 0>,
<&gpio 46 0>,
<&gpio 47 0>;
ale-gpios = <&gpio 38 0>;
cle-gpios = <&gpio 39 0>;
nre-gpios = <&gpio 36 0>;
nwe-gpios = <&gpio 35 0>;
nce-gpios = <&gpio 44 0>;
nwp-gpios = <&gpio 44 0>;
rdy-gpios = <&gpio 47 0>;
};
};
};
Why the first example is not considered a device and the second one is? I couldn't find anything relevant in the specification.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个愚蠢的错误。根据规范,正确的
状态
值是好的
,而不是ok
。因此,dm_scan_fdt_node
indrivers/core/core/root.c
在dm_scan_fdt_node
中读取节点nand
,并丢弃为禁用。之所以找到第二版,是因为缺席状态
字段等效于启用设备。This was a silly mistake. According to the specification, the right
status
value isokay
, notok
. So, the nodenand
was read bydm_scan_fdt_node
indrivers/core/root.c
and discarded as disabled. Second version was found because absentstatus
field is equivalent to the enabled device.