我正尝试在我的定制板上运行marvell phy linux驱动程序。驱动程序使用的是mdio接口,但我的主板上有i2c。
我将marvell.c文件中的phy_read()/phy_write()替换为i2c读/写函数。它不起作用。未调用探测函数,phy子系统使用mdio检测marvell,无法检测。
如何在phy linux sysbsystem中使用i2c?
发布于 2019-08-29 20:02:36
我决定使用mdio-i2c.c模块,并编写了自己的平台驱动程序。在我的驱动程序探测器中:
new_bus = mdio_i2c_alloc(&pdev->dev, i2c); /* create bridge */
if (!new_bus){
return -ENOMEM;
}
new_bus->name = "marvell mdio i2c bus";
new_bus->parent = &pdev->dev;
err = of_mdiobus_register(new_bus, pdev->dev.of_node);dts:
mdio_i2c{
compatible = "marvell,i2c-mdio";
i2c-bus = <&i2c_0>;
ethphy1: ethernet-phy@1f {
reg = <0x1f>;
};
};这是工作。有一点需要注意。marvell88e1111的i2c地址为0x5f。此地址对于mdio是不可接受的。我设置了地址0x1f。mdio-i2c.c模块会纠正它
static unsigned int i2c_mii_phy_addr(int phy_id)
{
return phy_id + 0x40;
}https://stackoverflow.com/questions/57458685
复制相似问题