Lines Matching full:dwmac

3  * dwmac-sti.c - STMicroelectronics DWMAC Specific Glue layer
140 struct sti_dwmac *dwmac = priv; in stih4xx_fix_retime_src() local
141 u32 src = dwmac->tx_retime_src; in stih4xx_fix_retime_src()
142 u32 reg = dwmac->ctrl_reg; in stih4xx_fix_retime_src()
145 if (dwmac->interface == PHY_INTERFACE_MODE_MII) { in stih4xx_fix_retime_src()
147 } else if (dwmac->interface == PHY_INTERFACE_MODE_RMII) { in stih4xx_fix_retime_src()
148 if (dwmac->ext_phyclk) { in stih4xx_fix_retime_src()
154 } else if (IS_PHY_IF_MODE_RGMII(dwmac->interface)) { in stih4xx_fix_retime_src()
169 clk_set_rate(dwmac->clk, freq); in stih4xx_fix_retime_src()
171 regmap_update_bits(dwmac->regmap, reg, STIH4XX_RETIME_SRC_MASK, in stih4xx_fix_retime_src()
175 static int sti_dwmac_set_mode(struct sti_dwmac *dwmac) in sti_dwmac_set_mode() argument
177 struct regmap *regmap = dwmac->regmap; in sti_dwmac_set_mode()
178 int iface = dwmac->interface; in sti_dwmac_set_mode()
179 u32 reg = dwmac->ctrl_reg; in sti_dwmac_set_mode()
182 if (dwmac->gmac_en) in sti_dwmac_set_mode()
190 dwmac->fix_retime_src(dwmac, dwmac->speed, 0); in sti_dwmac_set_mode()
195 static int sti_dwmac_parse_data(struct sti_dwmac *dwmac, in sti_dwmac_parse_data() argument
205 dwmac->clk_sel_reg = -ENXIO; in sti_dwmac_parse_data()
208 dwmac->clk_sel_reg = res->start; in sti_dwmac_parse_data()
214 err = of_property_read_u32_index(np, "st,syscon", 1, &dwmac->ctrl_reg); in sti_dwmac_parse_data()
220 err = of_get_phy_mode(np, &dwmac->interface); in sti_dwmac_parse_data()
226 dwmac->regmap = regmap; in sti_dwmac_parse_data()
227 dwmac->gmac_en = of_property_read_bool(np, "st,gmac_en"); in sti_dwmac_parse_data()
228 dwmac->ext_phyclk = of_property_read_bool(np, "st,ext-phyclk"); in sti_dwmac_parse_data()
229 dwmac->tx_retime_src = TX_RETIME_SRC_NA; in sti_dwmac_parse_data()
230 dwmac->speed = SPEED_100; in sti_dwmac_parse_data()
232 if (IS_PHY_IF_MODE_GBIT(dwmac->interface)) { in sti_dwmac_parse_data()
235 dwmac->tx_retime_src = TX_RETIME_SRC_CLKGEN; in sti_dwmac_parse_data()
242 dwmac->tx_retime_src = TX_RETIME_SRC_CLK_125; in sti_dwmac_parse_data()
244 dwmac->tx_retime_src = TX_RETIME_SRC_TXCLK; in sti_dwmac_parse_data()
246 dwmac->speed = SPEED_1000; in sti_dwmac_parse_data()
249 dwmac->clk = devm_clk_get(dev, "sti-ethclk"); in sti_dwmac_parse_data()
250 if (IS_ERR(dwmac->clk)) { in sti_dwmac_parse_data()
252 dwmac->clk = NULL; in sti_dwmac_parse_data()
263 struct sti_dwmac *dwmac; in sti_dwmac_probe() local
280 dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); in sti_dwmac_probe()
281 if (!dwmac) in sti_dwmac_probe()
284 ret = sti_dwmac_parse_data(dwmac, pdev); in sti_dwmac_probe()
290 dwmac->fix_retime_src = data->fix_retime_src; in sti_dwmac_probe()
292 plat_dat->bsp_priv = dwmac; in sti_dwmac_probe()
295 ret = clk_prepare_enable(dwmac->clk); in sti_dwmac_probe()
299 ret = sti_dwmac_set_mode(dwmac); in sti_dwmac_probe()
310 clk_disable_unprepare(dwmac->clk); in sti_dwmac_probe()
317 struct sti_dwmac *dwmac = get_stmmac_bsp_priv(&pdev->dev); in sti_dwmac_remove() local
321 clk_disable_unprepare(dwmac->clk); in sti_dwmac_remove()
327 struct sti_dwmac *dwmac = get_stmmac_bsp_priv(dev); in sti_dwmac_suspend() local
330 clk_disable_unprepare(dwmac->clk); in sti_dwmac_suspend()
337 struct sti_dwmac *dwmac = get_stmmac_bsp_priv(dev); in sti_dwmac_resume() local
339 clk_prepare_enable(dwmac->clk); in sti_dwmac_resume()
340 sti_dwmac_set_mode(dwmac); in sti_dwmac_resume()
354 { .compatible = "st,stih407-dwmac", .data = &stih4xx_dwmac_data},
363 .name = "sti-dwmac",
371 MODULE_DESCRIPTION("STMicroelectronics DWMAC Specific Glue layer");