Closed CodeMzc closed 1 year ago
compatible = "snps,dwmac-mdio" 這是從 MA35D1 抄過來的吧, MA35D1 ethernet GMAC 跟 NUC980 EMAC 是不同的設計
NUC980 Linux 5.10 BSP 不需要做任何修改,應該就可以 work 你在 device tree 添加了錯誤的 driver,才導致 MDIO failed
感谢你的回复。
我根据 imx6ull 修改了device tree ,并调试了一下nuc980_ether0.c这个驱动文件,发现在nuc980_mii_setup这个函数中,if (ether->phy_dn)执行完后return 0结束掉了nuc980_mii_setup函数。 在注释掉return 0后,IP101GRI驱动就能加载了,可以在日志中看到,但是工作仍然不正常。报错 no of_node; not parsing pinctrl DT,似乎是需要在设备树里添加一些什么。
同时,我在官网找到了《NUC980 Ethernet Connection via NC-SI》这个文档,尝试使用NC-SI,根据文档操作后,依然报错。但是硬件本身没有问题,因为在Linux 4.4上一切正常
能否给一个设备树的示例,以便能在Linux 5.10上正常加载IP101GRI呢,再次感谢!
[ 0.547049] nuc980-pinctrl apb:pinctrl@b0000000: parse function(28): emac0
[ 0.547099] nuc980-pinctrl apb:pinctrl@b0000000: group(0): emac0
[ 0.547541] nuc980-pinctrl apb:pinctrl@b0000000: parse function(29): emac1
[ 0.547591] nuc980-pinctrl apb:pinctrl@b0000000: group(0): emac1
[ 3.536716] nuc980-pinctrl apb:pinctrl@b0000000: emac0: 10 0:64
[ 3.536799] nuc980-pinctrl apb:pinctrl@b0000000: maps: function emac0 group emac0 num 11
[ 3.537016] nuc980-pinctrl apb:pinctrl@b0000000: found group selector 82 for emac0
[ 3.537558] nuc980-pinctrl apb:pinctrl@b0000000: request pin 64 (PE0) for b0012000.emac0
[ 3.537608] nuc980-pinctrl apb:pinctrl@b0000000: request pin 65 (PE1) for b0012000.emac0
[ 3.537649] nuc980-pinctrl apb:pinctrl@b0000000: request pin 66 (PE2) for b0012000.emac0
[ 3.537699] nuc980-pinctrl apb:pinctrl@b0000000: request pin 67 (PE3) for b0012000.emac0
[ 3.537741] nuc980-pinctrl apb:pinctrl@b0000000: request pin 68 (PE4) for b0012000.emac0
[ 3.537783] nuc980-pinctrl apb:pinctrl@b0000000: request pin 69 (PE5) for b0012000.emac0
[ 3.537824] nuc980-pinctrl apb:pinctrl@b0000000: request pin 70 (PE6) for b0012000.emac0
[ 3.537866] nuc980-pinctrl apb:pinctrl@b0000000: request pin 71 (PE7) for b0012000.emac0
[ 3.537908] nuc980-pinctrl apb:pinctrl@b0000000: request pin 72 (PE8) for b0012000.emac0
[ 3.537949] nuc980-pinctrl apb:pinctrl@b0000000: request pin 73 (PE9) for b0012000.emac0
[ 3.538208] nuc980-emac0 b0012000.emac0: obtain a copy of previously claimed pinctrl
[ 3.567841] nuc980_mii_setup: ether->pdev->name = b0012000.emac0,ether->pdev->id = ffffffff
[ 3.576674] nuc980-emac0 b0012000.emac0: mdiobus_register
[ 3.587133] ICPlus IP101A/G b0012000.emac0-ffffffff:00: no of_node; not parsing pinctrl DT
[ 3.587316] ICPlus IP101A/G b0012000.emac0-ffffffff:00: ip101a_g_probe enter!
[ 3.597183] ICPlus IP101A/G b0012000.emac0-ffffffff:00: ip101a_g_probe exit!
[ 3.609616] nuc980-emac0 b0012000.emac0: phy_find_first
[ 3.616458] nuc980-emac0 b0012000.emac0: phy_connect
[ 3.621883] ICPlus IP101A/G b0012000.emac0 , ip101a_g_config_init enter!
[ 3.628841] ICPlus IP101A/G b0012000.emac0 , ip101a_g_config_init exit!
[ 3.636141] nuc980-emac0 b0012000.emac0: linkmode_copy
[ 12.418066] nuc980-emac0 b0012000.emac0: eth0 is OPENED
# dmesg | grep emac
[ 0.547141] nuc980-pinctrl apb:pinctrl@b0000000: parse function(28): emac0
[ 0.547191] nuc980-pinctrl apb:pinctrl@b0000000: group(0): emac0
[ 0.547641] nuc980-pinctrl apb:pinctrl@b0000000: parse function(29): emac1
[ 0.547691] nuc980-pinctrl apb:pinctrl@b0000000: group(0): emac1
[ 3.526808] nuc980-pinctrl apb:pinctrl@b0000000: emac0: 10 0:64
[ 3.526891] nuc980-pinctrl apb:pinctrl@b0000000: maps: function emac0 group emac0 num 11
[ 3.527116] nuc980-pinctrl apb:pinctrl@b0000000: found group selector 82 for emac0
[ 3.527649] nuc980-pinctrl apb:pinctrl@b0000000: request pin 64 (PE0) for b0012000.emac0
[ 3.527699] nuc980-pinctrl apb:pinctrl@b0000000: request pin 65 (PE1) for b0012000.emac0
[ 3.527749] nuc980-pinctrl apb:pinctrl@b0000000: request pin 66 (PE2) for b0012000.emac0
[ 3.527791] nuc980-pinctrl apb:pinctrl@b0000000: request pin 67 (PE3) for b0012000.emac0
[ 3.527833] nuc980-pinctrl apb:pinctrl@b0000000: request pin 68 (PE4) for b0012000.emac0
[ 3.527883] nuc980-pinctrl apb:pinctrl@b0000000: request pin 69 (PE5) for b0012000.emac0
[ 3.527924] nuc980-pinctrl apb:pinctrl@b0000000: request pin 70 (PE6) for b0012000.emac0
[ 3.527966] nuc980-pinctrl apb:pinctrl@b0000000: request pin 71 (PE7) for b0012000.emac0
[ 3.528008] nuc980-pinctrl apb:pinctrl@b0000000: request pin 72 (PE8) for b0012000.emac0
[ 3.528049] nuc980-pinctrl apb:pinctrl@b0000000: request pin 73 (PE9) for b0012000.emac0
[ 3.528316] nuc980-emac0 b0012000.emac0: obtain a copy of previously claimed pinctrl
[ 3.528599] nuc980-emac0 b0012000.emac0: Using NCSI interface
[ 12.314291] nuc980-emac0 b0012000.emac0: eth0 uses NC-SI subsystem.
[ 12.320591] nuc980-emac0 b0012000.emac0: eth0 is OPENED
[ 28.971699] nuc980-emac0 b0012000.emac0 eth0: NCSI: No channel found to configure!
[ 28.979274] nuc980-emac0 b0012000.emac0 eth0: NCSI interface down
[ 30.011583] nuc980-emac0 b0012000.emac0 eth0: Wrong NCSI state 0x100 in workqueue
static int nuc980_mii_setup(struct net_device *netdev)
{
struct nuc980_ether *ether = netdev_priv(netdev);
struct platform_device *pdev;
struct phy_device *phydev;
int i, err = 0;
pdev = ether->pdev;
if (ether->phy_dn) {
ether->phy_dev = of_phy_connect(netdev, ether->phy_dn,
&adjust_link, 0, 0);
if (!ether->phy_dn) {
dev_err(&netdev->dev, "could not connect to phy %pOF\n",
ether->phy_dn);
return -ENODEV;
}
//注释掉这个return 0后,IP101GRI驱动加载的日志就出现了
//return 0;
}
ether->mii_bus = mdiobus_alloc();
if (!ether->mii_bus) {
err = -ENOMEM;
dev_err(&pdev->dev, "mdiobus_alloc() failed\n");
goto out0;
}
ether->mii_bus->name = "nuc980_rmii0";
ether->mii_bus->read = &nuc980_mdio_read;
ether->mii_bus->write = &nuc980_mdio_write;
ether->mii_bus->reset = &nuc980_mdio_reset;
snprintf(ether->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
ether->pdev->name, ether->pdev->id);
ether->mii_bus->priv = ether;
ether->mii_bus->parent = ðer->pdev->dev;
if (!ether->mii_bus->irq) {
err = -ENOMEM;
dev_err(&pdev->dev, "kmalloc() failed\n");
goto out1;
}
//...
}
emac0@b0012000 {
status = "okay";
phy-mode = "rmii";
phy-handle = <ðphy0>;
mdio {
#address-cells = <1>;
#size-cells = <0>;
ethphy0: ethernet-phy@0 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <0>;
};
};
};
NC-SI 是另一種應用,需要搭配硬體
請問你用哪張板子做的測試? chili or iot? 請找一下板子上面打印的板子名稱 請使用 buildroot 編譯 https://github.com/OpenNuvoton/MA35D1_Buildroot
選擇對應的 defconfig 之後 make 產生的 image 就可以 work 了
不需要做任何多餘的修改
是公司自己制作的板子。
好的,我试一下使用MA35D1_Buildroot看看能不能正常驱动IP101GRI。
建議這麼做 ==> download 好 buildroot 之後
然後在 output/images 目錄下找到 Image 及 nuc980-iot-v1.0.dtb download 到開發板執行
如果還有問題, 最好先在 Nuvoton 開發板上面嘗試一下
额,问题解决了,不是源码驱动的问题,而是phy的复位引脚是PE12,和设备树里 usbh_ehci 的pinctrl设置冲突,导致PE12一直是低电平,phy一直在复位。 把 usbh_ehci 节点 disabled 后网卡正常了,确实对emac0和驱动不需要做任何修改。
感谢你的支持!
你好,我正在调试以太网驱动,公司使用的是IP101GRI这个phy芯片,5.10内核下有这个驱动,也已经打开并加载了,并没有报错但是网卡没有正确加载,手动添加ip后,eth0是有了,但是读不到phy的id,也ping不通网关。 但是在linux 4.4是正常的,需要解决Y2038问题所以得升级5.10版本。
因为我刚入门Linux所以技术不是很强,也调了很久了,在谷歌上实在是找不到解决方法。 麻烦各位大佬解答一下我的问题,感谢!
日志信息:
内核config已经打开了驱动:
设备树: