|
@@ -1618,77 +1618,6 @@ bail:
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-int ipath_waitfor_complete(struct ipath_devdata *dd, ipath_kreg reg_id,
|
|
|
- u64 bits_to_wait_for, u64 * valp)
|
|
|
-{
|
|
|
- unsigned long timeout;
|
|
|
- u64 lastval, val;
|
|
|
- int ret;
|
|
|
-
|
|
|
- lastval = ipath_read_kreg64(dd, reg_id);
|
|
|
- /* wait a ridiculously long time */
|
|
|
- timeout = jiffies + msecs_to_jiffies(5);
|
|
|
- do {
|
|
|
- val = ipath_read_kreg64(dd, reg_id);
|
|
|
- /* set so they have something, even on failures. */
|
|
|
- *valp = val;
|
|
|
- if ((val & bits_to_wait_for) == bits_to_wait_for) {
|
|
|
- ret = 0;
|
|
|
- break;
|
|
|
- }
|
|
|
- if (val != lastval)
|
|
|
- ipath_cdbg(VERBOSE, "Changed from %llx to %llx, "
|
|
|
- "waiting for %llx bits\n",
|
|
|
- (unsigned long long) lastval,
|
|
|
- (unsigned long long) val,
|
|
|
- (unsigned long long) bits_to_wait_for);
|
|
|
- cond_resched();
|
|
|
- if (time_after(jiffies, timeout)) {
|
|
|
- ipath_dbg("Didn't get bits %llx in register 0x%x, "
|
|
|
- "got %llx\n",
|
|
|
- (unsigned long long) bits_to_wait_for,
|
|
|
- reg_id, (unsigned long long) *valp);
|
|
|
- ret = -ENODEV;
|
|
|
- break;
|
|
|
- }
|
|
|
- } while (1);
|
|
|
-
|
|
|
- return ret;
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * ipath_waitfor_mdio_cmdready - wait for last command to complete
|
|
|
- * @dd: the infinipath device
|
|
|
- *
|
|
|
- * Like ipath_waitfor_complete(), but we wait for the CMDVALID bit to go
|
|
|
- * away indicating the last command has completed. It doesn't return data
|
|
|
- */
|
|
|
-int ipath_waitfor_mdio_cmdready(struct ipath_devdata *dd)
|
|
|
-{
|
|
|
- unsigned long timeout;
|
|
|
- u64 val;
|
|
|
- int ret;
|
|
|
-
|
|
|
- /* wait a ridiculously long time */
|
|
|
- timeout = jiffies + msecs_to_jiffies(5);
|
|
|
- do {
|
|
|
- val = ipath_read_kreg64(dd, dd->ipath_kregs->kr_mdio);
|
|
|
- if (!(val & IPATH_MDIO_CMDVALID)) {
|
|
|
- ret = 0;
|
|
|
- break;
|
|
|
- }
|
|
|
- cond_resched();
|
|
|
- if (time_after(jiffies, timeout)) {
|
|
|
- ipath_dbg("CMDVALID stuck in mdio reg? (%llx)\n",
|
|
|
- (unsigned long long) val);
|
|
|
- ret = -ENODEV;
|
|
|
- break;
|
|
|
- }
|
|
|
- } while (1);
|
|
|
-
|
|
|
- return ret;
|
|
|
-}
|
|
|
-
|
|
|
|
|
|
/*
|
|
|
* Flush all sends that might be in the ready to send state, as well as any
|