From patchwork Thu Aug 10 09:36:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alexis_Lothor=C3=A9?= X-Patchwork-Id: 13349117 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CD09C04FE0 for ; Thu, 10 Aug 2023 09:36:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230335AbjHJJgV (ORCPT ); Thu, 10 Aug 2023 05:36:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232569AbjHJJgT (ORCPT ); Thu, 10 Aug 2023 05:36:19 -0400 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DD01D1; Thu, 10 Aug 2023 02:36:18 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 04A59C000B; Thu, 10 Aug 2023 09:36:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1691660177; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p3NrcZmj+FrNiMy+UF9UWgRSNLTLhtesLJKPB+kr/QU=; b=JRtIGm8xfvwQPZ7IemXHxgVhyqP2j/se21FuzMuMb2IzPhWYctUHiLcMpdNk7iRPHg5p6C l64xih4CmhP6chZYAbEd+DXrXChVEyZ5iXcRaRz62pyjo+sEWETcOsLSo1nk+cvoedYKq3 L7VyArBQCPt//BRkB/A7MAN43SK5OM+qqeiU9uNwjWlYQUaRoTnEM7vhUIP6i8HpCeQanI KIcvXEqNmDJdieUzWW82eoDwlA9X8R/yRaBjwjPzccav3JLQfuOfazhdudnOOfPX4R6EtF KGTI6+Uf16JXYCdeh8ONh+0Z+zPH4kGlgxEOTT06mJ1/c0eq9uiRdApXHVsk9w== From: alexis.lothore@bootlin.com To: =?utf-8?q?Cl=C3=A9ment_Leger?= , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Miquel Raynal , Milan Stevanovic , Jimmy Lalande , Pascal Eberhard , Thomas Petazzoni Subject: [PATCH net-next v5 1/3] net: dsa: rzn1-a5psw: use a5psw_reg_rmw() to modify flooding resolution Date: Thu, 10 Aug 2023 11:36:49 +0200 Message-ID: <20230810093651.102509-2-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230810093651.102509-1-alexis.lothore@bootlin.com> References: <20230810093651.102509-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 X-GND-Sasl: alexis.lothore@bootlin.com Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org From: Clément Léger .port_bridge_flags will be added and allows to modify the flood mask independently for each port. Keeping the existing bridged_ports write in a5psw_flooding_set_resolution() would potentially messed up this. Use a read-modify-write to set that value and move bridged_ports handling in bridge_port_join/leave. Signed-off-by: Clément Léger Reviewed-by: Florian Fainelli Signed-off-by: Alexis Lothoré --- drivers/net/dsa/rzn1_a5psw.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c index c37d2e537230..302529edb4e0 100644 --- a/drivers/net/dsa/rzn1_a5psw.c +++ b/drivers/net/dsa/rzn1_a5psw.c @@ -331,13 +331,9 @@ static void a5psw_flooding_set_resolution(struct a5psw *a5psw, int port, A5PSW_MCAST_DEF_MASK}; int i; - if (set) - a5psw->bridged_ports |= BIT(port); - else - a5psw->bridged_ports &= ~BIT(port); - for (i = 0; i < ARRAY_SIZE(offsets); i++) - a5psw_reg_writel(a5psw, offsets[i], a5psw->bridged_ports); + a5psw_reg_rmw(a5psw, offsets[i], BIT(port), + set ? BIT(port) : 0); } static void a5psw_port_set_standalone(struct a5psw *a5psw, int port, @@ -365,6 +361,8 @@ static int a5psw_port_bridge_join(struct dsa_switch *ds, int port, a5psw->br_dev = bridge.dev; a5psw_port_set_standalone(a5psw, port, false); + a5psw->bridged_ports |= BIT(port); + return 0; } @@ -373,6 +371,8 @@ static void a5psw_port_bridge_leave(struct dsa_switch *ds, int port, { struct a5psw *a5psw = ds->priv; + a5psw->bridged_ports &= ~BIT(port); + a5psw_port_set_standalone(a5psw, port, true); /* No more ports bridged */ @@ -992,6 +992,8 @@ static int a5psw_probe(struct platform_device *pdev) if (IS_ERR(a5psw->base)) return PTR_ERR(a5psw->base); + a5psw->bridged_ports = BIT(A5PSW_CPU_PORT); + ret = a5psw_pcs_get(a5psw); if (ret) return ret;