Skip to content

Commit 7cc99fd

Browse files
Niklas Casseldavem330
authored andcommitted
net: stmmac: stmmac_platform: use correct setup function for gmac4
devicetree binding for stmmac states: - compatible: Should be "snps,dwmac-<ip_version>", "snps,dwmac" For backwards compatibility: "st,spear600-gmac" is also supported. Previously, when specifying "snps,dwmac-4.10a", "snps,dwmac" as your compatible string, plat_stmmacenet_data would have both has_gmac and has_gmac4 set. This would lead to stmmac_hw_init calling dwmac1000_setup rather than dwmac4_setup, resulting in a non-functional driver. This happened since the check for has_gmac is done before the check for has_gmac4. However, the order should not matter, so it does not make sense to have both set. If something is valid for both, you should do as the stmmac_interrupt does: if (priv->plat->has_gmac || priv->plat->has_gmac4) ... The places where it was obvious that the author actually meant if (has_gmac || has_gmac4) rather than if (has_gmac) has been updated. Signed-off-by: Niklas Cassel <niklas.cassel@axis.com> Acked-by: Alexandre TORGUE <alexandre.torgue@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 4966a69 commit 7cc99fd

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ static void stmmac_ethtool_getdrvinfo(struct net_device *dev,
263263
{
264264
struct stmmac_priv *priv = netdev_priv(dev);
265265

266-
if (priv->plat->has_gmac)
266+
if (priv->plat->has_gmac || priv->plat->has_gmac4)
267267
strlcpy(info->driver, GMAC_ETHTOOL_NAME, sizeof(info->driver));
268268
else
269269
strlcpy(info->driver, MAC100_ETHTOOL_NAME,
@@ -446,7 +446,7 @@ static void stmmac_ethtool_gregs(struct net_device *dev,
446446

447447
memset(reg_space, 0x0, REG_SPACE_SIZE);
448448

449-
if (!priv->plat->has_gmac) {
449+
if (!(priv->plat->has_gmac || priv->plat->has_gmac4)) {
450450
/* MAC registers */
451451
for (i = 0; i < 12; i++)
452452
reg_space[i] = readl(priv->ioaddr + (i * 4));

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
292292
if (of_device_is_compatible(np, "snps,dwmac-4.00") ||
293293
of_device_is_compatible(np, "snps,dwmac-4.10a")) {
294294
plat->has_gmac4 = 1;
295+
plat->has_gmac = 0;
295296
plat->pmt = 1;
296297
plat->tso_en = of_property_read_bool(np, "snps,tso");
297298
}

0 commit comments

Comments
 (0)