aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/qib/qib_qsfp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/qib/qib_qsfp.c')
-rw-r--r--drivers/infiniband/hw/qib/qib_qsfp.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/infiniband/hw/qib/qib_qsfp.c b/drivers/infiniband/hw/qib/qib_qsfp.c
index 3374a52232c1..e06c4ed383f1 100644
--- a/drivers/infiniband/hw/qib/qib_qsfp.c
+++ b/drivers/infiniband/hw/qib/qib_qsfp.c
@@ -273,18 +273,12 @@ int qib_refresh_qsfp_cache(struct qib_pportdata *ppd, struct qib_qsfp_cache *cp)
273 int ret; 273 int ret;
274 int idx; 274 int idx;
275 u16 cks; 275 u16 cks;
276 u32 mask;
277 u8 peek[4]; 276 u8 peek[4];
278 277
279 /* ensure sane contents on invalid reads, for cable swaps */ 278 /* ensure sane contents on invalid reads, for cable swaps */
280 memset(cp, 0, sizeof(*cp)); 279 memset(cp, 0, sizeof(*cp));
281 280
282 mask = QSFP_GPIO_MOD_PRS_N; 281 if (!qib_qsfp_mod_present(ppd)) {
283 if (ppd->hw_pidx)
284 mask <<= QSFP_GPIO_PORT2_SHIFT;
285
286 ret = ppd->dd->f_gpio_mod(ppd->dd, 0, 0, 0);
287 if (ret & mask) {
288 ret = -ENODEV; 282 ret = -ENODEV;
289 goto bail; 283 goto bail;
290 } 284 }
@@ -444,6 +438,19 @@ const char * const qib_qsfp_devtech[16] = {
444 438
445static const char *pwr_codes = "1.5W2.0W2.5W3.5W"; 439static const char *pwr_codes = "1.5W2.0W2.5W3.5W";
446 440
441int qib_qsfp_mod_present(struct qib_pportdata *ppd)
442{
443 u32 mask;
444 int ret;
445
446 mask = QSFP_GPIO_MOD_PRS_N <<
447 (ppd->hw_pidx * QSFP_GPIO_PORT2_SHIFT);
448 ret = ppd->dd->f_gpio_mod(ppd->dd, 0, 0, 0);
449
450 return !((ret & mask) >>
451 ((ppd->hw_pidx * QSFP_GPIO_PORT2_SHIFT) + 3));
452}
453
447/* 454/*
448 * Initialize structures that control access to QSFP. Called once per port 455 * Initialize structures that control access to QSFP. Called once per port
449 * on cards that support QSFP. 456 * on cards that support QSFP.
@@ -452,7 +459,6 @@ void qib_qsfp_init(struct qib_qsfp_data *qd,
452 void (*fevent)(struct work_struct *)) 459 void (*fevent)(struct work_struct *))
453{ 460{
454 u32 mask, highs; 461 u32 mask, highs;
455 int pins;
456 462
457 struct qib_devdata *dd = qd->ppd->dd; 463 struct qib_devdata *dd = qd->ppd->dd;
458 464
@@ -480,8 +486,7 @@ void qib_qsfp_init(struct qib_qsfp_data *qd,
480 mask <<= QSFP_GPIO_PORT2_SHIFT; 486 mask <<= QSFP_GPIO_PORT2_SHIFT;
481 487
482 /* Do not try to wait here. Better to let event handle it */ 488 /* Do not try to wait here. Better to let event handle it */
483 pins = dd->f_gpio_mod(dd, 0, 0, 0); 489 if (!qib_qsfp_mod_present(qd->ppd))
484 if (pins & mask)
485 goto bail; 490 goto bail;
486 /* We see a module, but it may be unwise to look yet. Just schedule */ 491 /* We see a module, but it may be unwise to look yet. Just schedule */
487 qd->t_insert = get_jiffies_64(); 492 qd->t_insert = get_jiffies_64();