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()
96 struct imx_priv_data *dwmac = priv; in imx_dwmac_init() local
99 plat_dat = dwmac->plat_dat; in imx_dwmac_init()
101 ret = clk_prepare_enable(dwmac->clk_mem); in imx_dwmac_init()
107 ret = clk_prepare_enable(dwmac->clk_tx); in imx_dwmac_init()
113 if (dwmac->ops->set_intf_mode) { in imx_dwmac_init()
114 ret = dwmac->ops->set_intf_mode(plat_dat); in imx_dwmac_init()
122 clk_disable_unprepare(dwmac->clk_tx); in imx_dwmac_init()
124 clk_disable_unprepare(dwmac->clk_mem); in imx_dwmac_init()
130 struct imx_priv_data *dwmac = priv; in imx_dwmac_exit() local
132 clk_disable_unprepare(dwmac->clk_tx); in imx_dwmac_exit()
133 clk_disable_unprepare(dwmac->clk_mem); in imx_dwmac_exit()
139 struct imx_priv_data *dwmac = priv; in imx_dwmac_fix_speed() local
143 plat_dat = dwmac->plat_dat; in imx_dwmac_fix_speed()
145 if (dwmac->ops->mac_rgmii_txclk_auto_adj || in imx_dwmac_fix_speed()
161 dev_err(dwmac->dev, "invalid speed %u\n", speed); in imx_dwmac_fix_speed()
165 err = clk_set_rate(dwmac->clk_tx, rate); in imx_dwmac_fix_speed()
167 dev_err(dwmac->dev, "failed to set tx rate %lu\n", rate); in imx_dwmac_fix_speed()
171 imx_dwmac_parse_dt(struct imx_priv_data *dwmac, struct device *dev) in imx_dwmac_parse_dt() argument
177 dwmac->rmii_refclk_ext = true; in imx_dwmac_parse_dt()
179 dwmac->clk_tx = devm_clk_get(dev, "tx"); in imx_dwmac_parse_dt()
180 if (IS_ERR(dwmac->clk_tx)) { in imx_dwmac_parse_dt()
182 return PTR_ERR(dwmac->clk_tx); in imx_dwmac_parse_dt()
185 dwmac->clk_mem = NULL; in imx_dwmac_parse_dt()
187 dwmac->clk_mem = devm_clk_get(dev, "mem"); in imx_dwmac_parse_dt()
188 if (IS_ERR(dwmac->clk_mem)) { in imx_dwmac_parse_dt()
190 return PTR_ERR(dwmac->clk_mem); in imx_dwmac_parse_dt()
199 dwmac->intf_regmap = syscon_regmap_lookup_by_phandle(np, "intf_mode"); in imx_dwmac_parse_dt()
200 if (IS_ERR(dwmac->intf_regmap)) in imx_dwmac_parse_dt()
201 return PTR_ERR(dwmac->intf_regmap); in imx_dwmac_parse_dt()
203 err = of_property_read_u32_index(np, "intf_mode", 1, &dwmac->intf_reg_off); in imx_dwmac_parse_dt()
217 struct imx_priv_data *dwmac; in imx_dwmac_probe() local
225 dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); in imx_dwmac_probe()
226 if (!dwmac) in imx_dwmac_probe()
240 dwmac->ops = data; in imx_dwmac_probe()
241 dwmac->dev = &pdev->dev; in imx_dwmac_probe()
243 ret = imx_dwmac_parse_dt(dwmac, &pdev->dev); in imx_dwmac_probe()
249 plat_dat->addr64 = dwmac->ops->addr_width; in imx_dwmac_probe()
253 plat_dat->bsp_priv = dwmac; in imx_dwmac_probe()
254 dwmac->plat_dat = plat_dat; in imx_dwmac_probe()
256 ret = imx_dwmac_init(pdev, dwmac); in imx_dwmac_probe()