OSDN Git Service

IB/hfi1: Correct 8051 link parameter settings
authorDean Luick <dean.luick@intel.com>
Tue, 24 May 2016 19:51:00 +0000 (12:51 -0700)
committerDoug Ledford <dledford@redhat.com>
Thu, 26 May 2016 16:21:10 +0000 (12:21 -0400)
Two 8051 link settings, external device config and tuning method,
were written in the wrong location and the previous settings were
not cleared.  For both, clear the old value and write the new
value.

Fixes: 8ebd4cf1852a ("staging/rdma/hfi1: Add active and optical cable support")
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/hfi1/chip.h
drivers/infiniband/hw/hfi1/platform.c

index 1948706..66a3279 100644 (file)
 /* Lane ID for general configuration registers */
 #define GENERAL_CONFIG 4
 
+/* LINK_TUNING_PARAMETERS fields */
+#define TUNING_METHOD_SHIFT 24
+
+/* LINK_OPTIMIZATION_SETTINGS fields */
+#define ENABLE_EXT_DEV_CONFIG_SHIFT 24
+
 /* LOAD_DATA 8051 command shifts and fields */
 #define LOAD_DATA_FIELD_ID_SHIFT 40
 #define LOAD_DATA_FIELD_ID_MASK 0xfull
index ae0e498..03df932 100644 (file)
@@ -540,7 +540,8 @@ static void apply_tunings(
        /* Enable external device config if channel is limiting active */
        read_8051_config(ppd->dd, LINK_OPTIMIZATION_SETTINGS,
                         GENERAL_CONFIG, &config_data);
-       config_data |= limiting_active;
+       config_data &= ~(0xff << ENABLE_EXT_DEV_CONFIG_SHIFT);
+       config_data |= ((u32)limiting_active << ENABLE_EXT_DEV_CONFIG_SHIFT);
        ret = load_8051_config(ppd->dd, LINK_OPTIMIZATION_SETTINGS,
                               GENERAL_CONFIG, config_data);
        if (ret != HCMD_SUCCESS)
@@ -553,7 +554,8 @@ static void apply_tunings(
        /* Pass tuning method to 8051 */
        read_8051_config(ppd->dd, LINK_TUNING_PARAMETERS, GENERAL_CONFIG,
                         &config_data);
-       config_data |= tuning_method;
+       config_data &= ~(0xff << TUNING_METHOD_SHIFT);
+       config_data |= ((u32)tuning_method << TUNING_METHOD_SHIFT);
        ret = load_8051_config(ppd->dd, LINK_TUNING_PARAMETERS, GENERAL_CONFIG,
                               config_data);
        if (ret != HCMD_SUCCESS)