All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 06/41] net: mvpp2: simplify MVPP2_PRS_RI_* definitions
Date: Tue, 21 Mar 2017 15:27:27 +0100	[thread overview]
Message-ID: <20170321142802.24276-7-sr@denx.de> (raw)
In-Reply-To: <20170321142802.24276-1-sr@denx.de>

From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Some of the MVPP2_PRS_RI_* definitions use the ~(value) syntax, which
doesn't compile nicely on 64-bit. Moreover, those definitions are in
fact unneeded, since they are always used in combination with a bit
mask that ensures only the appropriate bits are modified.

Therefore, such definitions should just be set to 0x0. In addition, as
suggested by Russell King, we change the _MASK definitions to also use
the BIT() macro so that it is clear they are related to the values
defined afterwards.

For example:

 #define MVPP2_PRS_RI_L2_CAST_MASK              0x600
 #define MVPP2_PRS_RI_L2_UCAST                  ~(BIT(9) | BIT(10))
 #define MVPP2_PRS_RI_L2_MCAST                  BIT(9)
 #define MVPP2_PRS_RI_L2_BCAST                  BIT(10)

becomes

 #define MVPP2_PRS_RI_L2_CAST_MASK              (BIT(9) | BIT(10))
 #define MVPP2_PRS_RI_L2_UCAST                  0x0
 #define MVPP2_PRS_RI_L2_MCAST                  BIT(9)
 #define MVPP2_PRS_RI_L2_BCAST                  BIT(10)

Because the values (MVPP2_PRS_RI_L2_UCAST, MVPP2_PRS_RI_L2_MCAST and
MVPP2_PRS_RI_L2_BCAST) are always applied with
MVPP2_PRS_RI_L2_CAST_MASK, and therefore there is no need for
MVPP2_PRS_RI_L2_UCAST to be defined as ~(BIT(9) | BIT(10)).

It fixes the following warnings when building the driver on a 64-bit
platform (which is not possible as of this commit, but will be enabled
in a follow-up commit):

drivers/net/ethernet/marvell/mvpp2.c: In function ‘mvpp2_prs_mac_promisc_set’:
drivers/net/ethernet/marvell/mvpp2.c:524:33: warning: large integer implicitly truncated to unsigned type [-Woverflow]
 #define MVPP2_PRS_RI_L2_UCAST   ~(BIT(9) | BIT(10))
                                  ^
