Lines Matching +full:tegra186 +full:- +full:gpio
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Synopsys DWC Ethernet Quality-of-Service v4.10a linux driver
9 #include <linux/clk-provider.h>
11 #include <linux/gpio/consumer.h>
39 struct device *dev = &pdev->dev; in dwc_eth_dwmac_config_dt()
44 if (!plat_dat->axi) { in dwc_eth_dwmac_config_dt()
45 plat_dat->axi = devm_kzalloc(&pdev->dev, in dwc_eth_dwmac_config_dt()
49 if (!plat_dat->axi) in dwc_eth_dwmac_config_dt()
50 return -ENOMEM; in dwc_eth_dwmac_config_dt()
53 plat_dat->axi->axi_lpi_en = device_property_read_bool(dev, in dwc_eth_dwmac_config_dt()
54 "snps,en-lpi"); in dwc_eth_dwmac_config_dt()
55 if (device_property_read_u32(dev, "snps,write-requests", in dwc_eth_dwmac_config_dt()
56 &plat_dat->axi->axi_wr_osr_lmt)) { in dwc_eth_dwmac_config_dt()
61 plat_dat->axi->axi_wr_osr_lmt = 1; in dwc_eth_dwmac_config_dt()
67 plat_dat->axi->axi_wr_osr_lmt--; in dwc_eth_dwmac_config_dt()
70 if (device_property_read_u32(dev, "snps,read-requests", in dwc_eth_dwmac_config_dt()
71 &plat_dat->axi->axi_rd_osr_lmt)) { in dwc_eth_dwmac_config_dt()
76 plat_dat->axi->axi_rd_osr_lmt = 1; in dwc_eth_dwmac_config_dt()
82 plat_dat->axi->axi_rd_osr_lmt--; in dwc_eth_dwmac_config_dt()
84 device_property_read_u32(dev, "snps,burst-map", &burst_map); in dwc_eth_dwmac_config_dt()
86 /* converts burst-map bitmask to burst array */ in dwc_eth_dwmac_config_dt()
91 plat_dat->axi->axi_blen[a_index] = 4; break; in dwc_eth_dwmac_config_dt()
93 plat_dat->axi->axi_blen[a_index] = 8; break; in dwc_eth_dwmac_config_dt()
95 plat_dat->axi->axi_blen[a_index] = 16; break; in dwc_eth_dwmac_config_dt()
97 plat_dat->axi->axi_blen[a_index] = 32; break; in dwc_eth_dwmac_config_dt()
99 plat_dat->axi->axi_blen[a_index] = 64; break; in dwc_eth_dwmac_config_dt()
101 plat_dat->axi->axi_blen[a_index] = 128; break; in dwc_eth_dwmac_config_dt()
103 plat_dat->axi->axi_blen[a_index] = 256; break; in dwc_eth_dwmac_config_dt()
111 /* dwc-qos needs GMAC4, AAL, TSO and PMT */ in dwc_eth_dwmac_config_dt()
112 plat_dat->has_gmac4 = 1; in dwc_eth_dwmac_config_dt()
113 plat_dat->dma_cfg->aal = 1; in dwc_eth_dwmac_config_dt()
114 plat_dat->flags |= STMMAC_FLAG_TSO_EN; in dwc_eth_dwmac_config_dt()
115 plat_dat->pmt = 1; in dwc_eth_dwmac_config_dt()
124 plat_dat->pclk = stmmac_pltfr_find_clk(plat_dat, "phy_ref_clk"); in dwc_qos_probe()
157 dev_err(eqos->dev, "invalid speed %d\n", speed); in tegra_eqos_fix_speed()
162 priv = netdev_priv(dev_get_drvdata(eqos->dev)); in tegra_eqos_fix_speed()
165 mutex_lock(&priv->mii->mdio_lock); in tegra_eqos_fix_speed()
168 value = readl(eqos->regs + SDMEMCOMPPADCTRL); in tegra_eqos_fix_speed()
170 writel(value, eqos->regs + SDMEMCOMPPADCTRL); in tegra_eqos_fix_speed()
174 value = readl(eqos->regs + AUTO_CAL_CONFIG); in tegra_eqos_fix_speed()
176 writel(value, eqos->regs + AUTO_CAL_CONFIG); in tegra_eqos_fix_speed()
178 err = readl_poll_timeout_atomic(eqos->regs + AUTO_CAL_STATUS, in tegra_eqos_fix_speed()
183 dev_err(eqos->dev, "calibration did not start\n"); in tegra_eqos_fix_speed()
187 err = readl_poll_timeout_atomic(eqos->regs + AUTO_CAL_STATUS, in tegra_eqos_fix_speed()
192 dev_err(eqos->dev, "calibration didn't finish\n"); in tegra_eqos_fix_speed()
197 value = readl(eqos->regs + SDMEMCOMPPADCTRL); in tegra_eqos_fix_speed()
199 writel(value, eqos->regs + SDMEMCOMPPADCTRL); in tegra_eqos_fix_speed()
201 mutex_unlock(&priv->mii->mdio_lock); in tegra_eqos_fix_speed()
203 value = readl(eqos->regs + AUTO_CAL_CONFIG); in tegra_eqos_fix_speed()
205 writel(value, eqos->regs + AUTO_CAL_CONFIG); in tegra_eqos_fix_speed()
213 struct device *dev = &pdev->dev; in tegra_eqos_probe()
217 eqos = devm_kzalloc(&pdev->dev, sizeof(*eqos), GFP_KERNEL); in tegra_eqos_probe()
219 return -ENOMEM; in tegra_eqos_probe()
221 eqos->dev = &pdev->dev; in tegra_eqos_probe()
222 eqos->regs = res->addr; in tegra_eqos_probe()
224 if (!is_of_node(dev->fwnode)) in tegra_eqos_probe()
227 plat_dat->clk_tx_i = stmmac_pltfr_find_clk(plat_dat, "tx"); in tegra_eqos_probe()
229 eqos->reset = devm_gpiod_get(&pdev->dev, "phy-reset", GPIOD_OUT_HIGH); in tegra_eqos_probe()
230 if (IS_ERR(eqos->reset)) { in tegra_eqos_probe()
231 err = PTR_ERR(eqos->reset); in tegra_eqos_probe()
236 gpiod_set_value(eqos->reset, 0); in tegra_eqos_probe()
239 plat_dat->mdio_bus_data->needs_reset = false; in tegra_eqos_probe()
241 eqos->rst = devm_reset_control_get(&pdev->dev, "eqos"); in tegra_eqos_probe()
242 if (IS_ERR(eqos->rst)) { in tegra_eqos_probe()
243 err = PTR_ERR(eqos->rst); in tegra_eqos_probe()
247 err = reset_control_assert(eqos->rst); in tegra_eqos_probe()
253 err = reset_control_deassert(eqos->rst); in tegra_eqos_probe()
260 plat_dat->fix_mac_speed = tegra_eqos_fix_speed; in tegra_eqos_probe()
261 plat_dat->set_clk_tx_rate = stmmac_set_clk_tx_rate; in tegra_eqos_probe()
262 plat_dat->bsp_priv = eqos; in tegra_eqos_probe()
263 plat_dat->flags |= STMMAC_FLAG_SPH_DISABLE | in tegra_eqos_probe()
269 gpiod_set_value(eqos->reset, 1); in tegra_eqos_probe()
276 struct tegra_eqos *eqos = get_stmmac_bsp_priv(&pdev->dev); in tegra_eqos_remove()
278 reset_control_assert(eqos->rst); in tegra_eqos_remove()
279 gpiod_set_value(eqos->reset, 1); in tegra_eqos_remove()
312 data = device_get_match_data(&pdev->dev); in dwc_eth_dwmac_probe()
333 ret = devm_clk_bulk_get_all_enabled(&pdev->dev, &plat_dat->clks); in dwc_eth_dwmac_probe()
335 return dev_err_probe(&pdev->dev, ret, "Failed to retrieve and enable all required clocks\n"); in dwc_eth_dwmac_probe()
336 plat_dat->num_clks = ret; in dwc_eth_dwmac_probe()
338 plat_dat->stmmac_clk = stmmac_pltfr_find_clk(plat_dat, in dwc_eth_dwmac_probe()
339 data->stmmac_clk_name); in dwc_eth_dwmac_probe()
341 if (data->probe) in dwc_eth_dwmac_probe()
342 ret = data->probe(pdev, plat_dat, &stmmac_res); in dwc_eth_dwmac_probe()
344 dev_err_probe(&pdev->dev, ret, "failed to probe subdriver\n"); in dwc_eth_dwmac_probe()
352 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); in dwc_eth_dwmac_probe()
359 if (data->remove) in dwc_eth_dwmac_probe()
360 data->remove(pdev); in dwc_eth_dwmac_probe()
367 const struct dwc_eth_dwmac_data *data = device_get_match_data(&pdev->dev); in dwc_eth_dwmac_remove()
369 stmmac_dvr_remove(&pdev->dev); in dwc_eth_dwmac_remove()
371 if (data->remove) in dwc_eth_dwmac_remove()
372 data->remove(pdev); in dwc_eth_dwmac_remove()
376 { .compatible = "snps,dwc-qos-ethernet-4.10", .data = &dwc_qos_data },
377 { .compatible = "nvidia,tegra186-eqos", .data = &tegra_eqos_data },
378 { .compatible = "tesla,fsd-ethqos", .data = &fsd_eqos_data },
387 .name = "dwc-eth-dwmac",
395 MODULE_DESCRIPTION("Synopsys DWC Ethernet Quality-of-Service v4.10a driver");