net: mvpp2: Fix hangs when starting some interfaces on 7k/8k
Subsystems (4)
cover net: mvpp2: Fix hangs when starting some interfaces on 7k/8k
Armada 7K / 8K clock management has recently been reworked, see :
commit c7e92def1ef4 ("clk: mvebu: cp110: Fix clock tree representation")
I have been experiencing overall system hangs on MacchiatoBin when starting the eth1 interface since then. It turns out some clocks dependencies were missing in the PPv2 and xmdio driver, the clock rework made this visible.
This series adds the missing clocks in the CP-110 DT bindings for these 2 controllers, updating the documentation accordingly. It also adds support for the missing 'MG Core clock' in mvpp2.
Thanks to Gregory Clement for finding the root cause of this bug.
Maxime Chevallier (3):
net: mvpp2: Fix clk error path in mvpp2_probe
net: mvpp2: Fix clock resource by adding missing mg_core_clk
ARM64: dts: marvell: armada-cp110: Add clocks for the xmdio node
.../devicetree/bindings/net/marvell-pp2.txt | 9 ++++--- arch/arm64/boot/dts/marvell/armada-cp110.dtsi | 7 +++-- drivers/net/ethernet/marvell/mvpp2.c | 31 +++++++++++++++++----- 3 files changed, 34 insertions(+), 13 deletions(-)
Signature · 1 line
2.11.0
PATCH 1/3 net: mvpp2: Fix clk error path in mvpp2_probe
When clk_prepare_enable fails for the axi_clk, the mg_clk isn't properly cleaned up. Add another jump label to handle that case, and make sure we jump to it in the later error cases.
--- drivers/net/ethernet/marvell/mvpp2.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/net/ethernet/marvell/mvpp2.c +8 -7
@@ -8774,12 +8774,12 @@ static int mvpp2_probe(struct platform_device *pdev)if (IS_ERR (priv->axi_clk)) { err =PTR_ERR (priv->axi_clk);if (err == -EPROBE_DEFER ) - goto err_gop_clk; + goto err_mg_clk; priv->axi_clk =NULL ; }else { err =clk_prepare_enable (priv->axi_clk);if (err <0 ) - goto err_gop_clk; + goto err_mg_clk; }/* Get system's tclk rate */
@@ -8793,7 +8793,7 @@ static int mvpp2_probe(struct platform_device *pdev)if (priv->hw_version ==MVPP22 ) { err =dma_set_mask (&pdev->dev,MVPP2_DESC_DMA_MASK );if (err) - goto err_mg_clk; + goto err_axi_clk;/* Sadly, the BM pools all share the same register to * store the high 32 bits of their address. So they * must all have the same high 32 bits, which forces
@@ -8801,14 +8801,14 @@ static int mvpp2_probe(struct platform_device *pdev)*/ err =dma_set_coherent_mask (&pdev->dev,DMA_BIT_MASK (32 ));if (err) - goto err_mg_clk; + goto err_axi_clk; }/* Initialize network controller */ err =mvpp2_init (pdev, priv);if (err <0 ) {dev_err (&pdev->dev,"failed to initialize controller\n" ); - goto err_mg_clk; + goto err_axi_clk; }/* Initialize ports */
@@ -8821,7 +8821,7 @@ static int mvpp2_probe(struct platform_device *pdev)if (priv->port_count ==0 ) {dev_err (&pdev->dev,"no ports enabled\n" ); err = -ENODEV ; - goto err_mg_clk; + goto err_axi_clk; }/* Statistics must be gathered regularly because some of them (like
@@ -8849,8 +8849,9 @@ static int mvpp2_probe(struct platform_device *pdev)mvpp2_port_remove (priv->port_list[i]); i++; } -err_mg_clk: +err_axi_clk:clk_disable_unprepare (priv->axi_clk); +err_mg_clk:if (priv->hw_version ==MVPP22 )clk_disable_unprepare (priv->mg_clk); err_gop_clk:
Signature · 1 line
2.11.0
PATCH 2/3 net: mvpp2: Fix clock resource by adding missing mg_core_clk
In reply to Maxime ChevallierMarvell's PPv2.2 IP needs an additional clock named "MG Core clock". This is required on Armada 7K and 8K.
This commit adds the required clock, updates the devicetree and its documentation accordingly, also fixing a small typo in the marvell-mpp2.txt examples.
--- .../devicetree/bindings/net/marvell-pp2.txt | 9 +++++---- arch/arm64/boot/dts/marvell/armada-cp110.dtsi | 5 +++-- drivers/net/ethernet/marvell/mvpp2.c | 20 ++++++++++++++++++-- 3 files changed, 26 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/net/marvell-pp2.txt +5 -4
@@ -21,9 +21,10 @@ Required properties: - main controller clock (for both armada-375-pp2 and armada-7k-pp2) - GOP clock (for both armada-375-pp2 and armada-7k-pp2) - MG clock (only for armada-7k-pp2) + - MG Core clock (only for armada-7k-pp2) - AXI clock (only for armada-7k-pp2) -- clock-names: names of used clocks, must be "pp_clk", "gop_clk", "mg_clk" - and "axi_clk" (the 2 latter only for armada-7k-pp2). +- clock-names: names of used clocks, must be "pp_clk", "gop_clk", "mg_clk", + "mg_core_clk" and "axi_clk" (the 3 latter only for armada-7k-pp2). The ethernet ports are represented by subnodes. At least one port is required.
@@ -80,8 +81,8 @@ cpm_ethernet: ethernet at 0 { compatible = "marvell,armada-7k-pp22"; reg = <0x0 0x100000>, <0x129000 0xb000>; clocks = <&cpm_syscon0 1 3>, <&cpm_syscon0 1 9>, - <&cpm_syscon0 1 5>, <&cpm_syscon0 1 18>; - clock-names = "pp_clk", "gop_clk", "gp_clk", "axi_clk"; + <&cpm_syscon0 1 5>, <&cpm_syscon0 1 6>, <&cpm_syscon0 1 18>; + clock-names = "pp_clk", "gop_clk", "mg_clk", "mg_core_clk", "axi_clk"; eth0: eth0 { interrupts = <ICU_GRP_NSR 39 IRQ_TYPE_LEVEL_HIGH>,
arch/arm64/boot/dts/marvell/armada-cp110.dtsi +3 -2
@@ -38,9 +38,10 @@ compatible = "marvell,armada-7k-pp22"; reg = <0x0 0x100000>, <0x129000 0xb000>; clocks = <&CP110_LABEL(clk) 1 3>, <&CP110_LABEL(clk) 1 9>, - <&CP110_LABEL(clk) 1 5>, <&CP110_LABEL(clk) 1 18>; + <&CP110_LABEL(clk) 1 5>, <&CP110_LABEL(clk) 1 6>, + <&CP110_LABEL(clk) 1 18>; clock-names = "pp_clk", "gop_clk", - "mg_clk", "axi_clk"; + "mg_clk", "mg_core_clk", "axi_clk"; marvell,system-controller = <&CP110_LABEL(syscon0)>; status = "disabled"; dma-coherent;
drivers/net/ethernet/marvell/mvpp2.c +18 -2
@@ -942,6 +942,7 @@ struct mvpp2 {struct clk *pp_clk;struct clk *gop_clk;struct clk *mg_clk; +struct clk *mg_core_clk;struct clk *axi_clk;/* List of pointers to port structures */
@@ -8768,18 +8769,28 @@ static int mvpp2_probe(struct platform_device *pdev) err =clk_prepare_enable (priv->mg_clk);if (err <0 ) goto err_gop_clk; + + priv->mg_core_clk =devm_clk_get (&pdev->dev,"mg_core_clk" ); +if (IS_ERR (priv->mg_core_clk)) { + err =PTR_ERR (priv->mg_core_clk); + goto err_mg_clk; + } + + err =clk_prepare_enable (priv->mg_core_clk); +if (err <0 ) + goto err_mg_clk; } priv->axi_clk =devm_clk_get (&pdev->dev,"axi_clk" );if (IS_ERR (priv->axi_clk)) { err =PTR_ERR (priv->axi_clk);if (err == -EPROBE_DEFER ) - goto err_mg_clk; + goto err_mg_core_clk; priv->axi_clk =NULL ; }else { err =clk_prepare_enable (priv->axi_clk);if (err <0 ) - goto err_mg_clk; + goto err_mg_core_clk; }/* Get system's tclk rate */
@@ -8851,6 +8862,10 @@ static int mvpp2_probe(struct platform_device *pdev) } err_axi_clk:clk_disable_unprepare (priv->axi_clk); + +err_mg_core_clk: +if (priv->hw_version ==MVPP22 ) +clk_disable_unprepare (priv->mg_core_clk); err_mg_clk:if (priv->hw_version ==MVPP22 )clk_disable_unprepare (priv->mg_clk);
@@ -8898,6 +8913,7 @@ static int mvpp2_remove(struct platform_device *pdev)return 0 ;clk_disable_unprepare (priv->axi_clk); +clk_disable_unprepare (priv->mg_core_clk);clk_disable_unprepare (priv->mg_clk);clk_disable_unprepare (priv->pp_clk);clk_disable_unprepare (priv->gop_clk);
Signature · 1 line
2.11.0
PATCH 3/3 ARM64: dts: marvell: armada-cp110: Add clocks for the xmdio node
In reply to Maxime ChevallierThe Marvell XSMI controller needs 3 clocks to operate correctly :
- The MG clock (clk 5)
- The MG Core clock (clk 6)
- The GOP clock (clk 18)
This commit adds them, to avoid system hangs when using these interfaces.
--- arch/arm64/boot/dts/marvell/armada-cp110.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/marvell/armada-cp110.dtsi +2 -0
@@ -142,6 +142,8 @@ #size-cells = <0>; compatible = "marvell,xmdio"; reg = <0x12a600 0x10>; + clocks = <&CP110_LABEL(clk) 1 5>, + <&CP110_LABEL(clk) 1 6>, <&CP110_LABEL(clk) 1 18>; status = "disabled"; };
Signature · 1 line
2.11.0
Gregory CLEMENT
maintainerRe: [PATCH net 3/3] ARM64: dts: marvell: armada-cp110: Add clocks for the xmdio node
Hi Maxime,
Quoted 10 lines · Maxime Chevallier
The Marvell XSMI controller needs 3 clocks to operate correctly :
- The MG clock (clk 5)
- The MG Core clock (clk 6)
- The GOP clock (clk 18)This commit adds them, to avoid system hangs when using these interfaces.
Fixes c7e92def1ef4 ("clk: mvebu: cp110: Fix clock tree representation")Signed-off-by Maxime Chevallier <[email protected]>
This patch should not have been sent with the net prefix and should not be merge through the net subsystem.
I will take care of it to avoid conflict in the devei tree file during the merge windows.
Thanks,
Gregory
Quoted 20 lines
--- arch/arm64/boot/dts/marvell/armada-cp110.dtsi | 2 ++ 1 file changed, 2 insertions(+)arch/arm64/boot/dts/marvell/armada-cp110.dtsi +2
-0@@ -142,6 +142,8 @@ #size-cells = <0>; compatible = "marvell,xmdio"; reg = <0x12a600 0x10>; + clocks = <&CP110_LABEL(clk) 1 5>, + <&CP110_LABEL(clk) 1 6>, <&CP110_LABEL(clk) 1 18>; status = "disabled"; };Signature · 1 line
2.11.0
Signature · 3 lines
Gregory Clement, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering http://bootlin.com
Gregory CLEMENT
maintainerRe: [PATCH net 2/3] net: mvpp2: Fix clock resource by adding missing mg_core_clk
In reply to Maxime ChevallierHi Maxime,
Quoted 7 lines · Maxime Chevallier
Marvell's PPv2.2 IP needs an additional clock named "MG Core clock". This is required on Armada 7K and 8K.
This commit adds the required clock, updates the devicetree and its documentation accordingly, also fixing a small typo in the marvell-mpp2.txt examples.
Quoted 5 lines
Fixes c7e92def1ef4 ("clk: mvebu: cp110: Fix clock tree representation")Signed-off-by Maxime Chevallier <[email protected]>--- .../devicetree/bindings/net/marvell-pp2.txt | 9 +++++---- arch/arm64/boot/dts/marvell/armada-cp110.dtsi | 5 +++--
Could you remove the dtsi part and submit it as a separate patch. Then I will take care of it.
Thanks,
Gregory
Quoted 113 lines
drivers/net/ethernet/marvell/mvpp2.c | 20 ++++++++++++++++++-- 3 files changed, 26 insertions(+), 8 deletions(-)Documentation/devicetree/bindings/net/marvell-pp2.txt +5
-4@@ -21,9 +21,10 @@ Required properties: - main controller clock (for both armada-375-pp2 and armada-7k-pp2) - GOP clock (for both armada-375-pp2 and armada-7k-pp2) - MG clock (only for armada-7k-pp2) + - MG Core clock (only for armada-7k-pp2) - AXI clock (only for armada-7k-pp2) -- clock-names: names of used clocks, must be "pp_clk", "gop_clk", "mg_clk" - and "axi_clk" (the 2 latter only for armada-7k-pp2). +- clock-names: names of used clocks, must be "pp_clk", "gop_clk", "mg_clk", + "mg_core_clk" and "axi_clk" (the 3 latter only for armada-7k-pp2). The ethernet ports are represented by subnodes. At least one port is required.@@ -80,8 +81,8 @@ cpm_ethernet: ethernet at 0 { compatible = "marvell,armada-7k-pp22"; reg = <0x0 0x100000>, <0x129000 0xb000>; clocks = <&cpm_syscon0 1 3>, <&cpm_syscon0 1 9>, - <&cpm_syscon0 1 5>, <&cpm_syscon0 1 18>; - clock-names = "pp_clk", "gop_clk", "gp_clk", "axi_clk"; + <&cpm_syscon0 1 5>, <&cpm_syscon0 1 6>, <&cpm_syscon0 1 18>; + clock-names = "pp_clk", "gop_clk", "mg_clk", "mg_core_clk", "axi_clk"; eth0: eth0 { interrupts = <ICU_GRP_NSR 39 IRQ_TYPE_LEVEL_HIGH>,arch/arm64/boot/dts/marvell/armada-cp110.dtsi +3
-2@@ -38,9 +38,10 @@ compatible = "marvell,armada-7k-pp22"; reg = <0x0 0x100000>, <0x129000 0xb000>; clocks = <&CP110_LABEL(clk) 1 3>, <&CP110_LABEL(clk) 1 9>, - <&CP110_LABEL(clk) 1 5>, <&CP110_LABEL(clk) 1 18>; + <&CP110_LABEL(clk) 1 5>, <&CP110_LABEL(clk) 1 6>, + <&CP110_LABEL(clk) 1 18>; clock-names = "pp_clk", "gop_clk", - "mg_clk", "axi_clk"; + "mg_clk", "mg_core_clk", "axi_clk"; marvell,system-controller = <&CP110_LABEL(syscon0)>; status = "disabled"; dma-coherent;drivers/net/ethernet/marvell/mvpp2.c +18
-2@@ -942,6 +942,7 @@ struct mvpp2 {struct clk *pp_clk;struct clk *gop_clk;struct clk *mg_clk; +struct clk *mg_core_clk;struct clk *axi_clk;/* List of pointers to port structures */ @@ -8768,18 +8769,28 @@ static int mvpp2_probe(struct platform_device *pdev) err =clk_prepare_enable (priv->mg_clk);if (err <0 ) goto err_gop_clk; + + priv->mg_core_clk =devm_clk_get (&pdev->dev,"mg_core_clk" ); +if (IS_ERR (priv->mg_core_clk)) { + err =PTR_ERR (priv->mg_core_clk); + goto err_mg_clk; + } + + err =clk_prepare_enable (priv->mg_core_clk); +if (err <0 ) + goto err_mg_clk; } priv->axi_clk =devm_clk_get (&pdev->dev,"axi_clk" );if (IS_ERR (priv->axi_clk)) { err =PTR_ERR (priv->axi_clk);if (err == -EPROBE_DEFER ) - goto err_mg_clk; + goto err_mg_core_clk; priv->axi_clk =NULL ; }else { err =clk_prepare_enable (priv->axi_clk);if (err <0 ) - goto err_mg_clk; + goto err_mg_core_clk; }/* Get system's tclk rate */ @@ -8851,6 +8862,10 @@ static int mvpp2_probe(struct platform_device *pdev) } err_axi_clk:clk_disable_unprepare (priv->axi_clk); + +err_mg_core_clk: +if (priv->hw_version ==MVPP22 ) +clk_disable_unprepare (priv->mg_core_clk); err_mg_clk:if (priv->hw_version ==MVPP22 )clk_disable_unprepare (priv->mg_clk);@@ -8898,6 +8913,7 @@ static int mvpp2_remove(struct platform_device *pdev)return 0 ;clk_disable_unprepare (priv->axi_clk); +clk_disable_unprepare (priv->mg_core_clk);clk_disable_unprepare (priv->mg_clk);clk_disable_unprepare (priv->pp_clk);clk_disable_unprepare (priv->gop_clk);Signature · 1 line
2.11.0
Signature · 3 lines
Gregory Clement, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering http://bootlin.com
Re: [PATCH net 2/3] net: mvpp2: Fix clock resource by adding missing mg_core_clk
Hi Gregory,
Quoted 12 lines · On Wed, 25 Apr 2018 13:43:14 +0200 Gregory CLEMENT…
Hi Maxime,
Quoted 7 lines · Maxime Chevallier
Marvell's PPv2.2 IP needs an additional clock named "MG Core clock". This is required on Armada 7K and 8K.
This commit adds the required clock, updates the devicetree and its documentation accordingly, also fixing a small typo in the marvell-mpp2.txt examples.
Quoted 8 lines
Quoted 5 lines
Fixes c7e92def1ef4 ("clk: mvebu: cp110: Fix clock treerepresentation") Signed-off-by: Maxime Chevallier
<[email protected]> ---.../devicetree/bindings/net/marvell-pp2.txt | 9 +++++---- arch/arm64/boot/dts/marvell/armada-cp110.dtsi | 5 +++--Could you remove the dtsi part and submit it as a separate patch. Then I will take care of it.
Ok no problem, I'll split that and re-send it.
Thanks,
Maxime
Signature · 3 lines
Maxime Chevallier, Bootlin (formerly Free Electrons) Embedded Linux and kernel engineering https://bootlin.com
Re: [PATCH net 1/3] net: mvpp2: Fix clk error path in mvpp2_probe
In reply to Maxime ChevallierHi Maxime,
Quoted 6 lines · Maxime Chevallier
When
clk_prepare_enablefails for theaxi_clk, themg_clkisn't properly cleaned up. Add another jump label to handle that case, and make sure we jump to it in the later error cases.Fixes 4792ea04bcd0 ("net: mvpp2: Fix clock resource by adding an optional bus clock")Signed-off-by Maxime Chevallier <[email protected]>
Thanks,
Gregory
Quoted 72 lines
--- drivers/net/ethernet/marvell/mvpp2.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)drivers/net/ethernet/marvell/mvpp2.c +8
-7@@ -8774,12 +8774,12 @@ static int mvpp2_probe(struct platform_device *pdev)if (IS_ERR (priv->axi_clk)) { err =PTR_ERR (priv->axi_clk);if (err == -EPROBE_DEFER ) - goto err_gop_clk; + goto err_mg_clk; priv->axi_clk =NULL ; }else { err =clk_prepare_enable (priv->axi_clk);if (err <0 ) - goto err_gop_clk; + goto err_mg_clk; }/* Get system's tclk rate */ @@ -8793,7 +8793,7 @@ static int mvpp2_probe(struct platform_device *pdev)if (priv->hw_version ==MVPP22 ) { err =dma_set_mask (&pdev->dev,MVPP2_DESC_DMA_MASK );if (err) - goto err_mg_clk; + goto err_axi_clk;/* Sadly, the BM pools all share the same register to * store the high 32 bits of their address. So they * must all have the same high 32 bits, which forces @@ -8801,14 +8801,14 @@ static int mvpp2_probe(struct platform_device *pdev)*/ err =dma_set_coherent_mask (&pdev->dev,DMA_BIT_MASK (32 ));if (err) - goto err_mg_clk; + goto err_axi_clk; }/* Initialize network controller */ err =mvpp2_init (pdev, priv);if (err <0 ) {dev_err (&pdev->dev,"failed to initialize controller\n" ); - goto err_mg_clk; + goto err_axi_clk; }/* Initialize ports */ @@ -8821,7 +8821,7 @@ static int mvpp2_probe(struct platform_device *pdev)if (priv->port_count ==0 ) {dev_err (&pdev->dev,"no ports enabled\n" ); err = -ENODEV ; - goto err_mg_clk; + goto err_axi_clk; }/* Statistics must be gathered regularly because some of them (like @@ -8849,8 +8849,9 @@ static int mvpp2_probe(struct platform_device *pdev)mvpp2_port_remove (priv->port_list[i]); i++; } -err_mg_clk: +err_axi_clk:clk_disable_unprepare (priv->axi_clk); +err_mg_clk:if (priv->hw_version ==MVPP22 )clk_disable_unprepare (priv->mg_clk); err_gop_clk:Signature · 1 line
2.11.0
Signature · 3 lines
Gregory Clement, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering http://bootlin.com
Gregory CLEMENT
maintainerRe: [PATCH net 3/3] ARM64: dts: marvell: armada-cp110: Add clocks for the xmdio node
In reply to Gregory CLEMENTHi agin,
Quoted 12 lines · Gregory CLEMENT
Hi Maxime,
Quoted 8 lines · Maxime Chevallier
The Marvell XSMI controller needs 3 clocks to operate correctly :
- The MG clock (clk 5)
- The MG Core clock (clk 6)
- The GOP clock (clk 18)This commit adds them, to avoid system hangs when using these interfaces.
Quoted 8 lines
Quoted 2 lines
Fixes c7e92def1ef4 ("clk: mvebu: cp110: Fix clock tree representation")Signed-off-by Maxime Chevallier <[email protected]>This patch should not have been sent with the net prefix and should not be merge through the net subsystem.
I will take care of it to avoid conflict in the devei tree file during the merge windows.
So, applied on mvebu/fixes
Thanks,
Gregory
Quoted 30 lines
Thanks,
Gregory
Quoted 20 lines
--- arch/arm64/boot/dts/marvell/armada-cp110.dtsi | 2 ++ 1 file changed, 2 insertions(+)arch/arm64/boot/dts/marvell/armada-cp110.dtsi +2
-0@@ -142,6 +142,8 @@ #size-cells = <0>; compatible = "marvell,xmdio"; reg = <0x12a600 0x10>; + clocks = <&CP110_LABEL(clk) 1 5>, + <&CP110_LABEL(clk) 1 6>, <&CP110_LABEL(clk) 1 18>; status = "disabled"; };Signature · 1 line
2.11.0Signature · 3 lines
Gregory Clement, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering http://bootlin.com
Signature · 3 lines
Gregory Clement, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering http://bootlin.com