Skip to content

Commit

Permalink
net: stmmac: Run HWIF Quirks after getting HW caps
Browse files Browse the repository at this point in the history
Currently we were running HWIF quirks before getting HW capabilities.
This is not right because some HWIF callbacks depend on HW caps.

Lets save the quirks callback and use it in a later stage.

This fixes Altera socfpga.

Signed-off-by: Jose Abreu <[email protected]>
Fixes: 5f0456b ("net: stmmac: Implement logic to automatically select HW Interface")
Reported-by: Dinh Nguyen <[email protected]>
Cc: David S. Miller <[email protected]>
Cc: Joao Pinto <[email protected]>
Cc: Vitor Soares <[email protected]>
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Dinh Nguyen <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
joabreu authored and davem330 committed Jun 15, 2018
1 parent f6a6f20 commit 7cfde0a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
9 changes: 2 additions & 7 deletions drivers/net/ethernet/stmicro/stmmac/hwif.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,8 @@ int stmmac_hwif_init(struct stmmac_priv *priv)
return ret;
}

/* Run quirks, if needed */
if (entry->quirks) {
ret = entry->quirks(priv);
if (ret)
return ret;
}

/* Save quirks, if needed for posterior use */
priv->hwif_quirks = entry->quirks;
return 0;
}

Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/stmicro/stmmac/stmmac.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ struct stmmac_priv {
struct net_device *dev;
struct device *device;
struct mac_device_info *hw;
int (*hwif_quirks)(struct stmmac_priv *priv);
struct mutex lock;

/* RX Queue */
Expand Down
7 changes: 7 additions & 0 deletions drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4135,6 +4135,13 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
if (priv->dma_cap.tsoen)
dev_info(priv->device, "TSO supported\n");

/* Run HW quirks, if any */
if (priv->hwif_quirks) {
ret = priv->hwif_quirks(priv);
if (ret)
return ret;
}

return 0;
}

Expand Down

0 comments on commit 7cfde0a

Please sign in to comment.