Lines Matching refs:dwmac
55 struct imx_priv_data *dwmac = plat_dat->bsp_priv; in imx8mp_set_intf_mode() local
64 val |= (dwmac->rmii_refclk_ext ? 0 : GPR_ENET_QOS_CLK_TX_CLK_SEL); in imx8mp_set_intf_mode()
80 return regmap_update_bits(dwmac->intf_regmap, dwmac->intf_reg_off, in imx8mp_set_intf_mode()
95 struct imx_priv_data *dwmac = priv; in imx_dwmac_clks_config() local
99 ret = clk_prepare_enable(dwmac->clk_mem); in imx_dwmac_clks_config()
101 dev_err(dwmac->dev, "mem clock enable failed\n"); in imx_dwmac_clks_config()
105 ret = clk_prepare_enable(dwmac->clk_tx); in imx_dwmac_clks_config()
107 dev_err(dwmac->dev, "tx clock enable failed\n"); in imx_dwmac_clks_config()
108 clk_disable_unprepare(dwmac->clk_mem); in imx_dwmac_clks_config()
112 clk_disable_unprepare(dwmac->clk_tx); in imx_dwmac_clks_config()
113 clk_disable_unprepare(dwmac->clk_mem); in imx_dwmac_clks_config()
122 struct imx_priv_data *dwmac = priv; in imx_dwmac_init() local
125 plat_dat = dwmac->plat_dat; in imx_dwmac_init()
127 if (dwmac->ops->set_intf_mode) { in imx_dwmac_init()
128 ret = dwmac->ops->set_intf_mode(plat_dat); in imx_dwmac_init()
144 struct imx_priv_data *dwmac = priv; in imx_dwmac_fix_speed() local
148 plat_dat = dwmac->plat_dat; in imx_dwmac_fix_speed()
150 if (dwmac->ops->mac_rgmii_txclk_auto_adj || in imx_dwmac_fix_speed()
166 dev_err(dwmac->dev, "invalid speed %u\n", speed); in imx_dwmac_fix_speed()
170 err = clk_set_rate(dwmac->clk_tx, rate); in imx_dwmac_fix_speed()
172 dev_err(dwmac->dev, "failed to set tx rate %lu\n", rate); in imx_dwmac_fix_speed()
176 imx_dwmac_parse_dt(struct imx_priv_data *dwmac, struct device *dev) in imx_dwmac_parse_dt() argument
182 dwmac->rmii_refclk_ext = true; in imx_dwmac_parse_dt()
184 dwmac->clk_tx = devm_clk_get(dev, "tx"); in imx_dwmac_parse_dt()
185 if (IS_ERR(dwmac->clk_tx)) { in imx_dwmac_parse_dt()
187 return PTR_ERR(dwmac->clk_tx); in imx_dwmac_parse_dt()
190 dwmac->clk_mem = NULL; in imx_dwmac_parse_dt()
192 dwmac->clk_mem = devm_clk_get(dev, "mem"); in imx_dwmac_parse_dt()
193 if (IS_ERR(dwmac->clk_mem)) { in imx_dwmac_parse_dt()
195 return PTR_ERR(dwmac->clk_mem); in imx_dwmac_parse_dt()
204 dwmac->intf_regmap = syscon_regmap_lookup_by_phandle(np, "intf_mode"); in imx_dwmac_parse_dt()
205 if (IS_ERR(dwmac->intf_regmap)) in imx_dwmac_parse_dt()
206 return PTR_ERR(dwmac->intf_regmap); in imx_dwmac_parse_dt()
208 err = of_property_read_u32_index(np, "intf_mode", 1, &dwmac->intf_reg_off); in imx_dwmac_parse_dt()
222 struct imx_priv_data *dwmac; in imx_dwmac_probe() local
230 dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); in imx_dwmac_probe()
231 if (!dwmac) in imx_dwmac_probe()
245 dwmac->ops = data; in imx_dwmac_probe()
246 dwmac->dev = &pdev->dev; in imx_dwmac_probe()
248 ret = imx_dwmac_parse_dt(dwmac, &pdev->dev); in imx_dwmac_probe()
254 plat_dat->addr64 = dwmac->ops->addr_width; in imx_dwmac_probe()
259 plat_dat->bsp_priv = dwmac; in imx_dwmac_probe()
260 dwmac->plat_dat = plat_dat; in imx_dwmac_probe()
262 ret = imx_dwmac_clks_config(dwmac, true); in imx_dwmac_probe()
266 ret = imx_dwmac_init(pdev, dwmac); in imx_dwmac_probe()
279 imx_dwmac_clks_config(dwmac, false); in imx_dwmac_probe()