aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ipath/ipath_iba6120.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_iba6120.c')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_iba6120.c74
1 files changed, 60 insertions, 14 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_iba6120.c b/drivers/infiniband/hw/ipath/ipath_iba6120.c
index 8423fee6344b..828066e20ad7 100644
--- a/drivers/infiniband/hw/ipath/ipath_iba6120.c
+++ b/drivers/infiniband/hw/ipath/ipath_iba6120.c
@@ -626,7 +626,6 @@ static int ipath_pe_boardname(struct ipath_devdata *dd, char *name,
626 dd->ipath_f_put_tid = ipath_pe_put_tid_2; 626 dd->ipath_f_put_tid = ipath_pe_put_tid_2;
627 } 627 }
628 628
629
630 /* 629 /*
631 * set here, not in ipath_init_*_funcs because we have to do 630 * set here, not in ipath_init_*_funcs because we have to do
632 * it after we can read chip registers. 631 * it after we can read chip registers.
@@ -879,6 +878,62 @@ static void ipath_setup_pe_cleanup(struct ipath_devdata *dd)
879 pci_disable_msi(dd->pcidev); 878 pci_disable_msi(dd->pcidev);
880} 879}
881 880
881static void ipath_6120_pcie_params(struct ipath_devdata *dd)
882{
883 u16 linkstat, speed;
884 int pos;
885
886 pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_EXP);
887 if (!pos) {
888 ipath_dev_err(dd, "Can't find PCI Express capability!\n");
889 goto bail;
890 }
891
892 pci_read_config_word(dd->pcidev, pos + PCI_EXP_LNKSTA,
893 &linkstat);
894 /*
895 * speed is bits 0-4, linkwidth is bits 4-8
896 * no defines for them in headers
897 */
898 speed = linkstat & 0xf;
899 linkstat >>= 4;
900 linkstat &= 0x1f;
901 dd->ipath_lbus_width = linkstat;
902
903 switch (speed) {
904 case 1:
905 dd->ipath_lbus_speed = 2500; /* Gen1, 2.5GHz */
906 break;
907 case 2:
908 dd->ipath_lbus_speed = 5000; /* Gen1, 5GHz */
909 break;
910 default: /* not defined, assume gen1 */
911 dd->ipath_lbus_speed = 2500;
912 break;
913 }
914
915 if (linkstat < 8)
916 ipath_dev_err(dd,
917 "PCIe width %u (x8 HCA), performance reduced\n",
918 linkstat);
919 else
920 ipath_cdbg(VERBOSE, "PCIe speed %u width %u (x8 HCA)\n",
921 dd->ipath_lbus_speed, linkstat);
922
923 if (speed != 1)
924 ipath_dev_err(dd,
925 "PCIe linkspeed %u is incorrect; "
926 "should be 1 (2500)!\n", speed);
927bail:
928 /* fill in string, even on errors */
929 snprintf(dd->ipath_lbus_info, sizeof(dd->ipath_lbus_info),
930 "PCIe,%uMHz,x%u\n",
931 dd->ipath_lbus_speed,
932 dd->ipath_lbus_width);
933
934 return;
935}
936
882/** 937/**
883 * ipath_setup_pe_config - setup PCIe config related stuff 938 * ipath_setup_pe_config - setup PCIe config related stuff
884 * @dd: the infinipath device 939 * @dd: the infinipath device
@@ -936,19 +991,8 @@ static int ipath_setup_pe_config(struct ipath_devdata *dd,
936 } else 991 } else
937 ipath_dev_err(dd, "Can't find MSI capability, " 992 ipath_dev_err(dd, "Can't find MSI capability, "
938 "can't save MSI settings for reset\n"); 993 "can't save MSI settings for reset\n");
939 if ((pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_EXP))) { 994
940 u16 linkstat; 995 ipath_6120_pcie_params(dd);
941 pci_read_config_word(dd->pcidev, pos + PCI_EXP_LNKSTA,
942 &linkstat);
943 linkstat >>= 4;
944 linkstat &= 0x1f;
945 if (linkstat != 8)
946 ipath_dev_err(dd, "PCIe width %u, "
947 "performance reduced\n", linkstat);
948 }
949 else
950 ipath_dev_err(dd, "Can't find PCI Express "
951 "capability!\n");
952 996
953 dd->ipath_link_width_supported = IB_WIDTH_1X | IB_WIDTH_4X; 997 dd->ipath_link_width_supported = IB_WIDTH_1X | IB_WIDTH_4X;
954 dd->ipath_link_speed_supported = IPATH_IB_SDR; 998 dd->ipath_link_speed_supported = IPATH_IB_SDR;
@@ -1206,6 +1250,8 @@ static int ipath_setup_pe_reset(struct ipath_devdata *dd)
1206 ret = 0; /* failed */ 1250 ret = 0; /* failed */
1207 1251
1208bail: 1252bail:
1253 if (ret)
1254 ipath_6120_pcie_params(dd);
1209 return ret; 1255 return ret;
1210} 1256}
1211 1257