aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/qib/qib_iba7322.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/qib/qib_iba7322.c')
-rw-r--r--drivers/infiniband/hw/qib/qib_iba7322.c120
1 files changed, 77 insertions, 43 deletions
diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c
index 708f4fea6afa..86575fbcaef7 100644
--- a/drivers/infiniband/hw/qib/qib_iba7322.c
+++ b/drivers/infiniband/hw/qib/qib_iba7322.c
@@ -2381,17 +2381,17 @@ static int qib_7322_bringup_serdes(struct qib_pportdata *ppd)
2381 ppd->cpspec->ibcctrl_a |= SYM_MASK(IBCCtrlA_0, IBLinkEn); 2381 ppd->cpspec->ibcctrl_a |= SYM_MASK(IBCCtrlA_0, IBLinkEn);
2382 set_vls(ppd); 2382 set_vls(ppd);
2383 2383
2384 /* Hold the link state machine for mezz boards */
2385 qib_set_ib_7322_lstate(ppd, 0,
2386 QLOGIC_IB_IBCC_LINKINITCMD_DISABLE);
2387
2388
2384 /* be paranoid against later code motion, etc. */ 2389 /* be paranoid against later code motion, etc. */
2385 spin_lock_irqsave(&dd->cspec->rcvmod_lock, flags); 2390 spin_lock_irqsave(&dd->cspec->rcvmod_lock, flags);
2386 ppd->p_rcvctrl |= SYM_MASK(RcvCtrl_0, RcvIBPortEnable); 2391 ppd->p_rcvctrl |= SYM_MASK(RcvCtrl_0, RcvIBPortEnable);
2387 qib_write_kreg_port(ppd, krp_rcvctrl, ppd->p_rcvctrl); 2392 qib_write_kreg_port(ppd, krp_rcvctrl, ppd->p_rcvctrl);
2388 spin_unlock_irqrestore(&dd->cspec->rcvmod_lock, flags); 2393 spin_unlock_irqrestore(&dd->cspec->rcvmod_lock, flags);
2389 2394
2390 /* Hold the link state machine for mezz boards */
2391 if (IS_QMH(dd) || IS_QME(dd))
2392 qib_set_ib_7322_lstate(ppd, 0,
2393 QLOGIC_IB_IBCC_LINKINITCMD_DISABLE);
2394
2395 /* Also enable IBSTATUSCHG interrupt. */ 2395 /* Also enable IBSTATUSCHG interrupt. */
2396 val = qib_read_kreg_port(ppd, krp_errmask); 2396 val = qib_read_kreg_port(ppd, krp_errmask);
2397 qib_write_kreg_port(ppd, krp_errmask, 2397 qib_write_kreg_port(ppd, krp_errmask,
@@ -5229,6 +5229,8 @@ static int qib_7322_ib_updown(struct qib_pportdata *ppd, int ibup, u64 ibcs)
5229 QIBL_IB_AUTONEG_INPROG))) 5229 QIBL_IB_AUTONEG_INPROG)))
5230 set_7322_ibspeed_fast(ppd, ppd->link_speed_enabled); 5230 set_7322_ibspeed_fast(ppd, ppd->link_speed_enabled);
5231 if (!(ppd->lflags & QIBL_IB_AUTONEG_INPROG)) { 5231 if (!(ppd->lflags & QIBL_IB_AUTONEG_INPROG)) {
5232 struct qib_qsfp_data *qd =
5233 &ppd->cpspec->qsfp_data;
5232 /* unlock the Tx settings, speed may change */ 5234 /* unlock the Tx settings, speed may change */
5233 qib_write_kreg_port(ppd, krp_tx_deemph_override, 5235 qib_write_kreg_port(ppd, krp_tx_deemph_override,
5234 SYM_MASK(IBSD_TX_DEEMPHASIS_OVERRIDE_0, 5236 SYM_MASK(IBSD_TX_DEEMPHASIS_OVERRIDE_0,
@@ -5236,6 +5238,12 @@ static int qib_7322_ib_updown(struct qib_pportdata *ppd, int ibup, u64 ibcs)
5236 qib_cancel_sends(ppd); 5238 qib_cancel_sends(ppd);
5237 /* on link down, ensure sane pcs state */ 5239 /* on link down, ensure sane pcs state */
5238 qib_7322_mini_pcs_reset(ppd); 5240 qib_7322_mini_pcs_reset(ppd);
5241 /* schedule the qsfp refresh which should turn the link
5242 off */
5243 if (ppd->dd->flags & QIB_HAS_QSFP) {
5244 qd->t_insert = get_jiffies_64();
5245 schedule_work(&qd->work);
5246 }
5239 spin_lock_irqsave(&ppd->sdma_lock, flags); 5247 spin_lock_irqsave(&ppd->sdma_lock, flags);
5240 if (__qib_sdma_running(ppd)) 5248 if (__qib_sdma_running(ppd))
5241 __qib_sdma_process_event(ppd, 5249 __qib_sdma_process_event(ppd,
@@ -5591,38 +5599,62 @@ static void qsfp_7322_event(struct work_struct *work)
5591 5599
5592 qd = container_of(work, struct qib_qsfp_data, work); 5600 qd = container_of(work, struct qib_qsfp_data, work);
5593 ppd = qd->ppd; 5601 ppd = qd->ppd;
5594 pwrup = qd->t_insert + msecs_to_jiffies(QSFP_PWR_LAG_MSEC); 5602 pwrup = qd->t_insert +
5603 msecs_to_jiffies(QSFP_PWR_LAG_MSEC - QSFP_MODPRS_LAG_MSEC);
5595 5604
5596 /* 5605 /* Delay for 20 msecs to allow ModPrs resistor to setup */
5597 * Some QSFP's not only do not respond until the full power-up 5606 mdelay(QSFP_MODPRS_LAG_MSEC);
5598 * time, but may behave badly if we try. So hold off responding 5607
5599 * to insertion. 5608 if (!qib_qsfp_mod_present(ppd))
5600 */ 5609 /* Set the physical link to disabled */
5601 while (1) { 5610 qib_set_ib_7322_lstate(ppd, 0,
5602 u64 now = get_jiffies_64(); 5611 QLOGIC_IB_IBCC_LINKINITCMD_DISABLE);
5603 if (time_after64(now, pwrup)) 5612 else {
5604 break; 5613 /*
5605 msleep(20); 5614 * Some QSFP's not only do not respond until the full power-up
5606 } 5615 * time, but may behave badly if we try. So hold off responding
5607 ret = qib_refresh_qsfp_cache(ppd, &qd->cache); 5616 * to insertion.
5608 /* 5617 */
5609 * Need to change LE2 back to defaults if we couldn't 5618 while (1) {
5610 * read the cable type (to handle cable swaps), so do this 5619 u64 now = get_jiffies_64();
5611 * even on failure to read cable information. We don't 5620 if (time_after64(now, pwrup))
5612 * get here for QME, so IS_QME check not needed here. 5621 break;
5613 */ 5622 msleep(20);
5614 if (!ret && !ppd->dd->cspec->r1) { 5623 }
5615 if (QSFP_IS_ACTIVE_FAR(qd->cache.tech)) 5624
5616 le2 = LE2_QME; 5625 ret = qib_refresh_qsfp_cache(ppd, &qd->cache);
5617 else if (qd->cache.atten[1] >= qib_long_atten && 5626
5618 QSFP_IS_CU(qd->cache.tech)) 5627 /*
5619 le2 = LE2_5m; 5628 * Need to change LE2 back to defaults if we couldn't
5620 else 5629 * read the cable type (to handle cable swaps), so do this
5630 * even on failure to read cable information. We don't
5631 * get here for QME, so IS_QME check not needed here.
5632 */
5633 if (!ret && !ppd->dd->cspec->r1) {
5634 if (QSFP_IS_ACTIVE_FAR(qd->cache.tech))
5635 le2 = LE2_QME;
5636 else if (qd->cache.atten[1] >= qib_long_atten &&
5637 QSFP_IS_CU(qd->cache.tech))
5638 le2 = LE2_5m;
5639 else
5640 le2 = LE2_DEFAULT;
5641 } else
5621 le2 = LE2_DEFAULT; 5642 le2 = LE2_DEFAULT;
5622 } else 5643 ibsd_wr_allchans(ppd, 13, (le2 << 7), BMASK(9, 7));
5623 le2 = LE2_DEFAULT; 5644 /*
5624 ibsd_wr_allchans(ppd, 13, (le2 << 7), BMASK(9, 7)); 5645 * We always change parameteters, since we can choose
5625 init_txdds_table(ppd, 0); 5646 * values for cables without eeproms, and the cable may have
5647 * changed from a cable with full or partial eeprom content
5648 * to one with partial or no content.
5649 */
5650 init_txdds_table(ppd, 0);
5651 /* The physical link is being re-enabled only when the
5652 previous state was DISABLED. This should only happen when
5653 the cable has been physically pulled. */
5654 if (ppd->lflags & QIBL_IB_LINK_DISABLED)
5655 qib_set_ib_7322_lstate(ppd, 0,
5656 QLOGIC_IB_IBCC_LINKINITCMD_SLEEP);
5657 }
5626} 5658}
5627 5659
5628/* 5660/*
@@ -5726,7 +5758,8 @@ static void set_no_qsfp_atten(struct qib_devdata *dd, int change)
5726 /* now change the IBC and serdes, overriding generic */ 5758 /* now change the IBC and serdes, overriding generic */
5727 init_txdds_table(ppd, 1); 5759 init_txdds_table(ppd, 1);
5728 /* Re-enable the physical state machine on mezz boards 5760 /* Re-enable the physical state machine on mezz boards
5729 * now that the correct settings have been set. */ 5761 * now that the correct settings have been set.
5762 * QSFP boards are handles by the QSFP event handler */
5730 if (IS_QMH(dd) || IS_QME(dd)) 5763 if (IS_QMH(dd) || IS_QME(dd))
5731 qib_set_ib_7322_lstate(ppd, 0, 5764 qib_set_ib_7322_lstate(ppd, 0,
5732 QLOGIC_IB_IBCC_LINKINITCMD_SLEEP); 5765 QLOGIC_IB_IBCC_LINKINITCMD_SLEEP);
@@ -7148,7 +7181,8 @@ static void find_best_ent(struct qib_pportdata *ppd,
7148 } 7181 }
7149 } 7182 }
7150 7183
7151 /* Lookup serdes setting by cable type and attenuation */ 7184 /* Active cables don't have attenuation so we only set SERDES
7185 * settings to account for the attenuation of the board traces. */
7152 if (!override && QSFP_IS_ACTIVE(qd->tech)) { 7186 if (!override && QSFP_IS_ACTIVE(qd->tech)) {
7153 *sdr_dds = txdds_sdr + ppd->dd->board_atten; 7187 *sdr_dds = txdds_sdr + ppd->dd->board_atten;
7154 *ddr_dds = txdds_ddr + ppd->dd->board_atten; 7188 *ddr_dds = txdds_ddr + ppd->dd->board_atten;
@@ -7465,12 +7499,6 @@ static int serdes_7322_init_new(struct qib_pportdata *ppd)
7465 u32 le_val, rxcaldone; 7499 u32 le_val, rxcaldone;
7466 int chan, chan_done = (1 << SERDES_CHANS) - 1; 7500 int chan, chan_done = (1 << SERDES_CHANS) - 1;
7467 7501
7468 /*
7469 * Initialize the Tx DDS tables. Also done every QSFP event,
7470 * for adapters with QSFP
7471 */
7472 init_txdds_table(ppd, 0);
7473
7474 /* Clear cmode-override, may be set from older driver */ 7502 /* Clear cmode-override, may be set from older driver */
7475 ahb_mod(ppd->dd, IBSD(ppd->hw_pidx), 5, 10, 0 << 14, 1 << 14); 7503 ahb_mod(ppd->dd, IBSD(ppd->hw_pidx), 5, 10, 0 << 14, 1 << 14);
7476 7504
@@ -7656,6 +7684,12 @@ static int serdes_7322_init_new(struct qib_pportdata *ppd)
7656 /* VGA output common mode */ 7684 /* VGA output common mode */
7657 ibsd_wr_allchans(ppd, 12, (3 << 2), BMASK(3, 2)); 7685 ibsd_wr_allchans(ppd, 12, (3 << 2), BMASK(3, 2));
7658 7686
7687 /*
7688 * Initialize the Tx DDS tables. Also done every QSFP event,
7689 * for adapters with QSFP
7690 */
7691 init_txdds_table(ppd, 0);
7692
7659 return 0; 7693 return 0;
7660} 7694}
7661 7695