From patchwork Wed Apr 26 23:38:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iyappan Subramanian X-Patchwork-Id: 9702209 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C0A7F601D3 for ; Wed, 26 Apr 2017 23:39:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF07928399 for ; Wed, 26 Apr 2017 23:39:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0AD1284DB; Wed, 26 Apr 2017 23:39:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EA33928399 for ; Wed, 26 Apr 2017 23:39:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=PeHkzUxor+Dn8M7Ix4EwSk6KzoI/dfHg2091Fvjyw+U=; b=aU192t5B3e3Vxx7esBpD1nQqy0 2YACPXfDrv6g0p+hZTn1kSg0ULXcMB+fsOidVA422Ot4STw9VeejYPIZk60dpFmwY477Z8Dy/daDh Mue9exUv8NQtnIqMwY6IvPndVNojJx3awNNzj54cBhhP6/Q8oMuwzvZon8FkikuLMyQhc8j5jI6we bcMIoiePyEmJirOhF1uNR1JPqsRgTDz/C5Wc7DnmKj/d1StqyWA/y2bJQn6yp24xMxyQ8hy9ce58g jOVtpHEKArC1y4/8AQRzzFM38xxOn7rSf0qOdxaaHyhE5/s5EFfDaycRZ+E+2fCeU6lC0aD8E1C8k MR2K+ylw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1d3WWs-0006Pw-Iu; Wed, 26 Apr 2017 23:39:26 +0000 Received: from mail-pf0-x22f.google.com ([2607:f8b0:400e:c00::22f]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d3WUc-0004DZ-6i for linux-arm-kernel@lists.infradead.org; Wed, 26 Apr 2017 23:37:09 +0000 Received: by mail-pf0-x22f.google.com with SMTP id c198so8313754pfc.1 for ; Wed, 26 Apr 2017 16:36:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apm.com; s=apm; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pm8QUs/DUAn/hf4DnpSnqLaCCdYIW2n9OnxsIusUXM4=; b=hFLa2uix9HRmwpRyBZn25Cd3B2ln3pPUJlrgjyitEdgZhp/RcIL67eR1PCYKQSagrU KuWycyIo8PR9P75dkFULuW+iYI2VADjdVniDDIg5A86+1ps5/HUstgB8C2vQf9pOzqFf uepQ6IKT6Ckx8Dq/zDWIre2q1ghx8eCugA15E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pm8QUs/DUAn/hf4DnpSnqLaCCdYIW2n9OnxsIusUXM4=; b=DQectpNAtL23/XqRIFy+Go0fVPIeJNWnr1xibgE40V0IHb4vNrlJhU8VH//8KbXgzB NJBgXJKvU0aOp2n53SGjbfh7ZPzWxg+4Dzau9owHy2LS9Y6TaHbrcQB6mpyvDnSn+rL+ J/rufio4OZ8DeTvZJVMRUkhyDzGtKJDV7CIo7lMkyt15WU9VlP/FheqMvNKSXVGLTU7s esPII3ZkJHTnd3TsuIHnKLykD/uOG58hlLnuzDyVb5RRAthABhHMA3UvpUXu9uSDw/Nb 4XaqjfQegtcYHRSlyWZuw+DuKyFUzKgQ/V15Hr8V2L8LMlDDOAYKgWBNGGyD+VnIi9ci NrpQ== X-Gm-Message-State: AN3rC/6zTZ7Z8r0MvEpCeC5UWD4ITC2NU4X7u3Mxzrif0fP3D6ImmB2o FV7s7P1janH/HQtK X-Received: by 10.99.189.2 with SMTP id a2mr2494915pgf.85.1493249801186; Wed, 26 Apr 2017 16:36:41 -0700 (PDT) Received: from isubrama-dev.amcc.com ([206.80.4.98]) by smtp.gmail.com with ESMTPSA id i30sm626700pgn.39.2017.04.26.16.36.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Apr 2017 16:36:40 -0700 (PDT) From: Iyappan Subramanian To: davem@davemloft.net, netdev@vger.kernel.org Subject: [PATCH net-next 7/9] drivers: net: xgene: Workaround for HW errata 10GE_4 Date: Wed, 26 Apr 2017 16:38:53 -0700 Message-Id: <1493249935-30759-8-git-send-email-isubramanian@apm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1493249935-30759-1-git-send-email-isubramanian@apm.com> References: <1493249935-30759-1-git-send-email-isubramanian@apm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170426_163706_436870_26BEB17A X-CRM114-Status: GOOD ( 10.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Quan Nguyen , patches@apm.com, linux-arm-kernel@lists.infradead.org, Iyappan Subramanian MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Quan Nguyen This patch adds workaround for HW errata 10GE_4: "XGENET_ICM_ECM_DROP_COUNT_REG_0 reg not clear on read". Signed-off-by: Quan Nguyen Signed-off-by: Iyappan Subramanian --- drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | 2 ++ drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c | 5 +++++ drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c | 2 ++ 3 files changed, 9 insertions(+) diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c index f79eb78..60b1a07 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c @@ -623,6 +623,8 @@ static void xgene_gmac_get_drop_cnt(struct xgene_enet_pdata *pdata, xgene_enet_rd_mcx_csr(pdata, ICM_ECM_DROP_COUNT_REG0_ADDR, &count); *rx = ICM_DROP_COUNT(count); *tx = ECM_DROP_COUNT(count); + /* Errata: 10GE_4 - Fix ICM_ECM_DROP_COUNT not clear-on-read */ + xgene_enet_rd_mcx_csr(pdata, ECM_CONFIG0_REG_0_ADDR, &count); } static void xgene_enet_config_ring_if_assoc(struct xgene_enet_pdata *pdata) diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c index b253069..ca1f723 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c @@ -197,6 +197,11 @@ static void xgene_sgmac_get_drop_cnt(struct xgene_enet_pdata *pdata, count = xgene_enet_rd_mcx_csr(pdata, addr); *rx = ICM_DROP_COUNT(count); *tx = ECM_DROP_COUNT(count); + /* Errata: 10GE_4 - ICM_ECM_DROP_COUNT not clear-on-read */ + addr = (pdata->enet_id != XGENE_ENET1) ? + XG_MCX_ECM_CONFIG0_REG_0_ADDR : + ECM_CONFIG0_REG_0_ADDR + pdata->port_id * OFFSET_4; + xgene_enet_rd_mcx_csr(pdata, addr); } static void xgene_enet_config_ring_if_assoc(struct xgene_enet_pdata *p) diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c index a317596..3e4cd79 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c @@ -239,6 +239,8 @@ static void xgene_xgmac_get_drop_cnt(struct xgene_enet_pdata *pdata, xgene_enet_rd_axg_csr(pdata, XGENET_ICM_ECM_DROP_COUNT_REG0, &count); *rx = ICM_DROP_COUNT(count); *tx = ECM_DROP_COUNT(count); + /* Errata: 10GE_4 - ICM_ECM_DROP_COUNT not clear-on-read */ + xgene_enet_rd_axg_csr(pdata, XGENET_ECM_CONFIG0_REG_0, &count); } static void xgene_enet_config_ring_if_assoc(struct xgene_enet_pdata *pdata)