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

问题描述 投票:1回答:1

我正在从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主机控制器:linux-4-4-8 / drivers / i2c / busses / i2c-mv64xxx.c

设备

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

0x70:PCA9548A i2c多路复用器

linux linux-kernel linux-device-driver i2c
1个回答
0
投票

较新的内核具有不同的父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重置

mpp5

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

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

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

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

这解决了设备无法在i2cdetect中显示并且硬件可以像以前那样工作的问题。

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

© www.soinside.com 2019 - 2024. All rights reserved.