35 #include <linux/pci.h>
45 #define QSFP_MAX_RETRY 4
90 "QSFP interface Reset for read failed\n");
101 int wlen = len -
cnt;
135 qib_dev_err(dd,
"QSFP interface bus stuck non-idle\n");
198 "QSFP interface Reset for write failed\n");
208 int wlen = len -
cnt;
258 while (first < next) {
259 ret = qsfp_read(ppd, first, &bval, 1);
279 memset(cp, 0,
sizeof(*cp));
286 ret = qsfp_read(ppd, 0, peek, 3);
289 if ((peek[0] & 0xFE) != 0x0C)
291 "QSFP byte0 is 0x%02X, S/B 0x0C/D\n", peek[0]);
293 if ((peek[2] & 2) == 0) {
299 ret = qib_qsfp_write(ppd, 127, &poke, 1);
303 "Failed QSFP Page set\n");
311 if ((cp->
id & 0xFE) != 0x0C)
313 "QSFP ID byte is 0x%02X, S/B 0x0C/D\n", cp->
id);
369 cks += cp->
atten[idx];
382 "QSFP cks1 is %02X, computed %02X\n", cp->
cks1,
401 cks += cp->
date[idx];
420 "QSFP cks2 is %02X, computed %02X\n", cp->
cks2,
430 "850nm VCSEL",
"1310nm VCSEL",
"1550nm VCSEL",
"1310nm FP",
431 "1310nm DFB",
"1550nm DFB",
"1310nm EML",
"1550nm EML",
432 "Cu Misc",
"1490nm DFB",
"Cu NoEq",
"Cu Eq",
433 "Undef",
"Cu Active BothEq",
"Cu FarEq",
"Cu NearEq"
436 #define QSFP_DUMP_CHUNK 16
437 #define QSFP_DEFAULT_HDR_CNT 224
439 static const char *pwr_codes =
"1.5W2.0W2.5W3.5W";
448 ret = ppd->
dd->f_gpio_mod(ppd->
dd, 0, 0, 0);
450 return !((ret &
mask) >>
475 if (qd->
ppd->hw_pidx) {
514 sofar +=
scnprintf(buf + sofar, len - sofar,
"PWR:%.3sW\n", pwr_codes +
517 sofar +=
scnprintf(buf + sofar, len - sofar,
"TECH:%s%s\n", lenstr,
518 qib_qsfp_devtech[cd.
tech >> 4]);
520 sofar +=
scnprintf(buf + sofar, len - sofar,
"Vendor:%.*s\n",
523 sofar +=
scnprintf(buf + sofar, len - sofar,
"OUI:%06X\n",
526 sofar +=
scnprintf(buf + sofar, len - sofar,
"Part#:%.*s\n",
528 sofar +=
scnprintf(buf + sofar, len - sofar,
"Rev:%.*s\n",
531 sofar +=
scnprintf(buf + sofar, len - sofar,
"Atten:%d, %d\n",
534 sofar +=
scnprintf(buf + sofar, len - sofar,
"Serial:%.*s\n",
536 sofar +=
scnprintf(buf + sofar, len - sofar,
"Date:%.*s\n",
538 sofar +=
scnprintf(buf + sofar, len - sofar,
"Lot:%.*s\n",
546 for (iidx = 0; iidx <
ret; ++iidx) {
547 sofar +=
scnprintf(buf + sofar, len-sofar,
" %02X",
550 sofar +=
scnprintf(buf + sofar, len - sofar,
"\n");