Lines Matching refs:ppd
50 static void sendctrl_7220_mod(struct qib_pportdata *ppd, u32 op);
749 static void qib_disarm_7220_senderrbufs(struct qib_pportdata *ppd) in qib_disarm_7220_senderrbufs() argument
752 struct qib_devdata *dd = ppd->dd; in qib_disarm_7220_senderrbufs()
777 static void qib_7220_sdma_sendctrl(struct qib_pportdata *ppd, unsigned op) in qib_7220_sdma_sendctrl() argument
779 struct qib_devdata *dd = ppd->dd; in qib_7220_sdma_sendctrl()
809 static void qib_decode_7220_sdma_errs(struct qib_pportdata *ppd, in qib_decode_7220_sdma_errs() argument
855 static void qib_7220_sdma_hw_clean_up(struct qib_pportdata *ppd) in qib_7220_sdma_hw_clean_up() argument
858 sendctrl_7220_mod(ppd, QIB_SENDCTRL_DISARM_ALL | QIB_SENDCTRL_FLUSH | in qib_7220_sdma_hw_clean_up()
860 ppd->dd->upd_pio_shadow = 1; /* update our idea of what's busy */ in qib_7220_sdma_hw_clean_up()
863 static void qib_sdma_7220_setlengen(struct qib_pportdata *ppd) in qib_sdma_7220_setlengen() argument
870 qib_write_kreg(ppd->dd, kr_senddmalengen, ppd->sdma_descq_cnt); in qib_sdma_7220_setlengen()
871 qib_write_kreg(ppd->dd, kr_senddmalengen, in qib_sdma_7220_setlengen()
872 ppd->sdma_descq_cnt | in qib_sdma_7220_setlengen()
876 static void qib_7220_sdma_hw_start_up(struct qib_pportdata *ppd) in qib_7220_sdma_hw_start_up() argument
878 qib_sdma_7220_setlengen(ppd); in qib_7220_sdma_hw_start_up()
879 qib_sdma_update_7220_tail(ppd, 0); /* Set SendDmaTail */ in qib_7220_sdma_hw_start_up()
880 ppd->sdma_head_dma[0] = 0; in qib_7220_sdma_hw_start_up()
895 static void sdma_7220_errors(struct qib_pportdata *ppd, u64 errs) in sdma_7220_errors() argument
898 struct qib_devdata *dd = ppd->dd; in sdma_7220_errors()
904 qib_decode_7220_sdma_errs(ppd, errs, msg, sizeof dd->cspec->sdmamsgbuf); in sdma_7220_errors()
905 spin_lock_irqsave(&ppd->sdma_lock, flags); in sdma_7220_errors()
914 qib_dev_err(ppd->dd, in sdma_7220_errors()
916 ppd->dd->unit, ppd->port, sbuf[2], sbuf[1], in sdma_7220_errors()
921 qib_dev_err(dd, "IB%u:%u SDmaUnexpData\n", ppd->dd->unit, in sdma_7220_errors()
922 ppd->port); in sdma_7220_errors()
924 switch (ppd->sdma_state.current_state) { in sdma_7220_errors()
943 __qib_sdma_process_event(ppd, in sdma_7220_errors()
953 __qib_sdma_process_event(ppd, in sdma_7220_errors()
958 spin_unlock_irqrestore(&ppd->sdma_lock, flags); in sdma_7220_errors()
1044 struct qib_pportdata *ppd = (struct qib_pportdata *)opaque; in reenable_7220_chase() local
1045 ppd->cpspec->chase_timer.expires = 0; in reenable_7220_chase()
1046 qib_set_ib_7220_lstate(ppd, QLOGIC_IB_IBCC_LINKCMD_DOWN, in reenable_7220_chase()
1050 static void handle_7220_chase(struct qib_pportdata *ppd, u64 ibcst) in handle_7220_chase() argument
1069 if (ppd->cpspec->chase_end && in handle_7220_chase()
1070 time_after64(tnow, ppd->cpspec->chase_end)) { in handle_7220_chase()
1071 ppd->cpspec->chase_end = 0; in handle_7220_chase()
1072 qib_set_ib_7220_lstate(ppd, in handle_7220_chase()
1075 ppd->cpspec->chase_timer.expires = jiffies + in handle_7220_chase()
1077 add_timer(&ppd->cpspec->chase_timer); in handle_7220_chase()
1078 } else if (!ppd->cpspec->chase_end) in handle_7220_chase()
1079 ppd->cpspec->chase_end = tnow + QIB_CHASE_TIME; in handle_7220_chase()
1083 ppd->cpspec->chase_end = 0; in handle_7220_chase()
1094 struct qib_pportdata *ppd = dd->pport; in handle_7220_errors() local
1110 sdma_7220_errors(ppd, errs); in handle_7220_errors()
1118 qib_disarm_7220_senderrbufs(ppd); in handle_7220_errors()
1120 !(ppd->lflags & QIBL_LINKACTIVE)) { in handle_7220_errors()
1131 !(ppd->lflags & QIBL_LINKACTIVE)) { in handle_7220_errors()
1170 if (!(ppd->lflags & QIBL_IB_AUTONEG_INPROG)) in handle_7220_errors()
1171 handle_7220_chase(ppd, ibcs); in handle_7220_errors()
1174 ppd->link_width_active = in handle_7220_errors()
1177 ppd->link_speed_active = in handle_7220_errors()
1190 qib_handle_e_ibstatuschanged(ppd, ibcs); in handle_7220_errors()
1203 qib_dev_porterr(dd, ppd->port, "%s error\n", msg); in handle_7220_errors()
1205 if (ppd->state_wanted & ppd->lflags) in handle_7220_errors()
1206 wake_up_interruptible(&ppd->state_wait); in handle_7220_errors()
1486 static void qib_set_ib_7220_lstate(struct qib_pportdata *ppd, u16 linkcmd, in qib_set_ib_7220_lstate() argument
1490 struct qib_devdata *dd = ppd->dd; in qib_set_ib_7220_lstate()
1498 spin_lock_irqsave(&ppd->lflags_lock, flags); in qib_set_ib_7220_lstate()
1499 ppd->lflags |= QIBL_IB_LINK_DISABLED; in qib_set_ib_7220_lstate()
1500 spin_unlock_irqrestore(&ppd->lflags_lock, flags); in qib_set_ib_7220_lstate()
1507 spin_lock_irqsave(&ppd->lflags_lock, flags); in qib_set_ib_7220_lstate()
1508 ppd->lflags &= ~QIBL_IB_LINK_DISABLED; in qib_set_ib_7220_lstate()
1509 spin_unlock_irqrestore(&ppd->lflags_lock, flags); in qib_set_ib_7220_lstate()
1515 qib_write_kreg(dd, kr_ibcctrl, ppd->cpspec->ibcctrl | mod_wd); in qib_set_ib_7220_lstate()
1531 static int qib_7220_bringup_serdes(struct qib_pportdata *ppd) in qib_7220_bringup_serdes() argument
1533 struct qib_devdata *dd = ppd->dd; in qib_7220_bringup_serdes()
1542 ppd->cpspec->ibdeltainprog = 1; in qib_7220_bringup_serdes()
1543 ppd->cpspec->ibsymsnap = read_7220_creg32(dd, cr_ibsymbolerr); in qib_7220_bringup_serdes()
1544 ppd->cpspec->iblnkerrsnap = in qib_7220_bringup_serdes()
1566 ibc |= ((u64)(ppd->ibmaxlen >> 2) + 1) << SYM_LSB(IBCCtrl, MaxPktLen); in qib_7220_bringup_serdes()
1567 ppd->cpspec->ibcctrl = ibc; /* without linkcmd or linkinitcmd! */ in qib_7220_bringup_serdes()
1570 val = ppd->cpspec->ibcctrl | (QLOGIC_IB_IBCC_LINKINITCMD_DISABLE << in qib_7220_bringup_serdes()
1574 if (!ppd->cpspec->ibcddrctrl) { in qib_7220_bringup_serdes()
1576 ppd->cpspec->ibcddrctrl = qib_read_kreg64(dd, kr_ibcddrctrl); in qib_7220_bringup_serdes()
1578 if (ppd->link_speed_enabled == (QIB_IB_SDR | QIB_IB_DDR)) in qib_7220_bringup_serdes()
1579 ppd->cpspec->ibcddrctrl |= in qib_7220_bringup_serdes()
1583 ppd->cpspec->ibcddrctrl |= in qib_7220_bringup_serdes()
1584 ppd->link_speed_enabled == QIB_IB_DDR ? in qib_7220_bringup_serdes()
1586 if ((ppd->link_width_enabled & (IB_WIDTH_1X | IB_WIDTH_4X)) == in qib_7220_bringup_serdes()
1588 ppd->cpspec->ibcddrctrl |= IBA7220_IBC_WIDTH_AUTONEG; in qib_7220_bringup_serdes()
1590 ppd->cpspec->ibcddrctrl |= in qib_7220_bringup_serdes()
1591 ppd->link_width_enabled == IB_WIDTH_4X ? in qib_7220_bringup_serdes()
1596 ppd->cpspec->ibcddrctrl |= in qib_7220_bringup_serdes()
1598 ppd->cpspec->ibcddrctrl |= in qib_7220_bringup_serdes()
1602 ppd->cpspec->ibcddrctrl |= IBA7220_IBC_LANE_REV_SUPPORTED; in qib_7220_bringup_serdes()
1607 qib_write_kreg(dd, kr_ibcddrctrl, ppd->cpspec->ibcddrctrl); in qib_7220_bringup_serdes()
1628 if (!ppd->guid) in qib_7220_bringup_serdes()
1629 ppd->guid = dd->base_guid; in qib_7220_bringup_serdes()
1630 guid = be64_to_cpu(ppd->guid); in qib_7220_bringup_serdes()
1647 static void qib_7220_quiet_serdes(struct qib_pportdata *ppd) in qib_7220_quiet_serdes() argument
1650 struct qib_devdata *dd = ppd->dd; in qib_7220_quiet_serdes()
1658 ppd->cpspec->chase_end = 0; in qib_7220_quiet_serdes()
1659 if (ppd->cpspec->chase_timer.data) /* if initted */ in qib_7220_quiet_serdes()
1660 del_timer_sync(&ppd->cpspec->chase_timer); in qib_7220_quiet_serdes()
1662 if (ppd->cpspec->ibsymdelta || ppd->cpspec->iblnkerrdelta || in qib_7220_quiet_serdes()
1663 ppd->cpspec->ibdeltainprog) { in qib_7220_quiet_serdes()
1671 if (ppd->cpspec->ibsymdelta || ppd->cpspec->ibdeltainprog) { in qib_7220_quiet_serdes()
1673 if (ppd->cpspec->ibdeltainprog) in qib_7220_quiet_serdes()
1674 val -= val - ppd->cpspec->ibsymsnap; in qib_7220_quiet_serdes()
1675 val -= ppd->cpspec->ibsymdelta; in qib_7220_quiet_serdes()
1678 if (ppd->cpspec->iblnkerrdelta || ppd->cpspec->ibdeltainprog) { in qib_7220_quiet_serdes()
1680 if (ppd->cpspec->ibdeltainprog) in qib_7220_quiet_serdes()
1681 val -= val - ppd->cpspec->iblnkerrsnap; in qib_7220_quiet_serdes()
1682 val -= ppd->cpspec->iblnkerrdelta; in qib_7220_quiet_serdes()
1689 qib_set_ib_7220_lstate(ppd, 0, QLOGIC_IB_IBCC_LINKINITCMD_DISABLE); in qib_7220_quiet_serdes()
1691 spin_lock_irqsave(&ppd->lflags_lock, flags); in qib_7220_quiet_serdes()
1692 ppd->lflags &= ~QIBL_IB_AUTONEG_INPROG; in qib_7220_quiet_serdes()
1693 spin_unlock_irqrestore(&ppd->lflags_lock, flags); in qib_7220_quiet_serdes()
1694 wake_up(&ppd->cpspec->autoneg_wait); in qib_7220_quiet_serdes()
1695 cancel_delayed_work_sync(&ppd->cpspec->autoneg_work); in qib_7220_quiet_serdes()
1697 shutdown_7220_relock_poll(ppd->dd); in qib_7220_quiet_serdes()
1698 val = qib_read_kreg64(ppd->dd, kr_xgxs_cfg); in qib_7220_quiet_serdes()
1700 qib_write_kreg(ppd->dd, kr_xgxs_cfg, val); in qib_7220_quiet_serdes()
1726 static void qib_setup_7220_setextled(struct qib_pportdata *ppd, u32 on) in qib_setup_7220_setextled() argument
1728 struct qib_devdata *dd = ppd->dd; in qib_setup_7220_setextled()
1739 if (ppd->led_override) { in qib_setup_7220_setextled()
1740 ltst = (ppd->led_override & QIB_LED_PHYS) ? in qib_setup_7220_setextled()
1742 lst = (ppd->led_override & QIB_LED_LOG) ? in qib_setup_7220_setextled()
1803 static void sdma_7220_intr(struct qib_pportdata *ppd, u64 istat) in sdma_7220_intr() argument
1807 spin_lock_irqsave(&ppd->sdma_lock, flags); in sdma_7220_intr()
1809 switch (ppd->sdma_state.current_state) { in sdma_7220_intr()
1814 __qib_sdma_process_event(ppd, qib_sdma_event_e20_hw_started); in sdma_7220_intr()
1827 __qib_sdma_process_event(ppd, qib_sdma_event_e60_hw_halted); in sdma_7220_intr()
1832 __qib_sdma_intr(ppd); in sdma_7220_intr()
1835 spin_unlock_irqrestore(&ppd->sdma_lock, flags); in sdma_7220_intr()
2342 static int qib_7220_get_ib_cfg(struct qib_pportdata *ppd, int which) in qib_7220_get_ib_cfg() argument
2349 ret = ppd->link_width_enabled; in qib_7220_get_ib_cfg()
2353 ret = ppd->link_width_active; in qib_7220_get_ib_cfg()
2357 ret = ppd->link_speed_enabled; in qib_7220_get_ib_cfg()
2361 ret = ppd->link_speed_active; in qib_7220_get_ib_cfg()
2375 ret = qib_read_kreg64(ppd->dd, kr_ibcddrstatus) in qib_7220_get_ib_cfg()
2380 ret = ppd->vls_operational; in qib_7220_get_ib_cfg()
2392 ret = SYM_FIELD(ppd->cpspec->ibcctrl, IBCCtrl, in qib_7220_get_ib_cfg()
2397 ret = SYM_FIELD(ppd->cpspec->ibcctrl, IBCCtrl, in qib_7220_get_ib_cfg()
2403 ret = (ppd->cpspec->ibcctrl & in qib_7220_get_ib_cfg()
2418 ret = (ppd->link_speed_active == QIB_IB_DDR); in qib_7220_get_ib_cfg()
2425 ret = (int)((ppd->cpspec->ibcddrctrl >> lsb) & maskr); in qib_7220_get_ib_cfg()
2430 static int qib_7220_set_ib_cfg(struct qib_pportdata *ppd, int which, u32 val) in qib_7220_set_ib_cfg() argument
2432 struct qib_devdata *dd = ppd->dd; in qib_7220_set_ib_cfg()
2454 ppd->link_width_enabled = val; in qib_7220_set_ib_cfg()
2455 if (!(ppd->lflags & QIBL_LINKDOWN)) in qib_7220_set_ib_cfg()
2470 spin_lock_irqsave(&ppd->lflags_lock, flags); in qib_7220_set_ib_cfg()
2471 ppd->lflags |= QIBL_IB_FORCE_NOTIFY; in qib_7220_set_ib_cfg()
2472 spin_unlock_irqrestore(&ppd->lflags_lock, flags); in qib_7220_set_ib_cfg()
2485 ppd->link_speed_enabled = val; in qib_7220_set_ib_cfg()
2486 if ((ppd->cpspec->ibcddrctrl & IBA7220_IBC_IBTA_1_2_MASK) && in qib_7220_set_ib_cfg()
2489 if (!(ppd->lflags & QIBL_LINKDOWN)) in qib_7220_set_ib_cfg()
2503 spin_lock_irqsave(&ppd->lflags_lock, flags); in qib_7220_set_ib_cfg()
2504 ppd->lflags &= ~QIBL_IB_AUTONEG_FAILED; in qib_7220_set_ib_cfg()
2505 spin_unlock_irqrestore(&ppd->lflags_lock, flags); in qib_7220_set_ib_cfg()
2527 maskr = SYM_FIELD(ppd->cpspec->ibcctrl, IBCCtrl, in qib_7220_set_ib_cfg()
2530 ppd->cpspec->ibcctrl &= in qib_7220_set_ib_cfg()
2532 ppd->cpspec->ibcctrl |= (u64) val << in qib_7220_set_ib_cfg()
2534 qib_write_kreg(dd, kr_ibcctrl, ppd->cpspec->ibcctrl); in qib_7220_set_ib_cfg()
2540 maskr = SYM_FIELD(ppd->cpspec->ibcctrl, IBCCtrl, in qib_7220_set_ib_cfg()
2543 ppd->cpspec->ibcctrl &= in qib_7220_set_ib_cfg()
2545 ppd->cpspec->ibcctrl |= (u64) val << in qib_7220_set_ib_cfg()
2547 qib_write_kreg(dd, kr_ibcctrl, ppd->cpspec->ibcctrl); in qib_7220_set_ib_cfg()
2553 maskr = (u64) ppd->pkeys[0] | ((u64) ppd->pkeys[1] << 16) | in qib_7220_set_ib_cfg()
2554 ((u64) ppd->pkeys[2] << 32) | in qib_7220_set_ib_cfg()
2555 ((u64) ppd->pkeys[3] << 48); in qib_7220_set_ib_cfg()
2562 ppd->cpspec->ibcctrl &= in qib_7220_set_ib_cfg()
2565 ppd->cpspec->ibcctrl |= in qib_7220_set_ib_cfg()
2567 qib_write_kreg(dd, kr_ibcctrl, ppd->cpspec->ibcctrl); in qib_7220_set_ib_cfg()
2579 val = (ppd->ibmaxlen >> 2) + 1; in qib_7220_set_ib_cfg()
2580 ppd->cpspec->ibcctrl &= ~SYM_MASK(IBCCtrl, MaxPktLen); in qib_7220_set_ib_cfg()
2581 ppd->cpspec->ibcctrl |= (u64)val << SYM_LSB(IBCCtrl, MaxPktLen); in qib_7220_set_ib_cfg()
2582 qib_write_kreg(dd, kr_ibcctrl, ppd->cpspec->ibcctrl); in qib_7220_set_ib_cfg()
2590 if (!ppd->cpspec->ibdeltainprog && in qib_7220_set_ib_cfg()
2592 ppd->cpspec->ibdeltainprog = 1; in qib_7220_set_ib_cfg()
2593 ppd->cpspec->ibsymsnap = in qib_7220_set_ib_cfg()
2595 ppd->cpspec->iblnkerrsnap = in qib_7220_set_ib_cfg()
2628 ppd->cpspec->chase_end = 0; in qib_7220_set_ib_cfg()
2633 if (ppd->cpspec->chase_timer.expires) { in qib_7220_set_ib_cfg()
2634 del_timer_sync(&ppd->cpspec->chase_timer); in qib_7220_set_ib_cfg()
2635 ppd->cpspec->chase_timer.expires = 0; in qib_7220_set_ib_cfg()
2645 qib_set_ib_7220_lstate(ppd, lcmd, licmd); in qib_7220_set_ib_cfg()
2661 ppd->cpspec->ibcddrctrl &= ~(maskr << lsb); in qib_7220_set_ib_cfg()
2662 ppd->cpspec->ibcddrctrl |= (((u64) val & maskr) << lsb); in qib_7220_set_ib_cfg()
2663 qib_write_kreg(dd, kr_ibcddrctrl, ppd->cpspec->ibcddrctrl); in qib_7220_set_ib_cfg()
2666 spin_lock_irqsave(&ppd->lflags_lock, flags); in qib_7220_set_ib_cfg()
2667 ppd->lflags |= QIBL_IB_FORCE_NOTIFY; in qib_7220_set_ib_cfg()
2668 spin_unlock_irqrestore(&ppd->lflags_lock, flags); in qib_7220_set_ib_cfg()
2674 static int qib_7220_set_loopback(struct qib_pportdata *ppd, const char *what) in qib_7220_set_loopback() argument
2680 ppd->cpspec->ibcctrl |= SYM_MASK(IBCCtrl, Loopback); in qib_7220_set_loopback()
2682 qib_devinfo(ppd->dd->pcidev, "Enabling IB%u:%u IBC loopback\n", in qib_7220_set_loopback()
2683 ppd->dd->unit, ppd->port); in qib_7220_set_loopback()
2685 ppd->cpspec->ibcctrl &= ~SYM_MASK(IBCCtrl, Loopback); in qib_7220_set_loopback()
2688 qib_devinfo(ppd->dd->pcidev, "Disabling IB%u:%u IBC loopback " in qib_7220_set_loopback()
2689 "(normal)\n", ppd->dd->unit, ppd->port); in qib_7220_set_loopback()
2693 qib_write_kreg(ppd->dd, kr_ibcctrl, ppd->cpspec->ibcctrl); in qib_7220_set_loopback()
2694 ddr = ppd->cpspec->ibcddrctrl & ~(IBA7220_IBC_HRTBT_MASK in qib_7220_set_loopback()
2696 ppd->cpspec->ibcddrctrl = ddr | val; in qib_7220_set_loopback()
2697 qib_write_kreg(ppd->dd, kr_ibcddrctrl, in qib_7220_set_loopback()
2698 ppd->cpspec->ibcddrctrl); in qib_7220_set_loopback()
2699 qib_write_kreg(ppd->dd, kr_scratch, 0); in qib_7220_set_loopback()
2731 static void rcvctrl_7220_mod(struct qib_pportdata *ppd, unsigned int op, in rcvctrl_7220_mod() argument
2734 struct qib_devdata *dd = ppd->dd; in rcvctrl_7220_mod()
2818 static void sendctrl_7220_mod(struct qib_pportdata *ppd, u32 op) in sendctrl_7220_mod() argument
2820 struct qib_devdata *dd = ppd->dd; in sendctrl_7220_mod()
2905 static u64 qib_portcntr_7220(struct qib_pportdata *ppd, u32 reg) in qib_portcntr_7220() argument
2908 struct qib_devdata *dd = ppd->dd; in qib_portcntr_7220()
2949 qib_devinfo(ppd->dd->pcidev, in qib_portcntr_7220()
2976 ret -= ret - ppd->cpspec->ibsymsnap; in qib_portcntr_7220()
2980 ret -= ret - ppd->cpspec->iblnkerrsnap; in qib_portcntr_7220()
3215 struct qib_pportdata *ppd = &dd->pport[port]; in qib_read_7220portcntrs() local
3227 *cntr++ = qib_portcntr_7220(ppd, in qib_read_7220portcntrs()
3250 struct qib_pportdata *ppd = dd->pport; in qib_get_7220_faststats() local
3267 traffic_wds = qib_portcntr_7220(ppd, cr_wordsend) + in qib_get_7220_faststats()
3268 qib_portcntr_7220(ppd, cr_wordrcv); in qib_get_7220_faststats()
3308 static void qib_7220_xgxs_reset(struct qib_pportdata *ppd) in qib_7220_xgxs_reset() argument
3311 struct qib_devdata *dd = ppd->dd; in qib_7220_xgxs_reset()
3339 static u32 __iomem *get_7220_link_buf(struct qib_pportdata *ppd, u32 *bnum) in get_7220_link_buf() argument
3342 u32 lbuf = ppd->dd->cspec->lastbuf_for_pio; in get_7220_link_buf()
3350 sendctrl_7220_mod(ppd->dd->pport, QIB_SENDCTRL_AVAIL_BLIP); in get_7220_link_buf()
3351 qib_read_kreg64(ppd->dd, kr_scratch); /* extra chip flush */ in get_7220_link_buf()
3352 buf = qib_getsendbuf_range(ppd->dd, bnum, lbuf, lbuf); in get_7220_link_buf()
3356 spin_lock_irqsave(&ppd->sdma_lock, flags); in get_7220_link_buf()
3357 if (ppd->sdma_state.current_state == qib_sdma_state_s20_idle && in get_7220_link_buf()
3358 ppd->sdma_state.current_state != qib_sdma_state_s00_hw_down) { in get_7220_link_buf()
3359 __qib_sdma_process_event(ppd, qib_sdma_event_e00_go_hw_down); in get_7220_link_buf()
3363 qib_7220_sdma_hw_clean_up(ppd); in get_7220_link_buf()
3365 spin_unlock_irqrestore(&ppd->sdma_lock, flags); in get_7220_link_buf()
3368 qib_read_kreg64(ppd->dd, kr_scratch); /* extra chip flush */ in get_7220_link_buf()
3369 buf = qib_getsendbuf_range(ppd->dd, bnum, lbuf, lbuf); in get_7220_link_buf()
3383 static void autoneg_7220_sendpkt(struct qib_pportdata *ppd, u32 *hdr, in autoneg_7220_sendpkt() argument
3390 struct qib_devdata *dd = ppd->dd; in autoneg_7220_sendpkt()
3395 while (!(piobuf = get_7220_link_buf(ppd, &pnum))) { in autoneg_7220_sendpkt()
3418 static void autoneg_7220_send(struct qib_pportdata *ppd, int which) in autoneg_7220_send() argument
3420 struct qib_devdata *dd = ppd->dd; in autoneg_7220_send()
3454 autoneg_7220_sendpkt(ppd, hdr, dcnt, data); in autoneg_7220_send()
3457 autoneg_7220_sendpkt(ppd, hdr, dcnt, data); in autoneg_7220_send()
3476 static void set_7220_ibspeed_fast(struct qib_pportdata *ppd, u32 speed) in set_7220_ibspeed_fast() argument
3478 ppd->cpspec->ibcddrctrl &= ~(IBA7220_IBC_SPEED_AUTONEG_MASK | in set_7220_ibspeed_fast()
3482 ppd->cpspec->ibcddrctrl |= IBA7220_IBC_SPEED_AUTONEG_MASK | in set_7220_ibspeed_fast()
3485 ppd->cpspec->ibcddrctrl |= speed == QIB_IB_DDR ? in set_7220_ibspeed_fast()
3488 qib_write_kreg(ppd->dd, kr_ibcddrctrl, ppd->cpspec->ibcddrctrl); in set_7220_ibspeed_fast()
3489 qib_write_kreg(ppd->dd, kr_scratch, 0); in set_7220_ibspeed_fast()
3498 static void try_7220_autoneg(struct qib_pportdata *ppd) in try_7220_autoneg() argument
3507 qib_write_kreg(ppd->dd, kr_ncmodectrl, 0x3b9dc07); in try_7220_autoneg()
3509 spin_lock_irqsave(&ppd->lflags_lock, flags); in try_7220_autoneg()
3510 ppd->lflags |= QIBL_IB_AUTONEG_INPROG; in try_7220_autoneg()
3511 spin_unlock_irqrestore(&ppd->lflags_lock, flags); in try_7220_autoneg()
3512 autoneg_7220_send(ppd, 0); in try_7220_autoneg()
3513 set_7220_ibspeed_fast(ppd, QIB_IB_DDR); in try_7220_autoneg()
3515 toggle_7220_rclkrls(ppd->dd); in try_7220_autoneg()
3517 queue_delayed_work(ib_wq, &ppd->cpspec->autoneg_work, in try_7220_autoneg()
3527 struct qib_pportdata *ppd; in autoneg_7220_work() local
3533 ppd = &container_of(work, struct qib_chippport_specific, in autoneg_7220_work()
3535 dd = ppd->dd; in autoneg_7220_work()
3544 if (SYM_FIELD(ppd->lastibcstat, IBCStatus, LinkTrainingState) in autoneg_7220_work()
3546 qib_set_linkstate(ppd, QIB_IB_LINKDOWN_DISABLE); in autoneg_7220_work()
3552 if (!(ppd->lflags & QIBL_IB_AUTONEG_INPROG)) in autoneg_7220_work()
3556 if (wait_event_timeout(ppd->cpspec->autoneg_wait, in autoneg_7220_work()
3557 !(ppd->lflags & QIBL_IB_AUTONEG_INPROG), in autoneg_7220_work()
3564 if (wait_event_timeout(ppd->cpspec->autoneg_wait, in autoneg_7220_work()
3565 !(ppd->lflags & QIBL_IB_AUTONEG_INPROG), in autoneg_7220_work()
3569 set_7220_ibspeed_fast(ppd, QIB_IB_SDR); in autoneg_7220_work()
3576 wait_event_timeout(ppd->cpspec->autoneg_wait, in autoneg_7220_work()
3577 !(ppd->lflags & QIBL_IB_AUTONEG_INPROG), in autoneg_7220_work()
3580 if (ppd->lflags & QIBL_IB_AUTONEG_INPROG) { in autoneg_7220_work()
3581 spin_lock_irqsave(&ppd->lflags_lock, flags); in autoneg_7220_work()
3582 ppd->lflags &= ~QIBL_IB_AUTONEG_INPROG; in autoneg_7220_work()
3584 ppd->lflags |= QIBL_IB_AUTONEG_FAILED; in autoneg_7220_work()
3587 spin_unlock_irqrestore(&ppd->lflags_lock, flags); in autoneg_7220_work()
3588 set_7220_ibspeed_fast(ppd, ppd->link_speed_enabled); in autoneg_7220_work()
3623 static int qib_7220_ib_updown(struct qib_pportdata *ppd, int ibup, u64 ibcs) in qib_7220_ib_updown() argument
3626 struct qib_devdata *dd = ppd->dd; in qib_7220_ib_updown()
3629 spin_lock_irqsave(&ppd->lflags_lock, flags); in qib_7220_ib_updown()
3630 ppd->lflags &= ~QIBL_IB_FORCE_NOTIFY; in qib_7220_ib_updown()
3631 spin_unlock_irqrestore(&ppd->lflags_lock, flags); in qib_7220_ib_updown()
3639 if (!(ppd->lflags & (QIBL_IB_AUTONEG_FAILED | in qib_7220_ib_updown()
3641 set_7220_ibspeed_fast(ppd, ppd->link_speed_enabled); in qib_7220_ib_updown()
3642 if (!(ppd->lflags & QIBL_IB_AUTONEG_INPROG)) { in qib_7220_ib_updown()
3644 qib_cancel_sends(ppd); /* initial disarm, etc. */ in qib_7220_ib_updown()
3645 spin_lock_irqsave(&ppd->sdma_lock, flags); in qib_7220_ib_updown()
3646 if (__qib_sdma_running(ppd)) in qib_7220_ib_updown()
3647 __qib_sdma_process_event(ppd, in qib_7220_ib_updown()
3649 spin_unlock_irqrestore(&ppd->sdma_lock, flags); in qib_7220_ib_updown()
3655 !(ppd->lflags & (QIBL_IB_AUTONEG_FAILED | in qib_7220_ib_updown()
3657 ppd->link_speed_active == QIB_IB_SDR && in qib_7220_ib_updown()
3658 (ppd->link_speed_enabled & (QIB_IB_DDR | QIB_IB_SDR)) == in qib_7220_ib_updown()
3663 if (!ppd->cpspec->ibdeltainprog) { in qib_7220_ib_updown()
3664 ppd->cpspec->ibdeltainprog = 1; in qib_7220_ib_updown()
3665 ppd->cpspec->ibsymsnap = read_7220_creg32(dd, in qib_7220_ib_updown()
3667 ppd->cpspec->iblnkerrsnap = read_7220_creg32(dd, in qib_7220_ib_updown()
3670 try_7220_autoneg(ppd); in qib_7220_ib_updown()
3672 } else if ((ppd->lflags & QIBL_IB_AUTONEG_INPROG) && in qib_7220_ib_updown()
3673 ppd->link_speed_active == QIB_IB_SDR) { in qib_7220_ib_updown()
3674 autoneg_7220_send(ppd, 1); in qib_7220_ib_updown()
3675 set_7220_ibspeed_fast(ppd, QIB_IB_DDR); in qib_7220_ib_updown()
3680 if ((ppd->lflags & QIBL_IB_AUTONEG_INPROG) && in qib_7220_ib_updown()
3681 (ppd->link_speed_active & QIB_IB_DDR)) { in qib_7220_ib_updown()
3682 spin_lock_irqsave(&ppd->lflags_lock, flags); in qib_7220_ib_updown()
3683 ppd->lflags &= ~(QIBL_IB_AUTONEG_INPROG | in qib_7220_ib_updown()
3685 spin_unlock_irqrestore(&ppd->lflags_lock, in qib_7220_ib_updown()
3689 set_7220_ibspeed_fast(ppd, in qib_7220_ib_updown()
3690 ppd->link_speed_enabled); in qib_7220_ib_updown()
3691 wake_up(&ppd->cpspec->autoneg_wait); in qib_7220_ib_updown()
3693 } else if (ppd->lflags & QIBL_IB_AUTONEG_FAILED) { in qib_7220_ib_updown()
3700 spin_lock_irqsave(&ppd->lflags_lock, flags); in qib_7220_ib_updown()
3701 ppd->lflags &= ~QIBL_IB_AUTONEG_FAILED; in qib_7220_ib_updown()
3702 spin_unlock_irqrestore(&ppd->lflags_lock, in qib_7220_ib_updown()
3704 ppd->cpspec->ibcddrctrl |= in qib_7220_ib_updown()
3711 if (!(ppd->lflags & QIBL_IB_AUTONEG_INPROG)) in qib_7220_ib_updown()
3715 ppd->delay_mult = rate_to_delay in qib_7220_ib_updown()
3720 spin_lock_irqsave(&ppd->sdma_lock, flags); in qib_7220_ib_updown()
3726 if (ppd->sdma_state.current_state != in qib_7220_ib_updown()
3728 __qib_sdma_process_event(ppd, in qib_7220_ib_updown()
3730 spin_unlock_irqrestore(&ppd->sdma_lock, flags); in qib_7220_ib_updown()
3735 if (ppd->cpspec->ibdeltainprog) { in qib_7220_ib_updown()
3736 ppd->cpspec->ibdeltainprog = 0; in qib_7220_ib_updown()
3737 ppd->cpspec->ibsymdelta += read_7220_creg32(ppd->dd, in qib_7220_ib_updown()
3738 cr_ibsymbolerr) - ppd->cpspec->ibsymsnap; in qib_7220_ib_updown()
3739 ppd->cpspec->iblnkerrdelta += read_7220_creg32(ppd->dd, in qib_7220_ib_updown()
3740 cr_iblinkerrrecov) - ppd->cpspec->iblnkerrsnap; in qib_7220_ib_updown()
3743 !ppd->cpspec->ibdeltainprog && in qib_7220_ib_updown()
3744 !(ppd->lflags & QIBL_IB_AUTONEG_INPROG)) { in qib_7220_ib_updown()
3745 ppd->cpspec->ibdeltainprog = 1; in qib_7220_ib_updown()
3746 ppd->cpspec->ibsymsnap = read_7220_creg32(ppd->dd, in qib_7220_ib_updown()
3748 ppd->cpspec->iblnkerrsnap = read_7220_creg32(ppd->dd, in qib_7220_ib_updown()
3753 qib_setup_7220_setextled(ppd, ibup); in qib_7220_ib_updown()
3974 struct qib_pportdata *ppd; in qib_init_7220_variables() local
3979 ppd = &cpspec->pportdata; in qib_init_7220_variables()
3980 dd->pport = ppd; in qib_init_7220_variables()
3984 ppd->cpspec = cpspec; in qib_init_7220_variables()
4035 qib_init_pportdata(ppd, dd, 0, 1); in qib_init_7220_variables()
4036 ppd->link_width_supported = IB_WIDTH_1X | IB_WIDTH_4X; in qib_init_7220_variables()
4037 ppd->link_speed_supported = QIB_IB_SDR | QIB_IB_DDR; in qib_init_7220_variables()
4039 ppd->link_width_enabled = ppd->link_width_supported; in qib_init_7220_variables()
4040 ppd->link_speed_enabled = ppd->link_speed_supported; in qib_init_7220_variables()
4045 ppd->link_width_active = IB_WIDTH_4X; in qib_init_7220_variables()
4046 ppd->link_speed_active = QIB_IB_SDR; in qib_init_7220_variables()
4047 ppd->delay_mult = rate_to_delay[0][1]; in qib_init_7220_variables()
4048 ppd->vls_supported = IB_VL_VL0; in qib_init_7220_variables()
4049 ppd->vls_operational = ppd->vls_supported; in qib_init_7220_variables()
4054 init_timer(&ppd->cpspec->chase_timer); in qib_init_7220_variables()
4055 ppd->cpspec->chase_timer.function = reenable_7220_chase; in qib_init_7220_variables()
4056 ppd->cpspec->chase_timer.data = (unsigned long)ppd; in qib_init_7220_variables()
4160 static u32 __iomem *qib_7220_getsendbuf(struct qib_pportdata *ppd, u64 pbc, in qib_7220_getsendbuf() argument
4164 struct qib_devdata *dd = ppd->dd; in qib_7220_getsendbuf()
4168 !(ppd->lflags & (QIBL_IB_AUTONEG_INPROG | QIBL_LINKACTIVE))) in qib_7220_getsendbuf()
4169 buf = get_7220_link_buf(ppd, pbufnum); in qib_7220_getsendbuf()
4183 static void qib_set_cntr_7220_sample(struct qib_pportdata *ppd, u32 intv, in qib_set_cntr_7220_sample() argument
4186 write_7220_creg(ppd->dd, cr_psinterval, intv); in qib_set_cntr_7220_sample()
4187 write_7220_creg(ppd->dd, cr_psstart, start); in qib_set_cntr_7220_sample()
4197 static void qib_sdma_update_7220_tail(struct qib_pportdata *ppd, u16 tail) in qib_sdma_update_7220_tail() argument
4201 ppd->sdma_descq_tail = tail; in qib_sdma_update_7220_tail()
4202 qib_write_kreg(ppd->dd, kr_senddmatail, tail); in qib_sdma_update_7220_tail()
4205 static void qib_sdma_set_7220_desc_cnt(struct qib_pportdata *ppd, unsigned cnt) in qib_sdma_set_7220_desc_cnt() argument
4249 static void qib_7220_sdma_init_early(struct qib_pportdata *ppd) in qib_7220_sdma_init_early() argument
4251 ppd->sdma_state.set_state_action = sdma_7220_action_table; in qib_7220_sdma_init_early()
4254 static int init_sdma_7220_regs(struct qib_pportdata *ppd) in init_sdma_7220_regs() argument
4256 struct qib_devdata *dd = ppd->dd; in init_sdma_7220_regs()
4261 qib_write_kreg(dd, kr_senddmabase, ppd->sdma_descq_phys); in init_sdma_7220_regs()
4262 qib_sdma_7220_setlengen(ppd); in init_sdma_7220_regs()
4263 qib_sdma_update_7220_tail(ppd, 0); /* Set SendDmaTail */ in init_sdma_7220_regs()
4265 qib_write_kreg(dd, kr_senddmaheadaddr, ppd->sdma_head_phys); in init_sdma_7220_regs()
4285 ppd->sdma_state.first_sendbuf = i; in init_sdma_7220_regs()
4286 ppd->sdma_state.last_sendbuf = n; in init_sdma_7220_regs()
4292 static u16 qib_sdma_7220_gethead(struct qib_pportdata *ppd) in qib_sdma_7220_gethead() argument
4294 struct qib_devdata *dd = ppd->dd; in qib_sdma_7220_gethead()
4302 use_dmahead = __qib_sdma_running(ppd) && in qib_sdma_7220_gethead()
4306 (u16)le64_to_cpu(*ppd->sdma_head_dma) : in qib_sdma_7220_gethead()
4309 swhead = ppd->sdma_descq_head; in qib_sdma_7220_gethead()
4310 swtail = ppd->sdma_descq_tail; in qib_sdma_7220_gethead()
4311 cnt = ppd->sdma_descq_cnt; in qib_sdma_7220_gethead()
4338 static int qib_sdma_7220_busy(struct qib_pportdata *ppd) in qib_sdma_7220_busy() argument
4340 u64 hwstatus = qib_read_kreg64(ppd->dd, kr_senddmastatus); in qib_sdma_7220_busy()
4356 static u32 qib_7220_setpbc_control(struct qib_pportdata *ppd, u32 plen, in qib_7220_setpbc_control() argument
4359 u8 snd_mult = ppd->delay_mult; in qib_7220_setpbc_control()
4361 u32 ret = ppd->cpspec->last_delay_mult; in qib_7220_setpbc_control()
4363 ppd->cpspec->last_delay_mult = (rcv_mult > snd_mult) ? in qib_7220_setpbc_control()