Lines Matching refs:dwmac
63 struct socfpga_dwmac *dwmac = (struct socfpga_dwmac *)priv; in socfpga_dwmac_fix_mac_speed() local
64 void __iomem *splitter_base = dwmac->splitter_base; in socfpga_dwmac_fix_mac_speed()
65 void __iomem *tse_pcs_base = dwmac->pcs.tse_pcs_base; in socfpga_dwmac_fix_mac_speed()
66 void __iomem *sgmii_adapter_base = dwmac->pcs.sgmii_adapter_base; in socfpga_dwmac_fix_mac_speed()
67 struct device *dev = dwmac->dev; in socfpga_dwmac_fix_mac_speed()
97 tse_pcs_fix_mac_speed(&dwmac->pcs, phy_dev, speed); in socfpga_dwmac_fix_mac_speed()
100 static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *dev) in socfpga_dwmac_parse_data() argument
131 dwmac->f2h_ptp_ref_clk = of_property_read_bool(np, "altr,f2h_ptp_ref_clk"); in socfpga_dwmac_parse_data()
142 dwmac->splitter_base = devm_ioremap_resource(dev, &res_splitter); in socfpga_dwmac_parse_data()
143 if (IS_ERR(dwmac->splitter_base)) { in socfpga_dwmac_parse_data()
145 return PTR_ERR(dwmac->splitter_base); in socfpga_dwmac_parse_data()
165 dwmac->splitter_base = in socfpga_dwmac_parse_data()
168 if (IS_ERR(dwmac->splitter_base)) { in socfpga_dwmac_parse_data()
169 ret = PTR_ERR(dwmac->splitter_base); in socfpga_dwmac_parse_data()
187 dwmac->pcs.sgmii_adapter_base = in socfpga_dwmac_parse_data()
190 if (IS_ERR(dwmac->pcs.sgmii_adapter_base)) { in socfpga_dwmac_parse_data()
191 ret = PTR_ERR(dwmac->pcs.sgmii_adapter_base); in socfpga_dwmac_parse_data()
209 dwmac->pcs.tse_pcs_base = in socfpga_dwmac_parse_data()
212 if (IS_ERR(dwmac->pcs.tse_pcs_base)) { in socfpga_dwmac_parse_data()
213 ret = PTR_ERR(dwmac->pcs.tse_pcs_base); in socfpga_dwmac_parse_data()
218 dwmac->reg_offset = reg_offset; in socfpga_dwmac_parse_data()
219 dwmac->reg_shift = reg_shift; in socfpga_dwmac_parse_data()
220 dwmac->sys_mgr_base_addr = sys_mgr_base_addr; in socfpga_dwmac_parse_data()
221 dwmac->dev = dev; in socfpga_dwmac_parse_data()
231 static int socfpga_get_plat_phymode(struct socfpga_dwmac *dwmac) in socfpga_get_plat_phymode() argument
233 struct net_device *ndev = dev_get_drvdata(dwmac->dev); in socfpga_get_plat_phymode()
262 static int socfpga_gen5_set_phy_mode(struct socfpga_dwmac *dwmac) in socfpga_gen5_set_phy_mode() argument
264 struct regmap *sys_mgr_base_addr = dwmac->sys_mgr_base_addr; in socfpga_gen5_set_phy_mode()
265 int phymode = socfpga_get_plat_phymode(dwmac); in socfpga_gen5_set_phy_mode()
266 u32 reg_offset = dwmac->reg_offset; in socfpga_gen5_set_phy_mode()
267 u32 reg_shift = dwmac->reg_shift; in socfpga_gen5_set_phy_mode()
271 dev_err(dwmac->dev, "bad phy mode %d\n", phymode); in socfpga_gen5_set_phy_mode()
279 if (dwmac->splitter_base) in socfpga_gen5_set_phy_mode()
283 reset_control_assert(dwmac->stmmac_ocp_rst); in socfpga_gen5_set_phy_mode()
284 reset_control_assert(dwmac->stmmac_rst); in socfpga_gen5_set_phy_mode()
290 if (dwmac->f2h_ptp_ref_clk || in socfpga_gen5_set_phy_mode()
301 if (dwmac->f2h_ptp_ref_clk) in socfpga_gen5_set_phy_mode()
312 reset_control_deassert(dwmac->stmmac_ocp_rst); in socfpga_gen5_set_phy_mode()
313 reset_control_deassert(dwmac->stmmac_rst); in socfpga_gen5_set_phy_mode()
315 if (tse_pcs_init(dwmac->pcs.tse_pcs_base, &dwmac->pcs) != 0) { in socfpga_gen5_set_phy_mode()
316 dev_err(dwmac->dev, "Unable to initialize TSE PCS"); in socfpga_gen5_set_phy_mode()
324 static int socfpga_gen10_set_phy_mode(struct socfpga_dwmac *dwmac) in socfpga_gen10_set_phy_mode() argument
326 struct regmap *sys_mgr_base_addr = dwmac->sys_mgr_base_addr; in socfpga_gen10_set_phy_mode()
327 int phymode = socfpga_get_plat_phymode(dwmac); in socfpga_gen10_set_phy_mode()
328 u32 reg_offset = dwmac->reg_offset; in socfpga_gen10_set_phy_mode()
329 u32 reg_shift = dwmac->reg_shift; in socfpga_gen10_set_phy_mode()
339 if (dwmac->splitter_base) in socfpga_gen10_set_phy_mode()
343 reset_control_assert(dwmac->stmmac_ocp_rst); in socfpga_gen10_set_phy_mode()
344 reset_control_assert(dwmac->stmmac_rst); in socfpga_gen10_set_phy_mode()
350 if (dwmac->f2h_ptp_ref_clk || in socfpga_gen10_set_phy_mode()
369 reset_control_deassert(dwmac->stmmac_ocp_rst); in socfpga_gen10_set_phy_mode()
370 reset_control_deassert(dwmac->stmmac_rst); in socfpga_gen10_set_phy_mode()
372 if (tse_pcs_init(dwmac->pcs.tse_pcs_base, &dwmac->pcs) != 0) { in socfpga_gen10_set_phy_mode()
373 dev_err(dwmac->dev, "Unable to initialize TSE PCS"); in socfpga_gen10_set_phy_mode()
386 struct socfpga_dwmac *dwmac; in socfpga_dwmac_probe() local
405 dwmac = devm_kzalloc(dev, sizeof(*dwmac), GFP_KERNEL); in socfpga_dwmac_probe()
406 if (!dwmac) { in socfpga_dwmac_probe()
411 dwmac->stmmac_ocp_rst = devm_reset_control_get_optional(dev, "stmmaceth-ocp"); in socfpga_dwmac_probe()
412 if (IS_ERR(dwmac->stmmac_ocp_rst)) { in socfpga_dwmac_probe()
413 ret = PTR_ERR(dwmac->stmmac_ocp_rst); in socfpga_dwmac_probe()
418 reset_control_deassert(dwmac->stmmac_ocp_rst); in socfpga_dwmac_probe()
420 ret = socfpga_dwmac_parse_data(dwmac, dev); in socfpga_dwmac_probe()
426 dwmac->ops = ops; in socfpga_dwmac_probe()
427 plat_dat->bsp_priv = dwmac; in socfpga_dwmac_probe()
441 dwmac->stmmac_rst = stpriv->plat->stmmac_rst; in socfpga_dwmac_probe()
443 ret = ops->set_phy_mode(dwmac); in socfpga_dwmac_probe()