diff options
author | Gregory CLEMENT <gregory.clement@free-electrons.com> | 2017-09-29 08:27:39 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-02 01:51:40 -0400 |
commit | 4792ea04bcd03b8ccfd1ae336c5deba52dd9edc9 (patch) | |
tree | 895d407b383d3ff0378640dc0bc405e2f782c7d1 | |
parent | 90841047a01b452cc8c3f9b990698b264143334a (diff) |
net: mvpp2: Fix clock resource by adding an optional bus clock
On Armada 7K/8K we need to explicitly enable the bus clock. The bus clock
is optional because not all the SoCs need them but at least for Armada
7K/8K it is actually mandatory.
The binding documentation is updating accordingly.
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | Documentation/devicetree/bindings/net/marvell-pp2.txt | 10 | ||||
-rw-r--r-- | drivers/net/ethernet/marvell/mvpp2.c | 15 |
2 files changed, 21 insertions, 4 deletions
diff --git a/Documentation/devicetree/bindings/net/marvell-pp2.txt b/Documentation/devicetree/bindings/net/marvell-pp2.txt index 7e2dad08a12e..1814fa13f6ab 100644 --- a/Documentation/devicetree/bindings/net/marvell-pp2.txt +++ b/Documentation/devicetree/bindings/net/marvell-pp2.txt | |||
@@ -21,8 +21,9 @@ Required properties: | |||
21 | - main controller clock (for both armada-375-pp2 and armada-7k-pp2) | 21 | - main controller clock (for both armada-375-pp2 and armada-7k-pp2) |
22 | - GOP clock (for both armada-375-pp2 and armada-7k-pp2) | 22 | - GOP clock (for both armada-375-pp2 and armada-7k-pp2) |
23 | - MG clock (only for armada-7k-pp2) | 23 | - MG clock (only for armada-7k-pp2) |
24 | - clock-names: names of used clocks, must be "pp_clk", "gop_clk" and | 24 | - AXI clock (only for armada-7k-pp2) |
25 | "mg_clk" (the latter only for armada-7k-pp2). | 25 | - clock-names: names of used clocks, must be "pp_clk", "gop_clk", "mg_clk" |
26 | and "axi_clk" (the 2 latter only for armada-7k-pp2). | ||
26 | 27 | ||
27 | The ethernet ports are represented by subnodes. At least one port is | 28 | The ethernet ports are represented by subnodes. At least one port is |
28 | required. | 29 | required. |
@@ -78,8 +79,9 @@ Example for marvell,armada-7k-pp2: | |||
78 | cpm_ethernet: ethernet@0 { | 79 | cpm_ethernet: ethernet@0 { |
79 | compatible = "marvell,armada-7k-pp22"; | 80 | compatible = "marvell,armada-7k-pp22"; |
80 | reg = <0x0 0x100000>, <0x129000 0xb000>; | 81 | reg = <0x0 0x100000>, <0x129000 0xb000>; |
81 | clocks = <&cpm_syscon0 1 3>, <&cpm_syscon0 1 9>, <&cpm_syscon0 1 5>; | 82 | clocks = <&cpm_syscon0 1 3>, <&cpm_syscon0 1 9>, |
82 | clock-names = "pp_clk", "gop_clk", "gp_clk"; | 83 | <&cpm_syscon0 1 5>, <&cpm_syscon0 1 18>; |
84 | clock-names = "pp_clk", "gop_clk", "gp_clk", "axi_clk"; | ||
83 | 85 | ||
84 | eth0: eth0 { | 86 | eth0: eth0 { |
85 | interrupts = <ICU_GRP_NSR 39 IRQ_TYPE_LEVEL_HIGH>, | 87 | interrupts = <ICU_GRP_NSR 39 IRQ_TYPE_LEVEL_HIGH>, |
diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c index 161055564720..9c86cb7cb988 100644 --- a/drivers/net/ethernet/marvell/mvpp2.c +++ b/drivers/net/ethernet/marvell/mvpp2.c | |||
@@ -793,6 +793,7 @@ struct mvpp2 { | |||
793 | struct clk *pp_clk; | 793 | struct clk *pp_clk; |
794 | struct clk *gop_clk; | 794 | struct clk *gop_clk; |
795 | struct clk *mg_clk; | 795 | struct clk *mg_clk; |
796 | struct clk *axi_clk; | ||
796 | 797 | ||
797 | /* List of pointers to port structures */ | 798 | /* List of pointers to port structures */ |
798 | struct mvpp2_port **port_list; | 799 | struct mvpp2_port **port_list; |
@@ -7970,6 +7971,18 @@ static int mvpp2_probe(struct platform_device *pdev) | |||
7970 | err = clk_prepare_enable(priv->mg_clk); | 7971 | err = clk_prepare_enable(priv->mg_clk); |
7971 | if (err < 0) | 7972 | if (err < 0) |
7972 | goto err_gop_clk; | 7973 | goto err_gop_clk; |
7974 | |||
7975 | priv->axi_clk = devm_clk_get(&pdev->dev, "axi_clk"); | ||
7976 | if (IS_ERR(priv->axi_clk)) { | ||
7977 | err = PTR_ERR(priv->axi_clk); | ||
7978 | if (err == -EPROBE_DEFER) | ||
7979 | goto err_gop_clk; | ||
7980 | priv->axi_clk = NULL; | ||
7981 | } else { | ||
7982 | err = clk_prepare_enable(priv->axi_clk); | ||
7983 | if (err < 0) | ||
7984 | goto err_gop_clk; | ||
7985 | } | ||
7973 | } | 7986 | } |
7974 | 7987 | ||
7975 | /* Get system's tclk rate */ | 7988 | /* Get system's tclk rate */ |
@@ -8024,6 +8037,7 @@ static int mvpp2_probe(struct platform_device *pdev) | |||
8024 | return 0; | 8037 | return 0; |
8025 | 8038 | ||
8026 | err_mg_clk: | 8039 | err_mg_clk: |
8040 | clk_disable_unprepare(priv->axi_clk); | ||
8027 | if (priv->hw_version == MVPP22) | 8041 | if (priv->hw_version == MVPP22) |
8028 | clk_disable_unprepare(priv->mg_clk); | 8042 | clk_disable_unprepare(priv->mg_clk); |
8029 | err_gop_clk: | 8043 | err_gop_clk: |
@@ -8061,6 +8075,7 @@ static int mvpp2_remove(struct platform_device *pdev) | |||
8061 | aggr_txq->descs_dma); | 8075 | aggr_txq->descs_dma); |
8062 | } | 8076 | } |
8063 | 8077 | ||
8078 | clk_disable_unprepare(priv->axi_clk); | ||
8064 | clk_disable_unprepare(priv->mg_clk); | 8079 | clk_disable_unprepare(priv->mg_clk); |
8065 | clk_disable_unprepare(priv->pp_clk); | 8080 | clk_disable_unprepare(priv->pp_clk); |
8066 | clk_disable_unprepare(priv->gop_clk); | 8081 | clk_disable_unprepare(priv->gop_clk); |