Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5091501img; Wed, 27 Mar 2019 01:46:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxCJ3nFjIgxXkLbMcyZGpT357jkuWZs37AnpRGeB6hPE8zk/Jjaw2l2aEK9PB+Uih+EaIqB X-Received: by 2002:a63:570d:: with SMTP id l13mr25632297pgb.55.1553676383113; Wed, 27 Mar 2019 01:46:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553676383; cv=none; d=google.com; s=arc-20160816; b=eI2OPii0QaSB/Xd4tHpwd77prRnjINM5nJl5OS1MgosYOjG0Th64+rvhgJRIHg/pcg eI92LoXea7a9BLrRmPnsSrKZL1ITyO95B8Z/2DwoWYUdxYFDUoQBRclBYSOMEstF8gSP 8CUOxQJhO983IJsjev5dC6Smdi7B1WBXfoKbqsFQYWYIC8dPtns5IujHNeRPZDi0iPCn nBp1vHwAcYVcSDl/8DDS4jYQt/JCKmTx9t+xQJtjsCyGCiNzCJFsdGlSxMlcdUPLlFlo YdjE1zpkkO/6XIn16FMySps+L+l8ud7GMIUIFZ+gW+oTeB9637wwVeL6zULQ2cMzr8mK 6V+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ZjXjJmDn4uKMRoV80I8bjgSYoyRlZo+hXWBXyZBit5A=; b=faQEi4yuI2KFG0oGFf03b4qtCDfiVJ/Pdo5IzW8NU+YQOIuoMjEy5SDXk0//ILHVke lqyAb97KuNMyd1Gll/YCUoCfOqiM7RIRV59QQp0lhGogKWk1USV38B+I07YVmYy/fEBq pXpt3pR+hZaOSMvKK2zSwAVKC22V5ugZ1YweH9fABnvaz3+znzJvwdgrFG1tAd7cfiu3 faAlmTnM2WRdDXAxHn5apv+45TdrYsc+ipDTUCK8sMXxXVI/VGQvKXdgs4azjMH52UMj l0prd5hO8QllZPFSm9bqnZ9ZnLhn0GiRvQvW/+tp+Qp5MdOYQYrl5pRp10ISks3lDjcr G/GA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t66si17805374pfb.178.2019.03.27.01.46.08; Wed, 27 Mar 2019 01:46:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733033AbfC0IpK (ORCPT + 99 others); Wed, 27 Mar 2019 04:45:10 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:38159 "EHLO relay2-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732836AbfC0IpD (ORCPT ); Wed, 27 Mar 2019 04:45:03 -0400 X-Originating-IP: 90.88.32.136 Received: from mc-bl-xps13.lan (aaubervilliers-681-1-91-136.w90-88.abo.wanadoo.fr [90.88.32.136]) (Authenticated sender: maxime.chevallier@bootlin.com) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 1F73040006; Wed, 27 Mar 2019 08:44:59 +0000 (UTC) From: Maxime Chevallier To: davem@davemloft.net Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Antoine Tenart , thomas.petazzoni@bootlin.com, gregory.clement@bootlin.com, miquel.raynal@bootlin.com, nadavh@marvell.com, stefanc@marvell.com, ymarkman@marvell.com, mw@semihalf.com, Russell King , linux-arm-kernel@lists.infradead.org Subject: [PATCH net-next 11/18] net: mvpp2: cls: Write C2 TCAM data last when writing a C2 entry Date: Wed, 27 Mar 2019 09:44:15 +0100 Message-Id: <20190327084422.4209-12-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190327084422.4209-1-maxime.chevallier@bootlin.com> References: <20190327084422.4209-1-maxime.chevallier@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When writing a C2 entry to hardware, some registers writes will only take effect when the TCAM_DATA4 register is written. This includes all C2 TCAM registers, and the C2 invalidate register. To make sure we always write C2 entries correctly, document that behaviour with a comment, and move TCAM writes to the end of the mvpp2_cls_c2_write helper. Signed-off-by: Maxime Chevallier --- drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c index 96358efcc018..335714e1bbea 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c @@ -748,19 +748,19 @@ static void mvpp2_cls_c2_write(struct mvpp2 *priv, { mvpp2_write(priv, MVPP22_CLS_C2_TCAM_IDX, c2->index); - /* Write TCAM */ - mvpp2_write(priv, MVPP22_CLS_C2_TCAM_DATA0, c2->tcam[0]); - mvpp2_write(priv, MVPP22_CLS_C2_TCAM_DATA1, c2->tcam[1]); - mvpp2_write(priv, MVPP22_CLS_C2_TCAM_DATA2, c2->tcam[2]); - mvpp2_write(priv, MVPP22_CLS_C2_TCAM_DATA3, c2->tcam[3]); - mvpp2_write(priv, MVPP22_CLS_C2_TCAM_DATA4, c2->tcam[4]); - mvpp2_write(priv, MVPP22_CLS_C2_ACT, c2->act); mvpp2_write(priv, MVPP22_CLS_C2_ATTR0, c2->attr[0]); mvpp2_write(priv, MVPP22_CLS_C2_ATTR1, c2->attr[1]); mvpp2_write(priv, MVPP22_CLS_C2_ATTR2, c2->attr[2]); mvpp2_write(priv, MVPP22_CLS_C2_ATTR3, c2->attr[3]); + + mvpp2_write(priv, MVPP22_CLS_C2_TCAM_DATA0, c2->tcam[0]); + mvpp2_write(priv, MVPP22_CLS_C2_TCAM_DATA1, c2->tcam[1]); + mvpp2_write(priv, MVPP22_CLS_C2_TCAM_DATA2, c2->tcam[2]); + mvpp2_write(priv, MVPP22_CLS_C2_TCAM_DATA3, c2->tcam[3]); + /* Writing TCAM_DATA4 flushes writes to TCAM_DATA0-4 and INV to HW */ + mvpp2_write(priv, MVPP22_CLS_C2_TCAM_DATA4, c2->tcam[4]); } void mvpp2_cls_c2_read(struct mvpp2 *priv, int index, -- 2.20.1