drivers/net/ethernet/marvell/mvpp2.c:1459:33: note: in expansion of macro ‘MVPP2_PRS_RI_L2_UCAST’
     mvpp2_prs_sram_ri_update(&pe, MVPP2_PRS_RI_L2_UCAST,

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Stefan Roese <sr@denx.de>
---

 drivers/net/mvpp2.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
index 74ae1a2d2a..769680ac45 100644
--- a/drivers/net/mvpp2.c
+++ b/drivers/net/mvpp2.c
@@ -572,28 +572,28 @@ enum mvpp2_tag_type {
 /* Sram result info bits assignment */
 #define MVPP2_PRS_RI_MAC_ME_MASK		0x1
 #define MVPP2_PRS_RI_DSA_MASK			0x2
-#define MVPP2_PRS_RI_VLAN_MASK			0xc
-#define MVPP2_PRS_RI_VLAN_NONE			~(BIT(2) | BIT(3))
+#define MVPP2_PRS_RI_VLAN_MASK			(BIT(2) | BIT(3))
+#define MVPP2_PRS_RI_VLAN_NONE			0x0
 #define MVPP2_PRS_RI_VLAN_SINGLE		BIT(2)
 #define MVPP2_PRS_RI_VLAN_DOUBLE		BIT(3)
 #define MVPP2_PRS_RI_VLAN_TRIPLE		(BIT(2) | BIT(3))
 #define MVPP2_PRS_RI_CPU_CODE_MASK		0x70
 #define MVPP2_PRS_RI_CPU_CODE_RX_SPEC		BIT(4)
-#define MVPP2_PRS_RI_L2_CAST_MASK		0x600
-#define MVPP2_PRS_RI_L2_UCAST			~(BIT(9) | BIT(10))
+#define MVPP2_PRS_RI_L2_CAST_MASK		(BIT(9) | BIT(10))
+#define MVPP2_PRS_RI_L2_UCAST			0x0
 #define MVPP2_PRS_RI_L2_MCAST			BIT(9)
 #define MVPP2_PRS_RI_L2_BCAST			BIT(10)
 #define MVPP2_PRS_RI_PPPOE_MASK			0x800
-#define MVPP2_PRS_RI_L3_PROTO_MASK		0x7000
-#define MVPP2_PRS_RI_L3_UN			~(BIT(12) | BIT(13) | BIT(14))
+#define MVPP2_PRS_RI_L3_PROTO_MASK		(BIT(12) | BIT(13) | BIT(14))
+#define MVPP2_PRS_RI_L3_UN			0x0
 #define MVPP2_PRS_RI_L3_IP4			BIT(12)
 #define MVPP2_PRS_RI_L3_IP4_OPT			BIT(13)
 #define MVPP2_PRS_RI_L3_IP4_OTHER		(BIT(12) | BIT(13))
 #define MVPP2_PRS_RI_L3_IP6			BIT(14)
 #define MVPP2_PRS_RI_L3_IP6_EXT			(BIT(12) | BIT(14))
 #define MVPP2_PRS_RI_L3_ARP			(BIT(13) | BIT(14))
-#define MVPP2_PRS_RI_L3_ADDR_MASK		0x18000
-#define MVPP2_PRS_RI_L3_UCAST			~(BIT(15) | BIT(16))
+#define MVPP2_PRS_RI_L3_ADDR_MASK		(BIT(15) | BIT(16))
+#define MVPP2_PRS_RI_L3_UCAST			0x0
 #define MVPP2_PRS_RI_L3_MCAST			BIT(15)
 #define MVPP2_PRS_RI_L3_BCAST			(BIT(15) | BIT(16))
 #define MVPP2_PRS_RI_IP_FRAG_MASK		0x20000
-- 
2.12.0

  parent reply	other threads:[~2017-03-21 14:27 UTC|newest]

Thread overview: 92+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-21 14:27 [U-Boot] [PATCH v1 00/41] Add PPv2.2 support to the mvpp2 ethernet driver and enable it for A7k/8k Stefan Roese
2017-03-21 14:27 ` [U-Boot] [PATCH v1 01/41] bitops.h: Include bitsperlong.h as needed for GENMASK_ULL Stefan Roese
2017-03-21 15:02   ` Tom Rini
2017-03-21 16:53   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 02/41] net: mvpp2: Round up top tx buffer boundaries for dcache ops Stefan Roese
2017-03-21 16:55   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 03/41] net: mvpp2: simplify mvpp2_bm_bufs_add() Stefan Roese
2017-03-21 16:57   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 04/41] net: mvpp2: remove unused register definitions Stefan Roese
2017-03-21 16:58   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 05/41] net: mvpp2: fix indentation of MVPP2_EXT_GLOBAL_CTRL_DEFAULT Stefan Roese
2017-03-21 16:59   ` Joe Hershberger
2017-03-21 14:27 ` Stefan Roese [this message]
2017-03-21 17:01   ` [U-Boot] [PATCH v1 06/41] net: mvpp2: simplify MVPP2_PRS_RI_* definitions Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 07/41] net: mvpp2: enable building on 64-bit platforms Stefan Roese
2017-03-21 17:02   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 08/41] net: mvpp2: enable building on 64-bit platforms (more U-Boot specific) Stefan Roese
2017-03-21 17:03   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 09/41] net: mvpp2: use "dma" instead of "phys" where appropriate Stefan Roese
2017-03-21 17:04   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 10/41] net: mvpp2: remove support for buffer header Stefan Roese
2017-03-21 17:04   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 11/41] net: mvpp2: store physical address of buffer in rx_desc->buf_cookie Stefan Roese
2017-03-21 17:06   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 12/41] net: mvpp2: add and use accessors for TX/RX descriptors Stefan Roese
2017-03-21 17:07   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 13/41] net: mvpp2: add hw_version field in "struct mvpp2" Stefan Roese
2017-03-21 17:09   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 14/41] net: mvpp2: introduce an intermediate union for the TX/RX descriptors Stefan Roese
2017-03-21 17:10   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 15/41] net: mvpp2: introduce PPv2.2 HW descriptors and adapt accessors Stefan Roese
2017-03-21 17:13   ` Joe Hershberger
2017-03-22  7:11     ` Stefan Roese
2017-03-22  8:03       ` Thomas Petazzoni
2017-03-22  8:13         ` Stefan Roese
2017-03-21 14:27 ` [U-Boot] [PATCH v1 16/41] net: mvpp2: adjust the allocation/free of BM pools for PPv2.2 Stefan Roese
2017-03-21 17:18   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 17/41] net: mvpp2: adapt the mvpp2_rxq_*_pool_set functions to PPv2.2 Stefan Roese
2017-03-21 17:21   ` Joe Hershberger
2017-03-22  7:13     ` Stefan Roese
2017-03-21 14:27 ` [U-Boot] [PATCH v1 18/41] net: mvpp2: adapt mvpp2_defaults_set() " Stefan Roese
2017-03-21 17:21   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 19/41] net: mvpp2: adjust mvpp2_{rxq, txq}_init for PPv2.2 Stefan Roese
2017-03-21 17:25   ` Joe Hershberger
2017-03-22  7:17     ` Stefan Roese
2017-03-21 14:27 ` [U-Boot] [PATCH v1 20/41] net: mvpp2: handle register mapping and access " Stefan Roese
2017-03-21 17:33   ` Joe Hershberger
2017-03-22  7:19     ` Stefan Roese
2017-03-21 14:27 ` [U-Boot] [PATCH v1 21/41] net: mvpp2: handle misc PPv2.1/PPv2.2 differences Stefan Roese
2017-03-21 17:35   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 22/41] net: mvpp2: add AXI bridge initialization for PPv2.2 Stefan Roese
2017-03-21 17:36   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 23/41] net: mvpp2: rework RXQ interrupt group " Stefan Roese
2017-03-21 17:38   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 24/41] net: mvpp2: adapt rxq distribution to PPv2.2 Stefan Roese
2017-03-21 17:42   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 25/41] net: mvpp2: finally add the PPv2.2 compatible string Stefan Roese
2017-03-21 17:42   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 26/41] net: mvpp2: Add MDIO support for PPv2.2 Stefan Roese
2017-03-21 17:44   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 27/41] net: mvpp2: Move probe function from MISC to ETH DM driver Stefan Roese
2017-03-21 17:47   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 28/41] net: mvpp2.c: Clear all buffer / descriptor areas before usage Stefan Roese
2017-03-21 17:47   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 29/41] net: mvpp2: Enable compilation for Armada 7K/8K platforms Stefan Roese
2017-03-21 17:50   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 30/41] arm64: marvell: dts: add PPv2.2 description to Armada 7K/8K Stefan Roese
2017-03-21 17:52   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 31/41] arm64: mvebu: armada-7k/8k: Enable MVPP2 ethernet driver Stefan Roese
2017-03-21 17:54   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 32/41] net: mvpp2: Handle eth device naming in multi-CP case correctly Stefan Roese
2017-03-21 17:56   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 33/41] net: mvpp2: Add remove function that is called before the OS is started Stefan Roese
2017-03-21 17:57   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 34/41] net: mvpp2: Add RX and TX FIFO configuration for PPv2.2 Stefan Roese
2017-03-21 17:59   ` Joe Hershberger
2017-03-22  7:27     ` Stefan Roese
2017-03-21 14:27 ` [U-Boot] [PATCH v1 35/41] net: include/phy.h: Add new PHY interface modes Stefan Roese
2017-03-21 18:00   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 36/41] net: mvpp2: Add Group-of-Ports and Net-Compex configuration for PPv2.2 Stefan Roese
2017-03-21 18:03   ` Joe Hershberger
2017-03-22  7:50     ` Stefan Roese
2017-03-21 14:27 ` [U-Boot] [PATCH v1 37/41] net: mvpp2: Enable PHY polling mode on PPv2.2 Stefan Roese
2017-03-21 18:04   ` Joe Hershberger
2017-03-21 14:27 ` [U-Boot] [PATCH v1 38/41] net: mvpp2: Configure SMI PHY address needed for PHY polling Stefan Roese
2017-03-21 18:05   ` Joe Hershberger
2017-03-21 14:28 ` [U-Boot] [PATCH v1 39/41] net: mvpp2: Remove unreferenced in_use_thresh from struct mvpp2_bm_pool Stefan Roese
2017-03-21 18:06   ` Joe Hershberger
2017-03-21 14:28 ` [U-Boot] [PATCH v1 40/41] arm64: mvebu: armada-7040-db.dts: Change eth1 speed from 2.5G to 1G Stefan Roese
2017-03-21 18:06   ` Joe Hershberger
2017-03-21 14:28 ` [U-Boot] [PATCH v1 41/41] arm64: mvebu: Enable CONFIG_PHY_MARVELL in Armada7k/8k-DB defconfig Stefan Roese
2017-03-21 18:07   ` Joe Hershberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170321142802.24276-7-sr@denx.de \
    --to=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.