dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); if (!dwmac) return -ENOMEM;
dwmac->dev = &pdev->dev;
dwmac->tx_clk = NULL;
/* * This cannot return NULL at this point because the driver’s * compatibility with the device has already been validated in * platform_match().
*/
dwmac->data = device_get_match_data(&pdev->dev);
/* Enable TX clock */ if (dwmac->data->tx_clk_en) {
dwmac->tx_clk = devm_clk_get(&pdev->dev, "tx_clk"); if (IS_ERR(dwmac->tx_clk)) return PTR_ERR(dwmac->tx_clk);
ret = clk_prepare_enable(dwmac->tx_clk); if (ret) {
dev_err(&pdev->dev, "Failed to enable tx_clk\n"); return ret;
}
/* Check and configure TX clock rate */
rate = clk_get_rate(dwmac->tx_clk); if (dwmac->data->tx_clk_rate &&
rate != dwmac->data->tx_clk_rate) {
rate = dwmac->data->tx_clk_rate;
ret = clk_set_rate(dwmac->tx_clk, rate); if (ret) {
dev_err(&pdev->dev, "Failed to set tx_clk\n"); goto err_tx_clk_disable;
}
}
/* Check and configure PTP ref clock rate */
rate = clk_get_rate(plat_dat->clk_ptp_ref); if (dwmac->data->ptp_ref_clk_rate &&
rate != dwmac->data->ptp_ref_clk_rate) {
rate = dwmac->data->ptp_ref_clk_rate;
ret = clk_set_rate(plat_dat->clk_ptp_ref, rate); if (ret) {
dev_err(&pdev->dev, "Failed to set clk_ptp_ref\n"); goto err_tx_clk_disable;
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.