2019-10-07 15:45:45

by Antonio Borneo

[permalink] [raw]
Subject: [PATCH] net: stmmac: fix disabling flexible PPS output

Accordingly to Synopsys documentation [1] and [2], when bit PPSEN0
in register MAC_PPS_CONTROL is set it selects the functionality
command in the same register, otherwise selects the functionality
control.
Command functionality is required to either enable (command 0x2)
and disable (command 0x5) the flexible PPS output, but the bit
PPSEN0 is currently set only for enabling.

Set the bit PPSEN0 to properly disable flexible PPS output.

Tested on STM32MP15x, based on dwmac 4.10a.

[1] DWC Ethernet QoS Databook 4.10a October 2014
[2] DWC Ethernet QoS Databook 5.00a September 2017

Signed-off-by: Antonio Borneo <[email protected]>
Fixes: 9a8a02c9d46d ("net: stmmac: Add Flexible PPS support")
---
drivers/net/ethernet/stmicro/stmmac/dwmac5.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c
index 3f4f3132e16b..e436fa160c7d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c
@@ -515,6 +515,7 @@ int dwmac5_flex_pps_config(void __iomem *ioaddr, int index,

if (!enable) {
val |= PPSCMDx(index, 0x5);
+ val |= PPSEN0;
writel(val, ioaddr + MAC_PPS_CONTROL);
return 0;
}
--
2.23.0


2019-10-09 23:11:17

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH] net: stmmac: fix disabling flexible PPS output

On Mon, 7 Oct 2019 17:43:05 +0200, Antonio Borneo wrote:
> Accordingly to Synopsys documentation [1] and [2], when bit PPSEN0
> in register MAC_PPS_CONTROL is set it selects the functionality
> command in the same register, otherwise selects the functionality
> control.
> Command functionality is required to either enable (command 0x2)
> and disable (command 0x5) the flexible PPS output, but the bit
> PPSEN0 is currently set only for enabling.
>
> Set the bit PPSEN0 to properly disable flexible PPS output.
>
> Tested on STM32MP15x, based on dwmac 4.10a.
>
> [1] DWC Ethernet QoS Databook 4.10a October 2014
> [2] DWC Ethernet QoS Databook 5.00a September 2017
>
> Signed-off-by: Antonio Borneo <[email protected]>
> Fixes: 9a8a02c9d46d ("net: stmmac: Add Flexible PPS support")

Applied to net, queued for stable.