summaryrefslogtreecommitdiffstats
path: root/drivers/thunderbolt/nhi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/thunderbolt/nhi.c')
-rw-r--r--drivers/thunderbolt/nhi.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
index 11070ff2cec7..d2b9ce857818 100644
--- a/drivers/thunderbolt/nhi.c
+++ b/drivers/thunderbolt/nhi.c
@@ -16,6 +16,7 @@
16 16
17#include "nhi.h" 17#include "nhi.h"
18#include "nhi_regs.h" 18#include "nhi_regs.h"
19#include "tb.h"
19 20
20#define RING_TYPE(ring) ((ring)->is_tx ? "TX ring" : "RX ring") 21#define RING_TYPE(ring) ((ring)->is_tx ? "TX ring" : "RX ring")
21 22
@@ -517,6 +518,7 @@ static void nhi_shutdown(struct tb_nhi *nhi)
517static int nhi_probe(struct pci_dev *pdev, const struct pci_device_id *id) 518static int nhi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
518{ 519{
519 struct tb_nhi *nhi; 520 struct tb_nhi *nhi;
521 struct tb *tb;
520 int res; 522 int res;
521 523
522 res = pcim_enable_device(pdev); 524 res = pcim_enable_device(pdev);
@@ -575,14 +577,26 @@ static int nhi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
575 /* magic value - clock related? */ 577 /* magic value - clock related? */
576 iowrite32(3906250 / 10000, nhi->iobase + 0x38c00); 578 iowrite32(3906250 / 10000, nhi->iobase + 0x38c00);
577 579
578 pci_set_drvdata(pdev, nhi); 580 dev_info(&nhi->pdev->dev, "NHI initialized, starting thunderbolt\n");
581 tb = thunderbolt_alloc_and_start(nhi);
582 if (!tb) {
583 /*
584 * At this point the RX/TX rings might already have been
585 * activated. Do a proper shutdown.
586 */
587 nhi_shutdown(nhi);
588 return -EIO;
589 }
590 pci_set_drvdata(pdev, tb);
579 591
580 return 0; 592 return 0;
581} 593}
582 594
583static void nhi_remove(struct pci_dev *pdev) 595static void nhi_remove(struct pci_dev *pdev)
584{ 596{
585 struct tb_nhi *nhi = pci_get_drvdata(pdev); 597 struct tb *tb = pci_get_drvdata(pdev);
598 struct tb_nhi *nhi = tb->nhi;
599 thunderbolt_shutdown_and_free(tb);
586 nhi_shutdown(nhi); 600 nhi_shutdown(nhi);
587} 601}
588 602