Lines Matching full:dwmac
15 * 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 *tse_pcs_base = dwmac->pcs.tse_pcs_base; in socfpga_dwmac_fix_mac_speed()
69 void __iomem *sgmii_adapter_base = dwmac->pcs.sgmii_adapter_base; in socfpga_dwmac_fix_mac_speed()
70 struct device *dev = dwmac->dev; in socfpga_dwmac_fix_mac_speed()
100 tse_pcs_fix_mac_speed(&dwmac->pcs, phy_dev, speed); 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
115 dwmac->interface = of_get_phy_mode(np); in socfpga_dwmac_parse_data()
135 dwmac->f2h_ptp_ref_clk = of_property_read_bool(np, "altr,f2h_ptp_ref_clk"); in socfpga_dwmac_parse_data()
146 dwmac->splitter_base = devm_ioremap_resource(dev, &res_splitter); in socfpga_dwmac_parse_data()
147 if (IS_ERR(dwmac->splitter_base)) { in socfpga_dwmac_parse_data()
149 return PTR_ERR(dwmac->splitter_base); in socfpga_dwmac_parse_data()
169 dwmac->splitter_base = in socfpga_dwmac_parse_data()
172 if (IS_ERR(dwmac->splitter_base)) { in socfpga_dwmac_parse_data()
173 ret = PTR_ERR(dwmac->splitter_base); in socfpga_dwmac_parse_data()
191 dwmac->pcs.sgmii_adapter_base = in socfpga_dwmac_parse_data()
194 if (IS_ERR(dwmac->pcs.sgmii_adapter_base)) { in socfpga_dwmac_parse_data()
195 ret = PTR_ERR(dwmac->pcs.sgmii_adapter_base); in socfpga_dwmac_parse_data()
213 dwmac->pcs.tse_pcs_base = in socfpga_dwmac_parse_data()
216 if (IS_ERR(dwmac->pcs.tse_pcs_base)) { in socfpga_dwmac_parse_data()
217 ret = PTR_ERR(dwmac->pcs.tse_pcs_base); in socfpga_dwmac_parse_data()
222 dwmac->reg_offset = reg_offset; in socfpga_dwmac_parse_data()
223 dwmac->reg_shift = reg_shift; in socfpga_dwmac_parse_data()
224 dwmac->sys_mgr_base_addr = sys_mgr_base_addr; in socfpga_dwmac_parse_data()
225 dwmac->dev = dev; in socfpga_dwmac_parse_data()
235 static int socfpga_dwmac_set_phy_mode(struct socfpga_dwmac *dwmac) in socfpga_dwmac_set_phy_mode() argument
237 struct regmap *sys_mgr_base_addr = dwmac->sys_mgr_base_addr; in socfpga_dwmac_set_phy_mode()
238 int phymode = dwmac->interface; in socfpga_dwmac_set_phy_mode()
239 u32 reg_offset = dwmac->reg_offset; in socfpga_dwmac_set_phy_mode()
240 u32 reg_shift = dwmac->reg_shift; in socfpga_dwmac_set_phy_mode()
254 dev_err(dwmac->dev, "bad phy mode %d\n", phymode); in socfpga_dwmac_set_phy_mode()
262 if (dwmac->splitter_base) in socfpga_dwmac_set_phy_mode()
266 reset_control_assert(dwmac->stmmac_ocp_rst); in socfpga_dwmac_set_phy_mode()
267 reset_control_assert(dwmac->stmmac_rst); in socfpga_dwmac_set_phy_mode()
273 if (dwmac->f2h_ptp_ref_clk || in socfpga_dwmac_set_phy_mode()
284 if (dwmac->f2h_ptp_ref_clk) in socfpga_dwmac_set_phy_mode()
295 reset_control_deassert(dwmac->stmmac_ocp_rst); in socfpga_dwmac_set_phy_mode()
296 reset_control_deassert(dwmac->stmmac_rst); in socfpga_dwmac_set_phy_mode()
298 if (tse_pcs_init(dwmac->pcs.tse_pcs_base, &dwmac->pcs) != 0) { in socfpga_dwmac_set_phy_mode()
299 dev_err(dwmac->dev, "Unable to initialize TSE PCS"); in socfpga_dwmac_set_phy_mode()
313 struct socfpga_dwmac *dwmac; in socfpga_dwmac_probe() local
325 dwmac = devm_kzalloc(dev, sizeof(*dwmac), GFP_KERNEL); in socfpga_dwmac_probe()
326 if (!dwmac) { in socfpga_dwmac_probe()
331 dwmac->stmmac_ocp_rst = devm_reset_control_get_optional(dev, "stmmaceth-ocp"); in socfpga_dwmac_probe()
332 if (IS_ERR(dwmac->stmmac_ocp_rst)) { in socfpga_dwmac_probe()
333 ret = PTR_ERR(dwmac->stmmac_ocp_rst); in socfpga_dwmac_probe()
338 reset_control_deassert(dwmac->stmmac_ocp_rst); in socfpga_dwmac_probe()
340 ret = socfpga_dwmac_parse_data(dwmac, dev); in socfpga_dwmac_probe()
346 plat_dat->bsp_priv = dwmac; in socfpga_dwmac_probe()
360 dwmac->stmmac_rst = stpriv->plat->stmmac_rst; in socfpga_dwmac_probe()
362 ret = socfpga_dwmac_set_phy_mode(dwmac); in socfpga_dwmac_probe()
419 .name = "socfpga-dwmac",