.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Synopsys DWC Ethernet Quality-of-Service v4.10a linux driver |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2016 Joao Pinto <jpinto@synopsys.com> |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License version 2 as |
---|
8 | | - * published by the Free Software Foundation. |
---|
9 | | - * |
---|
10 | | - * You should have received a copy of the GNU General Public License |
---|
11 | | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
12 | 6 | */ |
---|
13 | 7 | |
---|
14 | 8 | #include <linux/clk.h> |
---|
.. | .. |
---|
46 | 40 | static int dwc_eth_dwmac_config_dt(struct platform_device *pdev, |
---|
47 | 41 | struct plat_stmmacenet_data *plat_dat) |
---|
48 | 42 | { |
---|
49 | | - struct device_node *np = pdev->dev.of_node; |
---|
| 43 | + struct device *dev = &pdev->dev; |
---|
50 | 44 | u32 burst_map = 0; |
---|
51 | 45 | u32 bit_index = 0; |
---|
52 | 46 | u32 a_index = 0; |
---|
.. | .. |
---|
58 | 52 | return -ENOMEM; |
---|
59 | 53 | } |
---|
60 | 54 | |
---|
61 | | - plat_dat->axi->axi_lpi_en = of_property_read_bool(np, "snps,en-lpi"); |
---|
62 | | - if (of_property_read_u32(np, "snps,write-requests", |
---|
63 | | - &plat_dat->axi->axi_wr_osr_lmt)) { |
---|
| 55 | + plat_dat->axi->axi_lpi_en = device_property_read_bool(dev, |
---|
| 56 | + "snps,en-lpi"); |
---|
| 57 | + if (device_property_read_u32(dev, "snps,write-requests", |
---|
| 58 | + &plat_dat->axi->axi_wr_osr_lmt)) { |
---|
64 | 59 | /** |
---|
65 | 60 | * Since the register has a reset value of 1, if property |
---|
66 | 61 | * is missing, default to 1. |
---|
.. | .. |
---|
74 | 69 | plat_dat->axi->axi_wr_osr_lmt--; |
---|
75 | 70 | } |
---|
76 | 71 | |
---|
77 | | - if (of_property_read_u32(np, "snps,read-requests", |
---|
78 | | - &plat_dat->axi->axi_rd_osr_lmt)) { |
---|
| 72 | + if (device_property_read_u32(dev, "snps,read-requests", |
---|
| 73 | + &plat_dat->axi->axi_rd_osr_lmt)) { |
---|
79 | 74 | /** |
---|
80 | 75 | * Since the register has a reset value of 1, if property |
---|
81 | 76 | * is missing, default to 1. |
---|
.. | .. |
---|
88 | 83 | */ |
---|
89 | 84 | plat_dat->axi->axi_rd_osr_lmt--; |
---|
90 | 85 | } |
---|
91 | | - of_property_read_u32(np, "snps,burst-map", &burst_map); |
---|
| 86 | + device_property_read_u32(dev, "snps,burst-map", &burst_map); |
---|
92 | 87 | |
---|
93 | 88 | /* converts burst-map bitmask to burst array */ |
---|
94 | 89 | for (bit_index = 0; bit_index < 7; bit_index++) { |
---|
.. | .. |
---|
276 | 271 | struct plat_stmmacenet_data *data, |
---|
277 | 272 | struct stmmac_resources *res) |
---|
278 | 273 | { |
---|
| 274 | + struct device *dev = &pdev->dev; |
---|
279 | 275 | struct tegra_eqos *eqos; |
---|
280 | 276 | int err; |
---|
281 | 277 | |
---|
.. | .. |
---|
287 | 283 | |
---|
288 | 284 | eqos->dev = &pdev->dev; |
---|
289 | 285 | eqos->regs = res->addr; |
---|
| 286 | + |
---|
| 287 | + if (!is_of_node(dev->fwnode)) |
---|
| 288 | + goto bypass_clk_reset_gpio; |
---|
290 | 289 | |
---|
291 | 290 | eqos->clk_master = devm_clk_get(&pdev->dev, "master_bus"); |
---|
292 | 291 | if (IS_ERR(eqos->clk_master)) { |
---|
.. | .. |
---|
339 | 338 | usleep_range(2000, 4000); |
---|
340 | 339 | gpiod_set_value(eqos->reset, 0); |
---|
341 | 340 | |
---|
| 341 | + /* MDIO bus was already reset just above */ |
---|
| 342 | + data->mdio_bus_data->needs_reset = false; |
---|
| 343 | + |
---|
342 | 344 | eqos->rst = devm_reset_control_get(&pdev->dev, "eqos"); |
---|
343 | 345 | if (IS_ERR(eqos->rst)) { |
---|
344 | 346 | err = PTR_ERR(eqos->rst); |
---|
.. | .. |
---|
357 | 359 | |
---|
358 | 360 | usleep_range(2000, 4000); |
---|
359 | 361 | |
---|
| 362 | +bypass_clk_reset_gpio: |
---|
360 | 363 | data->fix_mac_speed = tegra_eqos_fix_speed; |
---|
361 | 364 | data->init = tegra_eqos_init; |
---|
362 | 365 | data->bsp_priv = eqos; |
---|
| 366 | + data->sph_disable = 1; |
---|
363 | 367 | |
---|
364 | 368 | err = tegra_eqos_init(pdev, eqos); |
---|
365 | 369 | if (err < 0) |
---|
.. | .. |
---|
421 | 425 | const struct dwc_eth_dwmac_data *data; |
---|
422 | 426 | struct plat_stmmacenet_data *plat_dat; |
---|
423 | 427 | struct stmmac_resources stmmac_res; |
---|
424 | | - struct resource *res; |
---|
425 | 428 | void *priv; |
---|
426 | 429 | int ret; |
---|
427 | 430 | |
---|
428 | | - data = of_device_get_match_data(&pdev->dev); |
---|
| 431 | + data = device_get_match_data(&pdev->dev); |
---|
429 | 432 | |
---|
430 | 433 | memset(&stmmac_res, 0, sizeof(struct stmmac_resources)); |
---|
431 | 434 | |
---|
.. | .. |
---|
434 | 437 | * resource initialization is done in the glue logic. |
---|
435 | 438 | */ |
---|
436 | 439 | stmmac_res.irq = platform_get_irq(pdev, 0); |
---|
437 | | - if (stmmac_res.irq < 0) { |
---|
438 | | - if (stmmac_res.irq != -EPROBE_DEFER) |
---|
439 | | - dev_err(&pdev->dev, |
---|
440 | | - "IRQ configuration information not found\n"); |
---|
441 | | - |
---|
| 440 | + if (stmmac_res.irq < 0) |
---|
442 | 441 | return stmmac_res.irq; |
---|
443 | | - } |
---|
444 | 442 | stmmac_res.wol_irq = stmmac_res.irq; |
---|
445 | 443 | |
---|
446 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
---|
447 | | - stmmac_res.addr = devm_ioremap_resource(&pdev->dev, res); |
---|
| 444 | + stmmac_res.addr = devm_platform_ioremap_resource(pdev, 0); |
---|
448 | 445 | if (IS_ERR(stmmac_res.addr)) |
---|
449 | 446 | return PTR_ERR(stmmac_res.addr); |
---|
450 | 447 | |
---|
.. | .. |
---|
455 | 452 | priv = data->probe(pdev, plat_dat, &stmmac_res); |
---|
456 | 453 | if (IS_ERR(priv)) { |
---|
457 | 454 | ret = PTR_ERR(priv); |
---|
458 | | - dev_err(&pdev->dev, "failed to probe subdriver: %d\n", ret); |
---|
| 455 | + |
---|
| 456 | + if (ret != -EPROBE_DEFER) |
---|
| 457 | + dev_err(&pdev->dev, "failed to probe subdriver: %d\n", |
---|
| 458 | + ret); |
---|
| 459 | + |
---|
459 | 460 | goto remove_config; |
---|
460 | 461 | } |
---|
461 | 462 | |
---|
.. | .. |
---|
484 | 485 | const struct dwc_eth_dwmac_data *data; |
---|
485 | 486 | int err; |
---|
486 | 487 | |
---|
487 | | - data = of_device_get_match_data(&pdev->dev); |
---|
| 488 | + data = device_get_match_data(&pdev->dev); |
---|
488 | 489 | |
---|
489 | 490 | err = stmmac_dvr_remove(&pdev->dev); |
---|
490 | 491 | if (err < 0) |
---|