Lines Matching +full:keembay +full:- +full:dwmac

1 // SPDX-License-Identifier: GPL-2.0
2 /* Intel DWMAC platform driver
33 struct intel_dwmac *dwmac = priv; in kmb_eth_fix_mac_speed() local
37 rate = clk_get_rate(dwmac->tx_clk); in kmb_eth_fix_mac_speed()
53 dev_err(dwmac->dev, "Invalid speed\n"); in kmb_eth_fix_mac_speed()
57 ret = clk_set_rate(dwmac->tx_clk, rate); in kmb_eth_fix_mac_speed()
59 dev_err(dwmac->dev, "Failed to configure tx clock rate\n"); in kmb_eth_fix_mac_speed()
70 { .compatible = "intel,keembay-dwmac", .data = &kmb_data },
79 struct intel_dwmac *dwmac; in intel_eth_plat_probe() local
89 dev_err(&pdev->dev, "dt configuration failed\n"); in intel_eth_plat_probe()
93 dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); in intel_eth_plat_probe()
94 if (!dwmac) in intel_eth_plat_probe()
95 return -ENOMEM; in intel_eth_plat_probe()
97 dwmac->dev = &pdev->dev; in intel_eth_plat_probe()
98 dwmac->tx_clk = NULL; in intel_eth_plat_probe()
100 dwmac->data = device_get_match_data(&pdev->dev); in intel_eth_plat_probe()
101 if (dwmac->data) { in intel_eth_plat_probe()
102 if (dwmac->data->fix_mac_speed) in intel_eth_plat_probe()
103 plat_dat->fix_mac_speed = dwmac->data->fix_mac_speed; in intel_eth_plat_probe()
106 if (dwmac->data->tx_clk_en) { in intel_eth_plat_probe()
107 dwmac->tx_clk = devm_clk_get(&pdev->dev, "tx_clk"); in intel_eth_plat_probe()
108 if (IS_ERR(dwmac->tx_clk)) in intel_eth_plat_probe()
109 return PTR_ERR(dwmac->tx_clk); in intel_eth_plat_probe()
111 ret = clk_prepare_enable(dwmac->tx_clk); in intel_eth_plat_probe()
113 dev_err(&pdev->dev, in intel_eth_plat_probe()
119 rate = clk_get_rate(dwmac->tx_clk); in intel_eth_plat_probe()
120 if (dwmac->data->tx_clk_rate && in intel_eth_plat_probe()
121 rate != dwmac->data->tx_clk_rate) { in intel_eth_plat_probe()
122 rate = dwmac->data->tx_clk_rate; in intel_eth_plat_probe()
123 ret = clk_set_rate(dwmac->tx_clk, rate); in intel_eth_plat_probe()
125 dev_err(&pdev->dev, in intel_eth_plat_probe()
133 rate = clk_get_rate(plat_dat->clk_ptp_ref); in intel_eth_plat_probe()
134 if (dwmac->data->ptp_ref_clk_rate && in intel_eth_plat_probe()
135 rate != dwmac->data->ptp_ref_clk_rate) { in intel_eth_plat_probe()
136 rate = dwmac->data->ptp_ref_clk_rate; in intel_eth_plat_probe()
137 ret = clk_set_rate(plat_dat->clk_ptp_ref, rate); in intel_eth_plat_probe()
139 dev_err(&pdev->dev, in intel_eth_plat_probe()
146 plat_dat->bsp_priv = dwmac; in intel_eth_plat_probe()
147 plat_dat->eee_usecs_rate = plat_dat->clk_ptp_rate; in intel_eth_plat_probe()
149 if (plat_dat->eee_usecs_rate > 0) { in intel_eth_plat_probe()
152 tx_lpi_usec = (plat_dat->eee_usecs_rate / 1000000) - 1; in intel_eth_plat_probe()
156 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); in intel_eth_plat_probe()
163 if (dwmac->data->tx_clk_en) in intel_eth_plat_probe()
164 clk_disable_unprepare(dwmac->tx_clk); in intel_eth_plat_probe()
170 struct intel_dwmac *dwmac = get_stmmac_bsp_priv(&pdev->dev); in intel_eth_plat_remove() local
173 if (dwmac->data->tx_clk_en) in intel_eth_plat_remove()
174 clk_disable_unprepare(dwmac->tx_clk); in intel_eth_plat_remove()
181 .name = "intel-eth-plat",
189 MODULE_DESCRIPTION("Intel DWMAC platform driver");