This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ti-linux-kernel的cpsw驱动不支持fixed-link

当前SDK版本是2.00.01.07

我们使用了一个micrel的switch芯片,用spi管理,没有使用mdio

当前版本的cpsw是依赖mdio的,尝试dts中增加了fixed-link,但cpsw.c仍然提示

Missing mdio platform device

网上搜到,似乎这是一个bug,在4.4内核上已经有了补丁,不过用不到4.1的cpsw.c上

www.mail-archive.com/.../msg98147.html

github.com/.../62d2b157f4a1f354fe8d28db5b4891cdafe1a9c5

请问官方目前有没有碰到过类似的问题,在不升级内核的情况下有什么解决办法么?

谢谢

  • 暂时来看,可能需要您自行移植patch了。

    我也会内部反馈这个问题,估计要等到下一版发布了,时间会很长。

  • 直接研究下这个patch,然后对应修改4.1的代码就可以了吧,我一般都是这么干

  • 早就搞定了,忘记回复了
    这是临时修改的方法,贴上来供参考,勉强能用,调通了就没优化了
    
    
    --- /home/cet/linux_source/drivers/net/ethernet/ti/cpsw.c
    +++ /home/cet/linux_source/drivers/net/ethernet/ti/cpsw.c~
    @@ -36,10 +36,6 @@
     #include <linux/net_switch_config.h>
     
     #include <linux/pinctrl/consumer.h>
    -
    -/*cet,liudachuan */
    -#include <linux/of_mdio.h>
    -
     
     #include "cpsw.h"
     #include "cpsw_ale.h"
    @@ -2320,7 +2316,6 @@
     
     		parp = of_get_property(slave_node, "phy_id", &lenp);
     		if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) {
    -#if 0
     			dev_err(&pdev->dev, "Missing slave[%d] phy_id property\n", i);
     			goto no_phy_slave;
     		}
    @@ -2331,43 +2326,9 @@
     		if (!mdio) {
     			dev_err(&pdev->dev, "Missing mdio platform device\n");
     			return -EINVAL;
    -#endif
    -#if 1
    -			if (!of_phy_is_fixed_link(slave_node)) {
    -				dev_err(&pdev->dev,
    -					"Missing slave[%d] phy_id property\n", i);
    -				goto no_phy_slave;
    -			}
    -
    -			ret = of_phy_register_fixed_link(slave_node);
    -			if (ret) {
    -				dev_err(&pdev->dev, "cannot register fixed PHY\n");
    -				return ret;
    -			}
    -
    -			/* In the case of a fixed PHY, the DT node associated
    -			 * to the PHY is the Ethernet MAC DT node.
    -			 */
    -			//priv->phy_node = of_node_get(slave_node);
    -			static int fixed_phy_num = 0;
    -			snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
    -				 "%s:%02x", "fixed-0", fixed_phy_num++);
    -			
    -		} else {
    -			mdio_node = of_find_node_by_phandle(be32_to_cpup(parp));
    -			phyid = be32_to_cpup(parp + 1);
    -			mdio = of_find_device_by_node(mdio_node);
    -			of_node_put(mdio_node);
    -			if (!mdio) {
    -				dev_err(&pdev->dev, "Missing mdio platform device\n");
    -				return -EINVAL;
    -			}
    -			snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
    -				 PHY_ID_FMT, mdio->name, phyid);
    -#endif
    -		}
    -		//snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
    -		//	 PHY_ID_FMT, mdio->name, phyid);
    +		}
    +		snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
    +			 PHY_ID_FMT, mdio->name, phyid);
     
     		slave_data->phy_if = of_get_phy_mode(slave_node);
     		if (slave_data->phy_if < 0) {