Skip to content

Commit 4792ea0

Browse files
gclementdavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9084104 commit 4792ea0

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

Documentation/devicetree/bindings/net/marvell-pp2.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ Required properties:
2121
- main controller clock (for both armada-375-pp2 and armada-7k-pp2)
2222
- GOP clock (for both armada-375-pp2 and armada-7k-pp2)
2323
- MG clock (only for armada-7k-pp2)
24-
- clock-names: names of used clocks, must be "pp_clk", "gop_clk" and
25-
"mg_clk" (the latter only for armada-7k-pp2).
24+
- AXI clock (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).
2627

2728
The ethernet ports are represented by subnodes. At least one port is
2829
required.
@@ -78,8 +79,9 @@ Example for marvell,armada-7k-pp2:
7879
cpm_ethernet: ethernet@0 {
7980
compatible = "marvell,armada-7k-pp22";
8081
reg = <0x0 0x100000>, <0x129000 0xb000>;
81-
clocks = <&cpm_syscon0 1 3>, <&cpm_syscon0 1 9>, <&cpm_syscon0 1 5>;
82-
clock-names = "pp_clk", "gop_clk", "gp_clk";
82+
clocks = <&cpm_syscon0 1 3>, <&cpm_syscon0 1 9>,
83+
<&cpm_syscon0 1 5>, <&cpm_syscon0 1 18>;
84+
clock-names = "pp_clk", "gop_clk", "gp_clk", "axi_clk";
8385

8486
eth0: eth0 {
8587
interrupts = <ICU_GRP_NSR 39 IRQ_TYPE_LEVEL_HIGH>,

drivers/net/ethernet/marvell/mvpp2.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,7 @@ struct mvpp2 {
793793
struct clk *pp_clk;
794794
struct clk *gop_clk;
795795
struct clk *mg_clk;
796+
struct clk *axi_clk;
796797

797798
/* List of pointers to port structures */
798799
struct mvpp2_port **port_list;
@@ -7970,6 +7971,18 @@ static int mvpp2_probe(struct platform_device *pdev)
79707971
err = clk_prepare_enable(priv->mg_clk);
79717972
if (err < 0)
79727973
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+
}
79737986
}
79747987

79757988
/* Get system's tclk rate */
@@ -8024,6 +8037,7 @@ static int mvpp2_probe(struct platform_device *pdev)
80248037
return 0;
80258038

80268039
err_mg_clk:
8040+
clk_disable_unprepare(priv->axi_clk);
80278041
if (priv->hw_version == MVPP22)
80288042
clk_disable_unprepare(priv->mg_clk);
80298043
err_gop_clk:
@@ -8061,6 +8075,7 @@ static int mvpp2_remove(struct platform_device *pdev)
80618075
aggr_txq->descs_dma);
80628076
}
80638077

8078+
clk_disable_unprepare(priv->axi_clk);
80648079
clk_disable_unprepare(priv->mg_clk);
80658080
clk_disable_unprepare(priv->pp_clk);
80668081
clk_disable_unprepare(priv->gop_clk);

0 commit comments

Comments
 (0)