From patchwork Wed May 10 20:45:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iyappan Subramanian X-Patchwork-Id: 9720665 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 06E1660364 for ; Wed, 10 May 2017 20:44:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AB182862B for ; Wed, 10 May 2017 20:44:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D50828645; Wed, 10 May 2017 20:44:58 +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 4FDEB2862B for ; Wed, 10 May 2017 20:44:57 +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=AfIgS3nSnWFRAxWIuRdTrQCFgmOWaS0kZ85DeJWS/YY=; b=tu27DMxk5DNXuzm1OM+wUwxBki x4ioz7XkdyjvztB+bV2q7ZEZDG8cP20q8zIboku1ElO/LV2wHmFQWaEA25AwfBQF/3dLnaPkkghs8 GRhTdV3Bbk1kfppin3Ae7QJWkfNM0mQ+PplC38OggfJFgH5aYrD70ZK+cel9krLul1walKTFOYL8i 87GMPyr6TZstMyzfIPX2pnDdZ0JZixwIH/Yr5qMqWLSdhSXt8ZOtKIGeVWeKOeg33lvJPEK78IYHr /KUgXn0u6nDnVLQsPynS+7MhHy8IwZTDYuvUftlWGXK+mR83QzUwXfkltcpKg5oNVH9LoHitiLVx0 ws52jObQ==; 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 1d8YTf-00048k-Ef; Wed, 10 May 2017 20:44:55 +0000 Received: from mail-io0-x22b.google.com ([2607:f8b0:4001:c06::22b]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d8YRg-0001Nj-4B for linux-arm-kernel@lists.infradead.org; Wed, 10 May 2017 20:43:00 +0000 Received: by mail-io0-x22b.google.com with SMTP id o12so9458464iod.3 for ; Wed, 10 May 2017 13:42:31 -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=+AhzHRfrBTX3rQp0AGUDgSH8uG+FuhuBnnxYIJ8uc+A=; b=kd3P6jLSgvRlbXHVszF6pmX0CVHcI8988IzCzJ2Lc2a+tEfI5gvcOq+sV1RUW3ddpw sagwuA9Oqim815mEBG97c6LfT0UR3Jzyf4D3f7oj6u2SKG39h15Zzo7TQDADOXwnIPxr ff67qglYSMb+Fa/KY3dib5QqfijL9rUnHxX/s= 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=+AhzHRfrBTX3rQp0AGUDgSH8uG+FuhuBnnxYIJ8uc+A=; b=nUGEUj3HJJtcOzhMiC2kGuffyRgx5IRZrPAmI7xk/AsKOcO4HRq7lIQkjsuPQL6J1/ iyLNOV1udAwdYL3w47ILozkKvNDfnE3E7GOpMQH4xWVbScFDjUpuXheSYsQdlHQgFKbL pVGw3iCSkowBft+6hhCmdSIIze4obBsvL3NjV7VvVgSOLYtMZZjOyEKpNc4UdR68ZOFP YYev72kXHFKTZKlo39F4M9IFQITPSrU/cWMLXmL+CE3gfyDjBHKulbBf816LlQV/UFkF bD/s37vWSpY2KjAZqxvip+mjMg6nETh4e7rmaaskPmA926QWeLu5E0Wm5IWhun/acAu2 /P6Q== X-Gm-Message-State: AODbwcCcSthmU553RkWmqBcsSb5p1pSB4e+g94+XoVWZriEoV0mRMX/t W9PRlGQM5b3Z1aZh X-Received: by 10.107.159.8 with SMTP id i8mr5442820ioe.143.1494448951131; Wed, 10 May 2017 13:42:31 -0700 (PDT) Received: from isubrama-dev.amcc.com ([206.80.4.98]) by smtp.gmail.com with ESMTPSA id q65sm17889ioi.61.2017.05.10.13.42.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 May 2017 13:42:30 -0700 (PDT) From: Iyappan Subramanian To: davem@davemloft.net, netdev@vger.kernel.org Subject: [PATCH v2 net-next 09/12] drivers: net: xgene: Workaround for HW errata 10GE_4 Date: Wed, 10 May 2017 13:45:07 -0700 Message-Id: <1494449110-23785-10-git-send-email-isubramanian@apm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1494449110-23785-1-git-send-email-isubramanian@apm.com> References: <1494449110-23785-1-git-send-email-isubramanian@apm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170510_134252_708081_D97F6C64 X-CRM114-Status: GOOD ( 11.43 ) 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 5278d62..3235d0c 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c @@ -626,6 +626,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 2919d3e..31df8f3 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c @@ -106,6 +106,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 56dff38..eab6f1c 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c @@ -188,6 +188,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)