Lines Matching full:dwmac
4 * Adopted from dwmac-sti.c
66 struct socfpga_dwmac *dwmac = (struct socfpga_dwmac *)priv; in socfpga_dwmac_fix_mac_speed() local
67 void __iomem *splitter_base = dwmac->splitter_base; in socfpga_dwmac_fix_mac_speed()
68 void __iomem *sgmii_adapter_base = dwmac->sgmii_adapter_base; in socfpga_dwmac_fix_mac_speed()
69 struct device *dev = dwmac->dev; in socfpga_dwmac_fix_mac_speed()
103 static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *dev) in socfpga_dwmac_parse_data() argument
134 dwmac->f2h_ptp_ref_clk = of_property_read_bool(np, "altr,f2h_ptp_ref_clk"); in socfpga_dwmac_parse_data()
145 dwmac->splitter_base = devm_ioremap_resource(dev, &res_splitter); in socfpga_dwmac_parse_data()
146 if (IS_ERR(dwmac->splitter_base)) { in socfpga_dwmac_parse_data()
148 return PTR_ERR(dwmac->splitter_base); in socfpga_dwmac_parse_data()
168 dwmac->splitter_base = in socfpga_dwmac_parse_data()
171 if (IS_ERR(dwmac->splitter_base)) { in socfpga_dwmac_parse_data()
172 ret = PTR_ERR(dwmac->splitter_base); in socfpga_dwmac_parse_data()
190 dwmac->sgmii_adapter_base = in socfpga_dwmac_parse_data()
193 if (IS_ERR(dwmac->sgmii_adapter_base)) { in socfpga_dwmac_parse_data()
194 ret = PTR_ERR(dwmac->sgmii_adapter_base); in socfpga_dwmac_parse_data()
212 dwmac->tse_pcs_base = in socfpga_dwmac_parse_data()
215 if (IS_ERR(dwmac->tse_pcs_base)) { in socfpga_dwmac_parse_data()
216 ret = PTR_ERR(dwmac->tse_pcs_base); in socfpga_dwmac_parse_data()
221 dwmac->reg_offset = reg_offset; in socfpga_dwmac_parse_data()
222 dwmac->reg_shift = reg_shift; in socfpga_dwmac_parse_data()
223 dwmac->sys_mgr_base_addr = sys_mgr_base_addr; in socfpga_dwmac_parse_data()
224 dwmac->dev = dev; in socfpga_dwmac_parse_data()
234 static int socfpga_get_plat_phymode(struct socfpga_dwmac *dwmac) in socfpga_get_plat_phymode() argument
236 struct net_device *ndev = dev_get_drvdata(dwmac->dev); in socfpga_get_plat_phymode()
242 static void socfpga_sgmii_config(struct socfpga_dwmac *dwmac, bool enable) in socfpga_sgmii_config() argument
246 writew(val, dwmac->sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); in socfpga_sgmii_config()
272 static int socfpga_gen5_set_phy_mode(struct socfpga_dwmac *dwmac) in socfpga_gen5_set_phy_mode() argument
274 struct regmap *sys_mgr_base_addr = dwmac->sys_mgr_base_addr; in socfpga_gen5_set_phy_mode()
275 int phymode = socfpga_get_plat_phymode(dwmac); in socfpga_gen5_set_phy_mode()
276 u32 reg_offset = dwmac->reg_offset; in socfpga_gen5_set_phy_mode()
277 u32 reg_shift = dwmac->reg_shift; in socfpga_gen5_set_phy_mode()
281 dev_err(dwmac->dev, "bad phy mode %d\n", phymode); in socfpga_gen5_set_phy_mode()
289 if (dwmac->splitter_base) in socfpga_gen5_set_phy_mode()
293 reset_control_assert(dwmac->stmmac_ocp_rst); in socfpga_gen5_set_phy_mode()
294 reset_control_assert(dwmac->stmmac_rst); in socfpga_gen5_set_phy_mode()
300 if (dwmac->f2h_ptp_ref_clk || in socfpga_gen5_set_phy_mode()
311 if (dwmac->f2h_ptp_ref_clk) in socfpga_gen5_set_phy_mode()
322 reset_control_deassert(dwmac->stmmac_ocp_rst); in socfpga_gen5_set_phy_mode()
323 reset_control_deassert(dwmac->stmmac_rst); in socfpga_gen5_set_phy_mode()
325 socfpga_sgmii_config(dwmac, true); in socfpga_gen5_set_phy_mode()
330 static int socfpga_gen10_set_phy_mode(struct socfpga_dwmac *dwmac) in socfpga_gen10_set_phy_mode() argument
332 struct regmap *sys_mgr_base_addr = dwmac->sys_mgr_base_addr; in socfpga_gen10_set_phy_mode()
333 int phymode = socfpga_get_plat_phymode(dwmac); in socfpga_gen10_set_phy_mode()
334 u32 reg_offset = dwmac->reg_offset; in socfpga_gen10_set_phy_mode()
335 u32 reg_shift = dwmac->reg_shift; in socfpga_gen10_set_phy_mode()
345 if (dwmac->splitter_base) in socfpga_gen10_set_phy_mode()
349 reset_control_assert(dwmac->stmmac_ocp_rst); in socfpga_gen10_set_phy_mode()
350 reset_control_assert(dwmac->stmmac_rst); in socfpga_gen10_set_phy_mode()
356 if (dwmac->f2h_ptp_ref_clk || in socfpga_gen10_set_phy_mode()
375 reset_control_deassert(dwmac->stmmac_ocp_rst); in socfpga_gen10_set_phy_mode()
376 reset_control_deassert(dwmac->stmmac_rst); in socfpga_gen10_set_phy_mode()
378 socfpga_sgmii_config(dwmac, true); in socfpga_gen10_set_phy_mode()
384 struct socfpga_dwmac *dwmac = priv->plat->bsp_priv; in socfpga_dwmac_pcs_init() local
395 if (!dwmac->tse_pcs_base) in socfpga_dwmac_pcs_init()
398 pcs_regmap = devm_regmap_init_mmio(priv->device, dwmac->tse_pcs_base, in socfpga_dwmac_pcs_init()
444 struct socfpga_dwmac *dwmac; in socfpga_dwmac_probe() local
463 dwmac = devm_kzalloc(dev, sizeof(*dwmac), GFP_KERNEL); in socfpga_dwmac_probe()
464 if (!dwmac) in socfpga_dwmac_probe()
467 dwmac->stmmac_ocp_rst = devm_reset_control_get_optional(dev, "stmmaceth-ocp"); in socfpga_dwmac_probe()
468 if (IS_ERR(dwmac->stmmac_ocp_rst)) { in socfpga_dwmac_probe()
469 ret = PTR_ERR(dwmac->stmmac_ocp_rst); in socfpga_dwmac_probe()
474 reset_control_deassert(dwmac->stmmac_ocp_rst); in socfpga_dwmac_probe()
476 ret = socfpga_dwmac_parse_data(dwmac, dev); in socfpga_dwmac_probe()
482 dwmac->ops = ops; in socfpga_dwmac_probe()
483 plat_dat->bsp_priv = dwmac; in socfpga_dwmac_probe()
500 dwmac->stmmac_rst = stpriv->plat->stmmac_rst; in socfpga_dwmac_probe()
502 ret = ops->set_phy_mode(dwmac); in socfpga_dwmac_probe()
587 .name = "socfpga-dwmac",
594 MODULE_DESCRIPTION("Altera SOC DWMAC Specific Glue layer");