summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2014-08-11 14:50:42 -0700
committerDavid S. Miller <davem@davemloft.net>2014-08-11 15:10:11 -0700
commite4a60a93c4a6e7dd4e3e82736b932375598a26fd (patch)
tree96ec0dcda6a0bb9535bc5a13bdb55ddb229be97e /drivers
parent8dff81e87d5c2867d7401f8ee7b1eb3e3aa2ba8d (diff)
net: bcmgenet: request and enable main clock earlier
bcmgenet_set_hw_params() will read the hardware version and compare it with the one we are getting from Device Tree. Due to the clock being enabled too late, bcmgenet_set_hw_params() will cause bus errors since the GENET hardware block is still gated off by the time bcmgenet_set_hw_params() is called, this will also make us fail the version check since we will read the value 0 from the hardware. Fix this by requesting the clock before the first piece of code that needs to access hardware register. Fixes: 1c1008c793fa4 ("net: bcmgenet: add main driver file") Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/broadcom/genet/bcmgenet.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index ce455aed5a2f..7a3661c090ee 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -2533,6 +2533,13 @@ static int bcmgenet_probe(struct platform_device *pdev)
priv->pdev = pdev;
priv->version = (enum bcmgenet_version)of_id->data;
+ priv->clk = devm_clk_get(&priv->pdev->dev, "enet");
+ if (IS_ERR(priv->clk))
+ dev_warn(&priv->pdev->dev, "failed to get enet clock\n");
+
+ if (!IS_ERR(priv->clk))
+ clk_prepare_enable(priv->clk);
+
bcmgenet_set_hw_params(priv);
/* Mii wait queue */
@@ -2541,17 +2548,10 @@ static int bcmgenet_probe(struct platform_device *pdev)
priv->rx_buf_len = RX_BUF_LENGTH;
INIT_WORK(&priv->bcmgenet_irq_work, bcmgenet_irq_task);
- priv->clk = devm_clk_get(&priv->pdev->dev, "enet");
- if (IS_ERR(priv->clk))
- dev_warn(&priv->pdev->dev, "failed to get enet clock\n");
-
priv->clk_wol = devm_clk_get(&priv->pdev->dev, "enet-wol");
if (IS_ERR(priv->clk_wol))
dev_warn(&priv->pdev->dev, "failed to get enet-wol clock\n");
- if (!IS_ERR(priv->clk))
- clk_prepare_enable(priv->clk);
-
err = reset_umac(priv);
if (err)
goto err_clk_disable;