forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
....@@ -189,9 +189,10 @@
189189 static int ipq806x_gmac_of_parse(struct ipq806x_gmac *gmac)
190190 {
191191 struct device *dev = &gmac->pdev->dev;
192
+ int ret;
192193
193
- gmac->phy_mode = of_get_phy_mode(dev->of_node);
194
- if ((int)gmac->phy_mode < 0) {
194
+ ret = of_get_phy_mode(dev->of_node, &gmac->phy_mode);
195
+ if (ret) {
195196 dev_err(dev, "missing phy mode property\n");
196197 return -EINVAL;
197198 }
....@@ -288,10 +289,7 @@
288289 val &= ~NSS_COMMON_GMAC_CTL_PHY_IFACE_SEL;
289290 break;
290291 default:
291
- dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n",
292
- phy_modes(gmac->phy_mode));
293
- err = -EINVAL;
294
- goto err_remove_config_dt;
292
+ goto err_unsupported_phy;
295293 }
296294 regmap_write(gmac->nss_common, NSS_COMMON_GMAC_CTL(gmac->id), val);
297295
....@@ -308,10 +306,7 @@
308306 NSS_COMMON_CLK_SRC_CTRL_OFFSET(gmac->id);
309307 break;
310308 default:
311
- dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n",
312
- phy_modes(gmac->phy_mode));
313
- err = -EINVAL;
314
- goto err_remove_config_dt;
309
+ goto err_unsupported_phy;
315310 }
316311 regmap_write(gmac->nss_common, NSS_COMMON_CLK_SRC_CTRL, val);
317312
....@@ -328,8 +323,7 @@
328323 NSS_COMMON_CLK_GATE_GMII_TX_EN(gmac->id);
329324 break;
330325 default:
331
- /* We don't get here; the switch above will have errored out */
332
- unreachable();
326
+ goto err_unsupported_phy;
333327 }
334328 regmap_write(gmac->nss_common, NSS_COMMON_CLK_GATE, val);
335329
....@@ -351,6 +345,8 @@
351345 plat_dat->bsp_priv = gmac;
352346 plat_dat->fix_mac_speed = ipq806x_gmac_fix_mac_speed;
353347 plat_dat->multicast_filter_bins = 0;
348
+ plat_dat->tx_fifo_size = 8192;
349
+ plat_dat->rx_fifo_size = 8192;
354350
355351 err = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
356352 if (err)
....@@ -358,6 +354,11 @@
358354
359355 return 0;
360356
357
+err_unsupported_phy:
358
+ dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n",
359
+ phy_modes(gmac->phy_mode));
360
+ err = -EINVAL;
361
+
361362 err_remove_config_dt:
362363 stmmac_remove_config_dt(pdev, plat_dat);
363364