diff options
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_driver.c | 17 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_iba6110.c | 9 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_iba6120.c | 9 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_kernel.h | 3 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_registers.h | 2 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_sysfs.c | 29 |
6 files changed, 69 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c index 3a15efee7387..47c9d15557c8 100644 --- a/drivers/infiniband/hw/ipath/ipath_driver.c +++ b/drivers/infiniband/hw/ipath/ipath_driver.c | |||
@@ -2116,5 +2116,22 @@ bail: | |||
2116 | return ret; | 2116 | return ret; |
2117 | } | 2117 | } |
2118 | 2118 | ||
2119 | int ipath_set_rx_pol_inv(struct ipath_devdata *dd, u8 new_pol_inv) | ||
2120 | { | ||
2121 | u64 val; | ||
2122 | if ( new_pol_inv > INFINIPATH_XGXS_RX_POL_MASK ) { | ||
2123 | return -1; | ||
2124 | } | ||
2125 | if ( dd->ipath_rx_pol_inv != new_pol_inv ) { | ||
2126 | dd->ipath_rx_pol_inv = new_pol_inv; | ||
2127 | val = ipath_read_kreg64(dd, dd->ipath_kregs->kr_xgxsconfig); | ||
2128 | val &= ~(INFINIPATH_XGXS_RX_POL_MASK << | ||
2129 | INFINIPATH_XGXS_RX_POL_SHIFT); | ||
2130 | val |= ((u64)dd->ipath_rx_pol_inv) << | ||
2131 | INFINIPATH_XGXS_RX_POL_SHIFT; | ||
2132 | ipath_write_kreg(dd, dd->ipath_kregs->kr_xgxsconfig, val); | ||
2133 | } | ||
2134 | return 0; | ||
2135 | } | ||
2119 | module_init(infinipath_init); | 2136 | module_init(infinipath_init); |
2120 | module_exit(infinipath_cleanup); | 2137 | module_exit(infinipath_cleanup); |
diff --git a/drivers/infiniband/hw/ipath/ipath_iba6110.c b/drivers/infiniband/hw/ipath/ipath_iba6110.c index 7028c98e5c4f..bf2455a6d562 100644 --- a/drivers/infiniband/hw/ipath/ipath_iba6110.c +++ b/drivers/infiniband/hw/ipath/ipath_iba6110.c | |||
@@ -1290,6 +1290,15 @@ static int ipath_ht_bringup_serdes(struct ipath_devdata *dd) | |||
1290 | val &= ~INFINIPATH_XGXS_RESET; | 1290 | val &= ~INFINIPATH_XGXS_RESET; |
1291 | change = 1; | 1291 | change = 1; |
1292 | } | 1292 | } |
1293 | if (((val >> INFINIPATH_XGXS_RX_POL_SHIFT) & | ||
1294 | INFINIPATH_XGXS_RX_POL_MASK) != dd->ipath_rx_pol_inv ) { | ||
1295 | /* need to compensate for Tx inversion in partner */ | ||
1296 | val &= ~(INFINIPATH_XGXS_RX_POL_MASK << | ||
1297 | INFINIPATH_XGXS_RX_POL_SHIFT); | ||
1298 | val |= dd->ipath_rx_pol_inv << | ||
1299 | INFINIPATH_XGXS_RX_POL_SHIFT; | ||
1300 | change = 1; | ||
1301 | } | ||
1293 | if (change) | 1302 | if (change) |
1294 | ipath_write_kreg(dd, dd->ipath_kregs->kr_xgxsconfig, val); | 1303 | ipath_write_kreg(dd, dd->ipath_kregs->kr_xgxsconfig, val); |
1295 | 1304 | ||
diff --git a/drivers/infiniband/hw/ipath/ipath_iba6120.c b/drivers/infiniband/hw/ipath/ipath_iba6120.c index 3a7640be2530..d86516d23df6 100644 --- a/drivers/infiniband/hw/ipath/ipath_iba6120.c +++ b/drivers/infiniband/hw/ipath/ipath_iba6120.c | |||
@@ -654,6 +654,15 @@ static int ipath_pe_bringup_serdes(struct ipath_devdata *dd) | |||
654 | val &= ~INFINIPATH_XGXS_RESET; | 654 | val &= ~INFINIPATH_XGXS_RESET; |
655 | change = 1; | 655 | change = 1; |
656 | } | 656 | } |
657 | if (((val >> INFINIPATH_XGXS_RX_POL_SHIFT) & | ||
658 | INFINIPATH_XGXS_RX_POL_MASK) != dd->ipath_rx_pol_inv ) { | ||
659 | /* need to compensate for Tx inversion in partner */ | ||
660 | val &= ~(INFINIPATH_XGXS_RX_POL_MASK << | ||
661 | INFINIPATH_XGXS_RX_POL_SHIFT); | ||
662 | val |= dd->ipath_rx_pol_inv << | ||
663 | INFINIPATH_XGXS_RX_POL_SHIFT; | ||
664 | change = 1; | ||
665 | } | ||
657 | if (change) | 666 | if (change) |
658 | ipath_write_kreg(dd, dd->ipath_kregs->kr_xgxsconfig, val); | 667 | ipath_write_kreg(dd, dd->ipath_kregs->kr_xgxsconfig, val); |
659 | 668 | ||
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h index 2530686f6893..a8a56276ff1d 100644 --- a/drivers/infiniband/hw/ipath/ipath_kernel.h +++ b/drivers/infiniband/hw/ipath/ipath_kernel.h | |||
@@ -503,6 +503,8 @@ struct ipath_devdata { | |||
503 | u8 ipath_pci_cacheline; | 503 | u8 ipath_pci_cacheline; |
504 | /* LID mask control */ | 504 | /* LID mask control */ |
505 | u8 ipath_lmc; | 505 | u8 ipath_lmc; |
506 | /* Rx Polarity inversion (compensate for ~tx on partner) */ | ||
507 | u8 ipath_rx_pol_inv; | ||
506 | 508 | ||
507 | /* local link integrity counter */ | 509 | /* local link integrity counter */ |
508 | u32 ipath_lli_counter; | 510 | u32 ipath_lli_counter; |
@@ -567,6 +569,7 @@ void ipath_get_faststats(unsigned long); | |||
567 | int ipath_set_linkstate(struct ipath_devdata *, u8); | 569 | int ipath_set_linkstate(struct ipath_devdata *, u8); |
568 | int ipath_set_mtu(struct ipath_devdata *, u16); | 570 | int ipath_set_mtu(struct ipath_devdata *, u16); |
569 | int ipath_set_lid(struct ipath_devdata *, u32, u8); | 571 | int ipath_set_lid(struct ipath_devdata *, u32, u8); |
572 | int ipath_set_rx_pol_inv(struct ipath_devdata *dd, u8 new_pol_inv); | ||
570 | 573 | ||
571 | /* for use in system calls, where we want to know device type, etc. */ | 574 | /* for use in system calls, where we want to know device type, etc. */ |
572 | #define port_fp(fp) ((struct ipath_portdata *) (fp)->private_data) | 575 | #define port_fp(fp) ((struct ipath_portdata *) (fp)->private_data) |
diff --git a/drivers/infiniband/hw/ipath/ipath_registers.h b/drivers/infiniband/hw/ipath/ipath_registers.h index f08c86088ca4..6e23b3d632b8 100644 --- a/drivers/infiniband/hw/ipath/ipath_registers.h +++ b/drivers/infiniband/hw/ipath/ipath_registers.h | |||
@@ -282,6 +282,8 @@ | |||
282 | #define INFINIPATH_XGXS_RESET 0x7ULL | 282 | #define INFINIPATH_XGXS_RESET 0x7ULL |
283 | #define INFINIPATH_XGXS_MDIOADDR_MASK 0xfULL | 283 | #define INFINIPATH_XGXS_MDIOADDR_MASK 0xfULL |
284 | #define INFINIPATH_XGXS_MDIOADDR_SHIFT 4 | 284 | #define INFINIPATH_XGXS_MDIOADDR_SHIFT 4 |
285 | #define INFINIPATH_XGXS_RX_POL_SHIFT 19 | ||
286 | #define INFINIPATH_XGXS_RX_POL_MASK 0xfULL | ||
285 | 287 | ||
286 | #define INFINIPATH_RT_ADDR_MASK 0xFFFFFFFFFFULL /* 40 bits valid */ | 288 | #define INFINIPATH_RT_ADDR_MASK 0xFFFFFFFFFFULL /* 40 bits valid */ |
287 | 289 | ||
diff --git a/drivers/infiniband/hw/ipath/ipath_sysfs.c b/drivers/infiniband/hw/ipath/ipath_sysfs.c index 8476dd3c7af4..e299148c4b68 100644 --- a/drivers/infiniband/hw/ipath/ipath_sysfs.c +++ b/drivers/infiniband/hw/ipath/ipath_sysfs.c | |||
@@ -561,6 +561,33 @@ bail: | |||
561 | return ret; | 561 | return ret; |
562 | } | 562 | } |
563 | 563 | ||
564 | static ssize_t store_rx_pol_inv(struct device *dev, | ||
565 | struct device_attribute *attr, | ||
566 | const char *buf, | ||
567 | size_t count) | ||
568 | { | ||
569 | struct ipath_devdata *dd = dev_get_drvdata(dev); | ||
570 | int ret, r; | ||
571 | u16 val; | ||
572 | |||
573 | ret = ipath_parse_ushort(buf, &val); | ||
574 | if (ret < 0) | ||
575 | goto invalid; | ||
576 | |||
577 | r = ipath_set_rx_pol_inv(dd, val); | ||
578 | if (r < 0) { | ||
579 | ret = r; | ||
580 | goto bail; | ||
581 | } | ||
582 | |||
583 | goto bail; | ||
584 | invalid: | ||
585 | ipath_dev_err(dd, "attempt to set invalid Rx Polarity invert\n"); | ||
586 | bail: | ||
587 | return ret; | ||
588 | } | ||
589 | |||
590 | |||
564 | static DRIVER_ATTR(num_units, S_IRUGO, show_num_units, NULL); | 591 | static DRIVER_ATTR(num_units, S_IRUGO, show_num_units, NULL); |
565 | static DRIVER_ATTR(version, S_IRUGO, show_version, NULL); | 592 | static DRIVER_ATTR(version, S_IRUGO, show_version, NULL); |
566 | 593 | ||
@@ -587,6 +614,7 @@ static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); | |||
587 | static DEVICE_ATTR(status_str, S_IRUGO, show_status_str, NULL); | 614 | static DEVICE_ATTR(status_str, S_IRUGO, show_status_str, NULL); |
588 | static DEVICE_ATTR(boardversion, S_IRUGO, show_boardversion, NULL); | 615 | static DEVICE_ATTR(boardversion, S_IRUGO, show_boardversion, NULL); |
589 | static DEVICE_ATTR(unit, S_IRUGO, show_unit, NULL); | 616 | static DEVICE_ATTR(unit, S_IRUGO, show_unit, NULL); |
617 | static DEVICE_ATTR(rx_pol_inv, S_IWUSR, NULL, store_rx_pol_inv); | ||
590 | 618 | ||
591 | static struct attribute *dev_attributes[] = { | 619 | static struct attribute *dev_attributes[] = { |
592 | &dev_attr_guid.attr, | 620 | &dev_attr_guid.attr, |
@@ -601,6 +629,7 @@ static struct attribute *dev_attributes[] = { | |||
601 | &dev_attr_boardversion.attr, | 629 | &dev_attr_boardversion.attr, |
602 | &dev_attr_unit.attr, | 630 | &dev_attr_unit.attr, |
603 | &dev_attr_enabled.attr, | 631 | &dev_attr_enabled.attr, |
632 | &dev_attr_rx_pol_inv.attr, | ||
604 | NULL | 633 | NULL |
605 | }; | 634 | }; |
606 | 635 | ||