IB/hfi1: Wait for QSFP modules to initialize
authorEaswar Hariharan <easwar.hariharan@intel.com>
Thu, 12 May 2016 17:22:39 +0000 (10:22 -0700)
committerDoug Ledford <dledford@redhat.com>
Fri, 13 May 2016 23:39:14 +0000 (19:39 -0400)
The function level reset in init_chip() and subsequent write of all 1s
to the ASIC_QSFP registers effectively resets attached active and
optical QSFP modules that pay attention to the RESET_N pin.

We subsequently try to access the QSFP management interface to qualify
and tune the channel and fabric SerDes before enough time (2 seconds
per SFF 8679 spec for QSFP28 modules) has elapsed for the module to
finish initialization. This fails and causes the failure of the channel
tuning algorithm, preventing us from bringing the link up.

This patch checks the port type prior to beginning channel and SerDes
tuning, and if found to be QSFP, watches for the QSFP initialization
complete interrupt, with a maximum timeout of 2 seconds, to allow the
initialization to complete.

Reviewed-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Easwar Hariharan <easwar.hariharan@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/staging/rdma/hfi1/chip.c
drivers/staging/rdma/hfi1/platform.c
drivers/staging/rdma/hfi1/platform.h

index f6ae0ba3a3b81dda1b5a10f8da3c7474a6b6d728..ce4c275b60f28882ee077c80e0fe2eb391655b90 100644 (file)
@@ -9485,7 +9485,15 @@ int bringup_serdes(struct hfi1_pportdata *ppd)
                        return ret;
        }
 
-       /* tune the SERDES to a ballpark setting for
+       get_port_type(ppd);
+       if (ppd->port_type == PORT_TYPE_QSFP) {
+               set_qsfp_int_n(ppd, 0);
+               wait_for_qsfp_init(ppd);
+               set_qsfp_int_n(ppd, 1);
+       }
+
+       /*
+        * Tune the SerDes to a ballpark setting for
         * optimal signal and bit error rate
         * Needs to be done before starting the link
         */
index 8fe8a205b5bbb968bc7516f524ec129208a5283d..dfa413cfa351870be661e6cf1d05b94cac723813 100644 (file)
@@ -87,6 +87,17 @@ void free_platform_config(struct hfi1_devdata *dd)
         */
 }
 
+void get_port_type(struct hfi1_pportdata *ppd)
+{
+       int ret;
+
+       ret = get_platform_config_field(ppd->dd, PLATFORM_CONFIG_PORT_TABLE, 0,
+                                       PORT_TABLE_PORT_TYPE, &ppd->port_type,
+                                       4);
+       if (ret)
+               ppd->port_type = PORT_TYPE_UNKNOWN;
+}
+
 int set_qsfp_tx(struct hfi1_pportdata *ppd, int on)
 {
        u8 tx_ctrl_byte = on ? 0x0 : 0xF;
@@ -784,12 +795,6 @@ void tune_serdes(struct hfi1_pportdata *ppd)
                return;
        }
 
-       ret = get_platform_config_field(ppd->dd, PLATFORM_CONFIG_PORT_TABLE, 0,
-                                       PORT_TABLE_PORT_TYPE, &ppd->port_type,
-                                       4);
-       if (ret)
-               ppd->port_type = PORT_TYPE_UNKNOWN;
-
        switch (ppd->port_type) {
        case PORT_TYPE_DISCONNECTED:
                ppd->offline_disabled_reason =
index 19620cf546d5fb675b3cb5800f5b01696df9e57e..e2c21613c326fba034f0255658f919245b0383b5 100644 (file)
@@ -298,6 +298,7 @@ enum link_tuning_encoding {
 /* platform.c */
 void get_platform_config(struct hfi1_devdata *dd);
 void free_platform_config(struct hfi1_devdata *dd);
+void get_port_type(struct hfi1_pportdata *ppd);
 int set_qsfp_tx(struct hfi1_pportdata *ppd, int on);
 void tune_serdes(struct hfi1_pportdata *ppd);