我正在浏览网络驱动程序源并在探测功能中找到它
priv->busclk = devm_clk_get(&pdev->dev, "ahb2_gmac");
if (IS_ERR(priv->busclk)) {
ret = PTR_ERR(priv->busclk);
dev_err(&pdev->dev, "Cannot get AHB clock err=%d\n", ret);
return ret;
}
ret = clk_prepare_enable(priv->busclk);
if (ret != 0) {
dev_err(&pdev->dev, "Cannot prepare_enable busclk\n");
return ret;
}
cr = clk_get_rate(priv->miiclk);
dev_info(&pdev->dev, "Current MII clkrate %lu\n", cr);
ret = clk_set_rate(priv->miiclk, cr / 4);
在第一个语句 devm_clk_get(&pdev->dev, "ahb2_gmac") 中,我们得到了 Bus(AHB2) 时钟,这里是 clk_get_rate(priv->miiclk),我们得到了 mii 接口时钟
它服务的目的是什么(获取总线和 mii 时钟),它如何帮助正确的 emac 操作?