From 060f87e6237294a65dc49fd9eafdeaae042fdf29 Mon Sep 17 00:00:00 2001 From: Jim Ma Date: Thu, 3 Nov 2022 12:39:35 +0000 Subject: [PATCH] igc: Fix suspending when PTM is active backport from https://github.com/torvalds/linux/commit/822f52e7efdc88fccffb9fbf6250a4b7666a0b0f Signed-off-by: Jim Ma --- igc_ptp.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/igc_ptp.c b/igc_ptp.c index 7314556..42ebf88 100644 --- a/igc_ptp.c +++ b/igc_ptp.c @@ -562,6 +562,17 @@ static void igc_ptp_time_restore(struct igc_adapter *adapter) igc_ptp_write_i225(adapter, &ts); } +static void igc_ptm_stop(struct igc_adapter *adapter) +{ + struct igc_hw *hw = &adapter->hw; + u32 ctrl; + + ctrl = rd32(IGC_PTM_CTRL); + ctrl &= ~IGC_PTM_CTRL_EN; + + wr32(IGC_PTM_CTRL, ctrl); +} + /** * igc_ptp_suspend - Disable PTP work items and prepare for suspend * @adapter: Board private structure @@ -579,7 +590,10 @@ void igc_ptp_suspend(struct igc_adapter *adapter) adapter->ptp_tx_skb = NULL; clear_bit_unlock(__IGC_PTP_TX_IN_PROGRESS, &adapter->state); - igc_ptp_time_save(adapter); + if (pci_device_is_present(adapter->pdev)) { + igc_ptp_time_save(adapter); + igc_ptm_stop(adapter); + } } /**