summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
diff options
context:
space:
mode:
authorGiuseppe CAVALLARO2012-02-15 01:10:39 +0100
committerDavid S. Miller2012-02-15 20:52:10 +0100
commitcf3f047b9af49d4ee8abfa31b0ef0e99cbcaf17d (patch)
tree695883ca9df55d62ee83d35fc86a37e47bcb04f6 /drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
parentstmmac: request_irq when use an ext wake irq line (v2) (diff)
downloadkernel-qcow2-linux-cf3f047b9af49d4ee8abfa31b0ef0e99cbcaf17d.tar.gz
kernel-qcow2-linux-cf3f047b9af49d4ee8abfa31b0ef0e99cbcaf17d.tar.xz
kernel-qcow2-linux-cf3f047b9af49d4ee8abfa31b0ef0e99cbcaf17d.zip
stmmac: move hw init in the probe (v2)
This patch moves the MAC HW initialization and the HW feature verification from the open to the probe function as D. Miller suggested. So the patch actually reorganizes and tidies-up some parts of the driver and indeed fixes some problem when tune its HW features. These can be overwritten by looking at the HW cap register at run-time and that generated problems. Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Reviewed-by: Francesco Virlinzi <francesco.virlinzi@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c')
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 1ac83243649a..3aad9810237c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -59,16 +59,20 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
goto out_release_region;
}
plat_dat = pdev->dev.platform_data;
- priv = stmmac_dvr_probe(&(pdev->dev), plat_dat);
+
+ /* Custom initialisation (if needed)*/
+ if (plat_dat->init) {
+ ret = plat_dat->init(pdev);
+ if (unlikely(ret))
+ goto out_unmap;
+ }
+
+ priv = stmmac_dvr_probe(&(pdev->dev), plat_dat, addr);
if (!priv) {
- pr_err("%s: main drivr probe failed", __func__);
+ pr_err("%s: main driver probe failed", __func__);
goto out_unmap;
}
- priv->ioaddr = addr;
- /* Set the I/O base addr */
- priv->dev->base_addr = (unsigned long)addr;
-
/* Get the MAC information */
priv->dev->irq = platform_get_irq_byname(pdev, "macirq");
if (priv->dev->irq == -ENXIO) {
@@ -92,13 +96,6 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, priv->dev);
- /* Custom initialisation */
- if (priv->plat->init) {
- ret = priv->plat->init(pdev);
- if (unlikely(ret))
- goto out_unmap;
- }
-
pr_debug("STMMAC platform driver registration completed");
return 0;