Lines Matching +full:dwmac +full:- +full:4
1 // SPDX-License-Identifier: GPL-2.0+
3 * StarFive DWMAC platform driver
36 struct starfive_dwmac *dwmac = priv; in starfive_dwmac_fix_mac_speed() local
42 dev_err(dwmac->dev, "invalid speed %u\n", speed); in starfive_dwmac_fix_mac_speed()
46 err = clk_set_rate(dwmac->clk_tx, rate); in starfive_dwmac_fix_mac_speed()
48 dev_err(dwmac->dev, "failed to set tx rate %lu\n", rate); in starfive_dwmac_fix_mac_speed()
53 struct starfive_dwmac *dwmac = plat_dat->bsp_priv; in starfive_dwmac_set_mode() local
59 switch (plat_dat->mac_interface) { in starfive_dwmac_set_mode()
72 dev_err(dwmac->dev, "unsupported interface %d\n", in starfive_dwmac_set_mode()
73 plat_dat->mac_interface); in starfive_dwmac_set_mode()
74 return -EINVAL; in starfive_dwmac_set_mode()
77 regmap = syscon_regmap_lookup_by_phandle_args(dwmac->dev->of_node, in starfive_dwmac_set_mode()
81 return dev_err_probe(dwmac->dev, PTR_ERR(regmap), "getting the regmap failed\n"); in starfive_dwmac_set_mode()
88 return dev_err_probe(dwmac->dev, err, "error setting phy mode\n"); in starfive_dwmac_set_mode()
90 if (dwmac->data) { in starfive_dwmac_set_mode()
92 dwmac->data->gtxclk_dlychain); in starfive_dwmac_set_mode()
94 return dev_err_probe(dwmac->dev, err, in starfive_dwmac_set_mode()
105 struct starfive_dwmac *dwmac; in starfive_dwmac_probe() local
111 return dev_err_probe(&pdev->dev, err, in starfive_dwmac_probe()
116 return dev_err_probe(&pdev->dev, PTR_ERR(plat_dat), in starfive_dwmac_probe()
119 dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); in starfive_dwmac_probe()
120 if (!dwmac) in starfive_dwmac_probe()
121 return -ENOMEM; in starfive_dwmac_probe()
123 dwmac->data = device_get_match_data(&pdev->dev); in starfive_dwmac_probe()
125 dwmac->clk_tx = devm_clk_get_enabled(&pdev->dev, "tx"); in starfive_dwmac_probe()
126 if (IS_ERR(dwmac->clk_tx)) in starfive_dwmac_probe()
127 return dev_err_probe(&pdev->dev, PTR_ERR(dwmac->clk_tx), in starfive_dwmac_probe()
130 clk_gtx = devm_clk_get_enabled(&pdev->dev, "gtx"); in starfive_dwmac_probe()
132 return dev_err_probe(&pdev->dev, PTR_ERR(clk_gtx), in starfive_dwmac_probe()
141 if (!device_property_read_bool(&pdev->dev, "starfive,tx-use-rgmii-clk")) in starfive_dwmac_probe()
142 plat_dat->fix_mac_speed = starfive_dwmac_fix_mac_speed; in starfive_dwmac_probe()
144 dwmac->dev = &pdev->dev; in starfive_dwmac_probe()
145 plat_dat->bsp_priv = dwmac; in starfive_dwmac_probe()
146 plat_dat->dma_cfg->dche = true; in starfive_dwmac_probe()
152 return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); in starfive_dwmac_probe()
156 .gtxclk_dlychain = 4,
160 { .compatible = "starfive,jh7100-dwmac", .data = &jh7100_data },
161 { .compatible = "starfive,jh7110-dwmac" },
170 .name = "starfive-dwmac",
178 MODULE_DESCRIPTION("StarFive DWMAC platform driver");