Skip to content

Commit 7cfde0a

Browse files
joabreudavem330
authored andcommitted
net: stmmac: Run HWIF Quirks after getting HW caps
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]>
1 parent f6a6f20 commit 7cfde0a

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,8 @@ int stmmac_hwif_init(struct stmmac_priv *priv)
252252
return ret;
253253
}
254254

255-
/* Run quirks, if needed */
256-
if (entry->quirks) {
257-
ret = entry->quirks(priv);
258-
if (ret)
259-
return ret;
260-
}
261-
255+
/* Save quirks, if needed for posterior use */
256+
priv->hwif_quirks = entry->quirks;
262257
return 0;
263258
}
264259

drivers/net/ethernet/stmicro/stmmac/stmmac.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ struct stmmac_priv {
129129
struct net_device *dev;
130130
struct device *device;
131131
struct mac_device_info *hw;
132+
int (*hwif_quirks)(struct stmmac_priv *priv);
132133
struct mutex lock;
133134

134135
/* RX Queue */

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4135,6 +4135,13 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
41354135
if (priv->dma_cap.tsoen)
41364136
dev_info(priv->device, "TSO supported\n");
41374137

4138+
/* Run HW quirks, if any */
4139+
if (priv->hwif_quirks) {
4140+
ret = priv->hwif_quirks(priv);
4141+
if (ret)
4142+
return ret;
4143+
}
4144+
41384145
return 0;
41394146
}
41404147

0 commit comments

Comments
 (0)