gpt4 book ai didi

linux - U-Boot i2c 检测到我的设备 (70) 但 Linux i2c 没有。为什么?

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:31:11 26 4
gpt4 key购买 nike

我正在从 Linux 3.10 迁移到稍新的版本 Linux 4.4.8。迁移后,i2c 似乎无法再看到我的某些硬件。硬件本身没有任何变化,在以前的 linux 版本 (3.10) 中运行良好。

我现在遇到的问题是我的 i2c 命令不再有效。

尝试写入设备时,写入失败。

[]# i2cset -y 0 0x70 0 1 b
Error: Write failed

然后我决定运行 i2cdetect 以确定可以看到什么,这就是我得到的输出

在 Linux 中:

[]# i2cdetect -y -a 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: 20 21 -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- 64 -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

在 U-Boot 中:

[u-boot]# i2c probe
Valid chip addresses: 20 21 64 70

我在 U-Boot 中可以看到我的设备但在 Linux 中看不到我的设备的原因是什么?

我怀疑设备树可能需要修改?但是我检查了旧的 dtsi 文件,两个 Linux 版本中的 i2c0 没有什么不同...

i2cdump 给出所有 X 的输出

[]# i2cdump -y 0 0x70
No size specified (using byte-data access)
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
10: XX XX XX XX XX XX XX XX XX XX...

i2c host controller: linux-4-4-8/drivers/i2c/busses/i2c-mv64xxx.c

设备

0x20、0x21:PCA9555 IO 端口扩展器

0x70:PCA9548A i2c 多路复用器

最佳答案

较新的内核有一个不同的父 dtsi 文件,它为 pinctrl 定义了各种 mpp

我使用的 dts 文件包含一些已定义但我们从未使用过的以太网设备,由于我们的硬件几乎相同,因此我们从另一个团队的设备树中获取了支持。这些以太网使用了以下 mdio

mdio@72004 {
pinctrl-names = "default";
pinctrl-0 = <&mdio_pins>; //<==== This was the problem

phy0: ethernet-phy@0 {
reg = <0>;
};
};

mdio 使用 &mdio_pins 并且,在较新的内核中,被定义为

mdio_pins: mdio-pins {
marvell,pins = "mpp4", "mpp5";
marvell,function = "ge";
};

碰巧我设备的gpio resetmpp5

我将设备树的以太网部分更改为以下内容

ethernet@70000 {
status = "disabled";
};

mdio@72004 {
status = "disabled";
};

ethernet@30000 {
status = "disabled";
};

这解决了设备在 i2cdetect 中不显示的问题,并且硬件像以前一样工作。

假设我继承的设备树在所用硬件的定义中是具体的,这是我自己的错。

关于linux - U-Boot i2c 检测到我的设备 (70) 但 Linux i2c 没有。为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58436885/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com