diff mbox series

[4.9] net: axienet: Misplaced backport of "Wait for PhyRstCmplt after core reset"

Message ID 1644338071-24326-1-git-send-email-guillaume.bertholon@ens.fr
State New
Headers show
Series [4.9] net: axienet: Misplaced backport of "Wait for PhyRstCmplt after core reset" | expand

Commit Message

Guillaume Bertholon Feb. 8, 2022, 4:34 p.m. UTC
The upstream commit b400c2f4f4c5 ("net: axienet: Wait for PhyRstCmplt
after core reset") add new instructions in the `__axienet_device_reset`
function to wait until PhyRstCmplt bit is set, and return a non zero-exit
value if this exceeds a timeout.

However, its backported version in 4.9 (commit 9f1a3c13342b ("net:
axienet: Wait for PhyRstCmplt after core reset")) insert these
instructions in `axienet_dma_bd_init` instead.

Unlike upstream, the version of `__axienet_device_reset` currently present
in branch stable/linux-4.9.y does not return an integer for error codes.
Therefore the backport cannot be as simple as moving the inserted
instructions in the right place.

Where and how should we backport the patch in this case ?
Should we simply revert it instead ?

- Guillaume Bertholon

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Upstream
  b400c2f4f4c53c86594dd57098970d97d488bfde
%%%%%%%%%

Comments

Greg KH Feb. 11, 2022, 11:56 a.m. UTC | #1
On Tue, Feb 08, 2022 at 05:34:31PM +0100, Guillaume Bertholon wrote:
> The upstream commit b400c2f4f4c5 ("net: axienet: Wait for PhyRstCmplt
> after core reset") add new instructions in the `__axienet_device_reset`
> function to wait until PhyRstCmplt bit is set, and return a non zero-exit
> value if this exceeds a timeout.
> 
> However, its backported version in 4.9 (commit 9f1a3c13342b ("net:
> axienet: Wait for PhyRstCmplt after core reset")) insert these
> instructions in `axienet_dma_bd_init` instead.
> 
> Unlike upstream, the version of `__axienet_device_reset` currently present
> in branch stable/linux-4.9.y does not return an integer for error codes.
> Therefore the backport cannot be as simple as moving the inserted
> instructions in the right place.
> 
> Where and how should we backport the patch in this case ?
> Should we simply revert it instead ?

We should just revert it.  Can you make up a patch that does so?

thanks,

greg k-h
diff mbox series

Patch

diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 9c5b24a..3a2d7e8 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -516,6 +516,16 @@  static int __axienet_device_reset(struct axienet_local *lp)
                return ret;
        }

+       /* Wait for PhyRstCmplt bit to be set, indicating the PHY reset has finished */
+       ret = read_poll_timeout(axienet_ior, value,
+                               value & XAE_INT_PHYRSTCMPLT_MASK,
+                               DELAY_OF_ONE_MILLISEC, 50000, false, lp,
+                               XAE_IS_OFFSET);
+       if (ret) {
+               dev_err(lp->dev, "%s: timeout waiting for PhyRstCmplt\n", __func__);
+               return ret;
+       }
+
        return 0;
 }


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Backported
  9f1a3c13342b4d96b9baa337ec5fb7d453828709
%%%%%%%%%

diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 46fcf3e..cc5399f 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -278,6 +278,16 @@  static int axienet_dma_bd_init(struct net_device *ndev)
        axienet_dma_out32(lp, XAXIDMA_TX_CR_OFFSET,
                          cr | XAXIDMA_CR_RUNSTOP_MASK);

+       /* Wait for PhyRstCmplt bit to be set, indicating the PHY reset has finished */
+       ret = read_poll_timeout(axienet_ior, value,
+                               value & XAE_INT_PHYRSTCMPLT_MASK,
+                               DELAY_OF_ONE_MILLISEC, 50000, false, lp,
+                               XAE_IS_OFFSET);
+       if (ret) {
+               dev_err(lp->dev, "%s: timeout waiting for PhyRstCmplt\n", __func__);
+               return ret;
+       }
+
        return 0;
 out:
        axienet_dma_bd_release(ndev);