Skip to content

Commit 5cafa48

Browse files
amd-anathjonmason
authored andcommitted
NTB: return the side info status from amd_poll_link
Bit 1 of SIDE_INFO register is an indication that the driver on the other side of link is ready. We set this bit during driver initialization sequence. So rather than having separate macros to return the status, we can simply return the status of this bit from amd_poll_link(). So a return of 1 or 0 from this function will indicate to the caller whether the driver on the other side of link is ready or not, respectively. Signed-off-by: Arindam Nath <[email protected]> Signed-off-by: Jon Mason <[email protected]>
1 parent 5c6404d commit 5cafa48

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

drivers/ntb/hw/amd/ntb_hw_amd.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ static int amd_ntb_get_link_status(struct amd_ntb_dev *ndev)
246246
static int amd_link_is_up(struct amd_ntb_dev *ndev)
247247
{
248248
if (!ndev->peer_sta)
249-
return NTB_LNK_STA_ACTIVE(ndev->cntl_sta);
249+
return ndev->cntl_sta;
250250

251251
if (ndev->peer_sta & AMD_LINK_UP_EVENT) {
252252
ndev->peer_sta = 0;
@@ -896,16 +896,15 @@ static int amd_poll_link(struct amd_ntb_dev *ndev)
896896
u32 reg;
897897

898898
reg = readl(mmio + AMD_SIDEINFO_OFFSET);
899-
reg &= NTB_LIN_STA_ACTIVE_BIT;
899+
reg &= AMD_SIDE_READY;
900900

901901
dev_dbg(&ndev->ntb.pdev->dev, "%s: reg_val = 0x%x.\n", __func__, reg);
902902

903-
if (reg == ndev->cntl_sta)
904-
return 0;
905-
906903
ndev->cntl_sta = reg;
907904

908-
return amd_ntb_get_link_status(ndev);
905+
amd_ntb_get_link_status(ndev);
906+
907+
return ndev->cntl_sta;
909908
}
910909

911910
static void amd_link_hb(struct work_struct *work)

drivers/ntb/hw/amd/ntb_hw_amd.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,8 @@
5353
#include <linux/pci.h>
5454

5555
#define AMD_LINK_HB_TIMEOUT msecs_to_jiffies(1000)
56-
#define NTB_LIN_STA_ACTIVE_BIT 0x00000002
5756
#define NTB_LNK_STA_SPEED_MASK 0x000F0000
5857
#define NTB_LNK_STA_WIDTH_MASK 0x03F00000
59-
#define NTB_LNK_STA_ACTIVE(x) (!!((x) & NTB_LIN_STA_ACTIVE_BIT))
6058
#define NTB_LNK_STA_SPEED(x) (((x) & NTB_LNK_STA_SPEED_MASK) >> 16)
6159
#define NTB_LNK_STA_WIDTH(x) (((x) & NTB_LNK_STA_WIDTH_MASK) >> 20)
6260

0 commit comments

Comments
 (0)