aac70f986640ab41290f7c5fc3ea16c12e7d0457
[openwrt.git] / target / linux / brcm63xx / patches-3.8 / 021-bcm63xx_enet-properly-prepare-unprepare-clocks-befor.patch
1 From 8d6b746129f11efe4ba69aeb2c982359d33c6ec3 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jogo@openwrt.org>
3 Date: Mon, 10 Sep 2012 01:28:47 +0200
4 Subject: [PATCH 3/3] bcm63xx_enet: properly prepare/unprepare clocks
5  before/after usage
6
7 Use clk_prepare_enable/disable_unprepare calls in preparation for
8 switching to the generic clock framework.
9
10 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
11 ---
12  drivers/net/ethernet/broadcom/bcm63xx_enet.c |   12 ++++++------
13  1 file changed, 6 insertions(+), 6 deletions(-)
14
15 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
16 +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
17 @@ -1671,7 +1671,7 @@ static int bcm_enet_probe(struct platfor
18                 ret = PTR_ERR(priv->mac_clk);
19                 goto out;
20         }
21 -       clk_enable(priv->mac_clk);
22 +       clk_prepare_enable(priv->mac_clk);
23  
24         /* initialize default and fetch platform data */
25         priv->rx_ring_size = BCMENET_DEF_RX_DESC;
26 @@ -1700,7 +1700,7 @@ static int bcm_enet_probe(struct platfor
27                         priv->phy_clk = NULL;
28                         goto out_put_clk_mac;
29                 }
30 -               clk_enable(priv->phy_clk);
31 +               clk_prepare_enable(priv->phy_clk);
32         }
33  
34         /* do minimal hardware init to be able to probe mii bus */
35 @@ -1801,12 +1801,12 @@ out_uninit_hw:
36         /* turn off mdc clock */
37         enet_writel(priv, 0, ENET_MIISC_REG);
38         if (priv->phy_clk) {
39 -               clk_disable(priv->phy_clk);
40 +               clk_disable_unprepare(priv->phy_clk);
41                 clk_put(priv->phy_clk);
42         }
43  
44  out_put_clk_mac:
45 -       clk_disable(priv->mac_clk);
46 +       clk_disable_unprepare(priv->mac_clk);
47         clk_put(priv->mac_clk);
48  out:
49         free_netdev(dev);
50 @@ -1844,10 +1844,10 @@ static int bcm_enet_remove(struct platfo
51  
52         /* disable hw block clocks */
53         if (priv->phy_clk) {
54 -               clk_disable(priv->phy_clk);
55 +               clk_disable_unprepare(priv->phy_clk);
56                 clk_put(priv->phy_clk);
57         }
58 -       clk_disable(priv->mac_clk);
59 +       clk_disable_unprepare(priv->mac_clk);
60         clk_put(priv->mac_clk);
61  
62         platform_set_drvdata(pdev, NULL);