From patchwork Tue Dec 1 20:38:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jubin.john@intel.com X-Patchwork-Id: 7740791 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CBF179F3E6 for ; Tue, 1 Dec 2015 20:38:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CD8472067A for ; Tue, 1 Dec 2015 20:38:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 30B4D206B8 for ; Tue, 1 Dec 2015 20:38:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757049AbbLAUik (ORCPT ); Tue, 1 Dec 2015 15:38:40 -0500 Received: from mga03.intel.com ([134.134.136.65]:64509 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757050AbbLAUig (ORCPT ); Tue, 1 Dec 2015 15:38:36 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 01 Dec 2015 12:38:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,370,1444719600"; d="scan'208";a="851708861" Received: from phlsvsds.ph.intel.com ([10.228.195.38]) by fmsmga001.fm.intel.com with ESMTP; 01 Dec 2015 12:38:34 -0800 Received: from phlsvsds.ph.intel.com (localhost.localdomain [127.0.0.1]) by phlsvsds.ph.intel.com (8.13.8/8.13.8) with ESMTP id tB1KcWO4015269; Tue, 1 Dec 2015 15:38:32 -0500 Received: (from jjohn@localhost) by phlsvsds.ph.intel.com (8.13.8/8.13.8/Submit) id tB1KcVEN015266; Tue, 1 Dec 2015 15:38:31 -0500 X-Authentication-Warning: phlsvsds.ph.intel.com: jjohn set sender to jubin.john@intel.com using -f From: Jubin John To: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org Cc: linux-rdma@vger.kernel.org, dledford@redhat.com, mike.marciniszyn@intel.com, ira.weiny@intel.com Subject: [PATCH v2 06/17] staging/rdma/hfi1: Add one-time LCB reset Date: Tue, 1 Dec 2015 15:38:15 -0500 Message-Id: <1449002306-15180-7-git-send-email-jubin.john@intel.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1449002306-15180-1-git-send-email-jubin.john@intel.com> References: <1449002306-15180-1-git-send-email-jubin.john@intel.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dean Luick Add one-time LCB reset on driver load to pre-emptively work around any LCB power cycle issues. Reviewed-by: Easwar Hariharan Signed-off-by: Dean Luick Signed-off-by: Jubin John --- Changes in v2: - Fixed driver name to hfi1 in subject line drivers/staging/rdma/hfi1/chip.c | 20 ++++++++++++++++++++ drivers/staging/rdma/hfi1/chip_registers.h | 3 +++ 2 files changed, 23 insertions(+), 0 deletions(-) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index 6b6af40..8191065 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -5888,6 +5888,23 @@ void init_qsfp(struct hfi1_pportdata *ppd) } } +/* + * Do a one-time initialize of the LCB block. + */ +static void init_lcb(struct hfi1_devdata *dd) +{ + /* the DC has been reset earlier in the driver load */ + + /* set LCB for cclk loopback on the port */ + write_csr(dd, DC_LCB_CFG_TX_FIFOS_RESET, 0x01); + write_csr(dd, DC_LCB_CFG_LANE_WIDTH, 0x00); + write_csr(dd, DC_LCB_CFG_REINIT_AS_SLAVE, 0x00); + write_csr(dd, DC_LCB_CFG_CNT_FOR_SKIP_STALL, 0x110); + write_csr(dd, DC_LCB_CFG_CLK_CNTR, 0x08); + write_csr(dd, DC_LCB_CFG_LOOPBACK, 0x02); + write_csr(dd, DC_LCB_CFG_TX_FIFOS_RESET, 0x00); +} + int bringup_serdes(struct hfi1_pportdata *ppd) { struct hfi1_devdata *dd = ppd->dd; @@ -5909,6 +5926,9 @@ int bringup_serdes(struct hfi1_pportdata *ppd) /* Set linkinit_reason on power up per OPA spec */ ppd->linkinit_reason = OPA_LINKINIT_REASON_LINKUP; + /* one-time init of the LCB */ + init_lcb(dd); + if (loopback) { ret = init_loopback(dd); if (ret < 0) diff --git a/drivers/staging/rdma/hfi1/chip_registers.h b/drivers/staging/rdma/hfi1/chip_registers.h index bf45de2..21ca8c1 100644 --- a/drivers/staging/rdma/hfi1/chip_registers.h +++ b/drivers/staging/rdma/hfi1/chip_registers.h @@ -318,6 +318,9 @@ #define DC_LCB_CFG_TX_FIFOS_RADR_RST_VAL_SHIFT 0 #define DC_LCB_CFG_TX_FIFOS_RESET (DC_LCB_CSRS + 0x000000000008) #define DC_LCB_CFG_TX_FIFOS_RESET_VAL_SHIFT 0 +#define DC_LCB_CFG_REINIT_AS_SLAVE (DC_LCB_CSRS + 0x000000000030) +#define DC_LCB_CFG_CNT_FOR_SKIP_STALL (DC_LCB_CSRS + 0x000000000040) +#define DC_LCB_CFG_CLK_CNTR (DC_LCB_CSRS + 0x000000000110) #define DC_LCB_ERR_CLR (DC_LCB_CSRS + 0x000000000308) #define DC_LCB_ERR_EN (DC_LCB_CSRS + 0x000000000310) #define DC_LCB_ERR_FLG (DC_LCB_CSRS + 0x000000000300)