]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
net: stmmac: stmmac_platform: use correct setup function for gmac4
authorNiklas Cassel <niklas.cassel@axis.com>
Wed, 7 Dec 2016 12:41:08 +0000 (13:41 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 8 Dec 2016 16:35:37 +0000 (11:35 -0500)
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>
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c

index 6ab7e2bdcadd0d9f43c7fcc23a5477857be34a0c..699ee1d3042651e9e3d6a26c52def13a363583c6 100644 (file)
@@ -263,7 +263,7 @@ static void stmmac_ethtool_getdrvinfo(struct net_device *dev,
 {
        struct stmmac_priv *priv = netdev_priv(dev);
 
-       if (priv->plat->has_gmac)
+       if (priv->plat->has_gmac || priv->plat->has_gmac4)
                strlcpy(info->driver, GMAC_ETHTOOL_NAME, sizeof(info->driver));
        else
                strlcpy(info->driver, MAC100_ETHTOOL_NAME,
@@ -446,7 +446,7 @@ static void stmmac_ethtool_gregs(struct net_device *dev,
 
        memset(reg_space, 0x0, REG_SPACE_SIZE);
 
-       if (!priv->plat->has_gmac) {
+       if (!(priv->plat->has_gmac || priv->plat->has_gmac4)) {
                /* MAC registers */
                for (i = 0; i < 12; i++)
                        reg_space[i] = readl(priv->ioaddr + (i * 4));
index e528e7126b65c7a01e9d70aabcbffdb2fe43eb98..d3b6f92f350aa2d80e00e1dd1ee3b5af1b67f7da 100644 (file)
@@ -292,6 +292,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
        if (of_device_is_compatible(np, "snps,dwmac-4.00") ||
            of_device_is_compatible(np, "snps,dwmac-4.10a")) {
                plat->has_gmac4 = 1;
+               plat->has_gmac = 0;
                plat->pmt = 1;
                plat->tso_en = of_property_read_bool(np, "snps,tso");
        }