aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ntb
diff options
context:
space:
mode:
authorJon Mason <jon.mason@intel.com>2013-09-13 20:05:23 -0400
committerJon Mason <jon.mason@intel.com>2013-11-20 11:57:31 -0500
commit9fec60c41416c9c40ec520bb79064345d2396632 (patch)
tree5196b6e6ad2899a1f8055e38cfe6cd76d3634462 /drivers/ntb
parentc529aa30337b928bd6bc34293608cb3d4505856e (diff)
NTB: Fix NTB-RP Link Up
The Xeon NTB-RP setup, the transparent side does not get a link up/down interrupt. Since the presence of a NTB device on the transparent side means that we have a NTB link up, we can work around the lack of an interrupt by simply calling the link up function to notify the upper layers. Signed-off-by: Jon Mason <jon.mason@intel.com>
Diffstat (limited to 'drivers/ntb')
-rw-r--r--drivers/ntb/ntb_hw.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/drivers/ntb/ntb_hw.c b/drivers/ntb/ntb_hw.c
index 6c9d73348735..a9b065f3973a 100644
--- a/drivers/ntb/ntb_hw.c
+++ b/drivers/ntb/ntb_hw.c
@@ -1296,6 +1296,32 @@ static void ntb_free_debugfs(struct ntb_device *ndev)
1296 } 1296 }
1297} 1297}
1298 1298
1299static void ntb_hw_link_up(struct ntb_device *ndev)
1300{
1301 if (ndev->conn_type == NTB_CONN_TRANSPARENT)
1302 ntb_link_event(ndev, NTB_LINK_UP);
1303 else
1304 /* Let's bring the NTB link up */
1305 writel(NTB_CNTL_BAR23_SNOOP | NTB_CNTL_BAR45_SNOOP,
1306 ndev->reg_ofs.lnk_cntl);
1307}
1308
1309static void ntb_hw_link_down(struct ntb_device *ndev)
1310{
1311 u32 ntb_cntl;
1312
1313 if (ndev->conn_type == NTB_CONN_TRANSPARENT) {
1314 ntb_link_event(ndev, NTB_LINK_DOWN);
1315 return;
1316 }
1317
1318 /* Bring NTB link down */
1319 ntb_cntl = readl(ndev->reg_ofs.lnk_cntl);
1320 ntb_cntl &= ~(NTB_CNTL_BAR23_SNOOP | NTB_CNTL_BAR45_SNOOP);
1321 ntb_cntl |= NTB_CNTL_LINK_DISABLE;
1322 writel(ntb_cntl, ndev->reg_ofs.lnk_cntl);
1323}
1324
1299static int ntb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) 1325static int ntb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1300{ 1326{
1301 struct ntb_device *ndev; 1327 struct ntb_device *ndev;
@@ -1384,9 +1410,7 @@ static int ntb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1384 if (rc) 1410 if (rc)
1385 goto err6; 1411 goto err6;
1386 1412
1387 /* Let's bring the NTB link up */ 1413 ntb_hw_link_up(ndev);
1388 writel(NTB_CNTL_BAR23_SNOOP | NTB_CNTL_BAR45_SNOOP,
1389 ndev->reg_ofs.lnk_cntl);
1390 1414
1391 return 0; 1415 return 0;
1392 1416
@@ -1416,12 +1440,8 @@ static void ntb_pci_remove(struct pci_dev *pdev)
1416{ 1440{
1417 struct ntb_device *ndev = pci_get_drvdata(pdev); 1441 struct ntb_device *ndev = pci_get_drvdata(pdev);
1418 int i; 1442 int i;
1419 u32 ntb_cntl;
1420 1443
1421 /* Bring NTB link down */ 1444 ntb_hw_link_down(ndev);
1422 ntb_cntl = readl(ndev->reg_ofs.lnk_cntl);
1423 ntb_cntl |= NTB_CNTL_LINK_DISABLE;
1424 writel(ntb_cntl, ndev->reg_ofs.lnk_cntl);
1425 1445
1426 ntb_transport_free(ndev->ntb_transport); 1446 ntb_transport_free(ndev->ntb_transport);
1427 1447