首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >i2c代替mdio,marvell phy驱动程序

问i2c代替mdio,marvell phy驱动程序
EN

Stack Overflow用户
提问于 2019-08-12 17:30:04
回答 1查看 1.4K关注 0票数 1

我正尝试在我的定制板上运行marvell phy linux驱动程序。驱动程序使用的是mdio接口,但我的主板上有i2c。

我将marvell.c文件中的phy_read()/phy_write()替换为i2c读/写函数。它不起作用。未调用探测函数,phy子系统使用mdio检测marvell,无法检测。

如何在phy linux sysbsystem中使用i2c?

EN

回答 1

Stack Overflow用户

发布于 2019-08-29 20:02:36

我决定使用mdio-i2c.c模块,并编写了自己的平台驱动程序。在我的驱动程序探测器中:

代码语言:javascript
复制
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:

代码语言:javascript
复制
    mdio_i2c{
        compatible = "marvell,i2c-mdio";
        i2c-bus = <&i2c_0>;
        ethphy1: ethernet-phy@1f {
            reg = <0x1f>;
        };
    };

这是工作。有一点需要注意。marvell88e1111的i2c地址为0x5f。此地址对于mdio是不可接受的。我设置了地址0x1f。mdio-i2c.c模块会纠正它

代码语言:javascript
复制
static unsigned int i2c_mii_phy_addr(int phy_id)
{
    return phy_id + 0x40;
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57458685

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档