aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/marvell.txt3
-rw-r--r--drivers/net/ethernet/marvell/mv643xx_eth.c27
2 files changed, 14 insertions, 16 deletions
diff --git a/Documentation/devicetree/bindings/marvell.txt b/Documentation/devicetree/bindings/marvell.txt
index f1533d91953a..f7a0da6b4022 100644
--- a/Documentation/devicetree/bindings/marvell.txt
+++ b/Documentation/devicetree/bindings/marvell.txt
@@ -115,6 +115,9 @@ prefixed with the string "marvell,", for Marvell Technology Group Ltd.
115 - compatible : "marvell,mv64360-eth-block" 115 - compatible : "marvell,mv64360-eth-block"
116 - reg : Offset and length of the register set for this block 116 - reg : Offset and length of the register set for this block
117 117
118 Optional properties:
119 - clocks : Phandle to the clock control device and gate bit
120
118 Example Discovery Ethernet block node: 121 Example Discovery Ethernet block node:
119 ethernet-block@2000 { 122 ethernet-block@2000 {
120 #address-cells = <1>; 123 #address-cells = <1>;
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index aedbd8256ad1..bbe61041ddac 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -268,7 +268,7 @@ struct mv643xx_eth_shared_private {
268 int extended_rx_coal_limit; 268 int extended_rx_coal_limit;
269 int tx_bw_control; 269 int tx_bw_control;
270 int tx_csum_limit; 270 int tx_csum_limit;
271 271 struct clk *clk;
272}; 272};
273 273
274#define TX_BW_CONTROL_ABSENT 0 274#define TX_BW_CONTROL_ABSENT 0
@@ -410,9 +410,7 @@ struct mv643xx_eth_private {
410 /* 410 /*
411 * Hardware-specific parameters. 411 * Hardware-specific parameters.
412 */ 412 */
413#if defined(CONFIG_HAVE_CLK)
414 struct clk *clk; 413 struct clk *clk;
415#endif
416 unsigned int t_clk; 414 unsigned int t_clk;
417}; 415};
418 416
@@ -2569,6 +2567,10 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
2569 if (msp->base == NULL) 2567 if (msp->base == NULL)
2570 goto out_free; 2568 goto out_free;
2571 2569
2570 msp->clk = devm_clk_get(&pdev->dev, NULL);
2571 if (!IS_ERR(msp->clk))
2572 clk_prepare_enable(msp->clk);
2573
2572 /* 2574 /*
2573 * (Re-)program MBUS remapping windows if we are asked to. 2575 * (Re-)program MBUS remapping windows if we are asked to.
2574 */ 2576 */
@@ -2595,6 +2597,8 @@ static int mv643xx_eth_shared_remove(struct platform_device *pdev)
2595 struct mv643xx_eth_shared_private *msp = platform_get_drvdata(pdev); 2597 struct mv643xx_eth_shared_private *msp = platform_get_drvdata(pdev);
2596 2598
2597 iounmap(msp->base); 2599 iounmap(msp->base);
2600 if (!IS_ERR(msp->clk))
2601 clk_disable_unprepare(msp->clk);
2598 kfree(msp); 2602 kfree(msp);
2599 2603
2600 return 0; 2604 return 0;
@@ -2801,13 +2805,12 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
2801 * it to override the default. 2805 * it to override the default.
2802 */ 2806 */
2803 mp->t_clk = 133000000; 2807 mp->t_clk = 133000000;
2804#if defined(CONFIG_HAVE_CLK) 2808 mp->clk = devm_clk_get(&pdev->dev, NULL);
2805 mp->clk = clk_get(&pdev->dev, (pdev->id ? "1" : "0"));
2806 if (!IS_ERR(mp->clk)) { 2809 if (!IS_ERR(mp->clk)) {
2807 clk_prepare_enable(mp->clk); 2810 clk_prepare_enable(mp->clk);
2808 mp->t_clk = clk_get_rate(mp->clk); 2811 mp->t_clk = clk_get_rate(mp->clk);
2809 } 2812 }
2810#endif 2813
2811 set_params(mp, pd); 2814 set_params(mp, pd);
2812 netif_set_real_num_tx_queues(dev, mp->txq_count); 2815 netif_set_real_num_tx_queues(dev, mp->txq_count);
2813 netif_set_real_num_rx_queues(dev, mp->rxq_count); 2816 netif_set_real_num_rx_queues(dev, mp->rxq_count);
@@ -2889,12 +2892,8 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
2889 return 0; 2892 return 0;
2890 2893
2891out: 2894out:
2892#if defined(CONFIG_HAVE_CLK) 2895 if (!IS_ERR(mp->clk))
2893 if (!IS_ERR(mp->clk)) {
2894 clk_disable_unprepare(mp->clk); 2896 clk_disable_unprepare(mp->clk);
2895 clk_put(mp->clk);
2896 }
2897#endif
2898 free_netdev(dev); 2897 free_netdev(dev);
2899 2898
2900 return err; 2899 return err;
@@ -2909,12 +2908,8 @@ static int mv643xx_eth_remove(struct platform_device *pdev)
2909 phy_detach(mp->phy); 2908 phy_detach(mp->phy);
2910 cancel_work_sync(&mp->tx_timeout_task); 2909 cancel_work_sync(&mp->tx_timeout_task);
2911 2910
2912#if defined(CONFIG_HAVE_CLK) 2911 if (!IS_ERR(mp->clk))
2913 if (!IS_ERR(mp->clk)) {
2914 clk_disable_unprepare(mp->clk); 2912 clk_disable_unprepare(mp->clk);
2915 clk_put(mp->clk);
2916 }
2917#endif
2918 2913
2919 free_netdev(mp->dev); 2914 free_netdev(mp->dev);
2920 2915