Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp365283lqp; Tue, 11 Jun 2024 06:59:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWKIOYc37zndqeNX6GDA16WwuABeFwchqXgP4iu+QbQLfZr21UCjMNLj1hh0P9p7qeK7dK+SBPRcMTFoRdtAA6Dp08NKLpsDPiDalFabQ== X-Google-Smtp-Source: AGHT+IE5vyr3sHgewE1CiXIuwNZSW0ZYhX8//Oz1AhU0p7kXyXOrqE37W0SdP73LoJgH74zvaigo X-Received: by 2002:a05:6a00:2d9b:b0:704:34c2:b09d with SMTP id d2e1a72fcca58-70434c2b426mr7268382b3a.23.1718114350352; Tue, 11 Jun 2024 06:59:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718114350; cv=pass; d=google.com; s=arc-20160816; b=NQ54OLTmnV/Irggqdh9mg+twsTQCxlbvqVf8n+G0USziWef4FHlfqFAwAqHiPrkmjR WeUTDPrZRg4uJ6DXcC17Wsn7HeIF1/cHcymC+HoYwSvUxbBX7o1PE19+DrgsOWwmUIdK S4pQm/vAV2oBReumZAisEtIozW/nv+Xs574BWIfJEpPPXDzI5uOb7UgC3kF5NWJ45hn4 rjvWgXm5bNnK0PO5SWi+AWCpXdN8Fk2qyhlotl43ms/5iCAPgqhyNFkia7z5nPb8Ks8P Xbcb28mu3PYu+OHGQg66ytsm0+44VmGLFrV6RbRTY5nIuAdbtgDayAq1ZKJc6wbTr9XV BSlQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=/s/qF7FnnCFgjRP5iPJ5LGokfXj6Ijvw0A1GU5RZHPc=; fh=Lh+JMPZo65h8qJAnE5jHWvKtvWM25xS7kSTjy8t+qRE=; b=q773AzzoRg4fTg/ODpip1ii8yjwpGN1viYhgOAVxCC/ZVb6BX5g1gQPd0HOshH6AFF rwB9xElXJ4T3g7KKkhmMKWF8vTSnZPjp0OnPV7PM8LC4uJ5GHbd/2/zzTkB0+Ic/sOJU 9S4739xzm1m+9KZ6uiqPOr5jI/fCJD7PLYK0RAnI6r9CeoT8xQY48ueTUe2Uh4MCu+o1 CmLTNEnf5rIjHpRI1BHg15sKAFjmWWPLcdKpeoCqcLvztq2j7IRF5At3mPdnoaPrPUmO +9ZspEoZyL4c9CfHXxmVoHXU2QBIm1lzJBqDiiaAvNFc7gAz1v4gDEqvE3i6K6VLuqgS 81+w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=dev.tdt.de); spf=pass (google.com: domain of linux-kernel+bounces-210015-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210015-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6e41e5966b9si7402100a12.668.2024.06.11.06.59.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 06:59:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210015-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=dev.tdt.de); spf=pass (google.com: domain of linux-kernel+bounces-210015-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210015-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3096A288DA7 for ; Tue, 11 Jun 2024 13:57:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C72FC17F4E3; Tue, 11 Jun 2024 13:55:43 +0000 (UTC) Received: from mxout70.expurgate.net (mxout70.expurgate.net [194.37.255.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA6DB17D351; Tue, 11 Jun 2024 13:55:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.37.255.70 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718114143; cv=none; b=tniyf7tn58MUfy0PvU0MQ/fgeZ3YoAtJFHCadK+wLqSqvozMhK7o6OBFaA2S5YaWn3dfuBERxNLuzIN3LFpbGP/pO3emXEJ0BCuN5SZKRvSkC84aqwi+pTow3yXEAQVaKILXOLXx7p7xCW/KCHburWDxHm3Q7JgQ6KLjo6o64sA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718114143; c=relaxed/simple; bh=kxwZ0cw+FzmbsarNoyILQQVuOInUJpunM/01+HV2TG4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=f8vncTh3B2Ci4nYY5Clzav8fK+3VnSoahm1ZVaWlI5p1wAvkZuDddmU8eW+F++ZjiEiw7bVkYXkAzeKbuYb7wSwH8e2J5ayJdPHLDGT32BpfTOCUNnzF8EervHEyKiTW4DcYZ8DzjCwaOVuP+C8nHlVER4Gi2k0WzYr4DHrBKK8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dev.tdt.de; spf=pass smtp.mailfrom=dev.tdt.de; arc=none smtp.client-ip=194.37.255.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dev.tdt.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dev.tdt.de Received: from [127.0.0.1] (helo=localhost) by relay.expurgate.net with smtp (Exim 4.92) (envelope-from ) id 1sH1yN-0036Ac-RR; Tue, 11 Jun 2024 15:55:39 +0200 Received: from [195.243.126.94] (helo=securemail.tdt.de) by relay.expurgate.net with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sH1yN-00ABLo-AE; Tue, 11 Jun 2024 15:55:39 +0200 Received: from securemail.tdt.de (localhost [127.0.0.1]) by securemail.tdt.de (Postfix) with ESMTP id 0C844240053; Tue, 11 Jun 2024 15:55:39 +0200 (CEST) Received: from mail.dev.tdt.de (unknown [10.2.4.42]) by securemail.tdt.de (Postfix) with ESMTP id 9721B240050; Tue, 11 Jun 2024 15:55:38 +0200 (CEST) Received: from mschiller1.dev.tdt.de (unknown [10.2.3.20]) by mail.dev.tdt.de (Postfix) with ESMTPSA id 0B6B4376FA; Tue, 11 Jun 2024 15:55:38 +0200 (CEST) From: Martin Schiller To: martin.blumenstingl@googlemail.com, hauke@hauke-m.de, andrew@lunn.ch, f.fainelli@gmail.com, olteanv@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, ms@dev.tdt.de Subject: [PATCH net-next v5 06/12] net: dsa: lantiq_gswip: do also enable or disable cpu port Date: Tue, 11 Jun 2024 15:54:28 +0200 Message-ID: <20240611135434.3180973-7-ms@dev.tdt.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240611135434.3180973-1-ms@dev.tdt.de> References: <20240611135434.3180973-1-ms@dev.tdt.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-purgate-ID: 151534::1718114139-A986834D-640E0AD8/0/0 X-purgate-type: clean X-purgate: clean Before commit 74be4babe72f ("net: dsa: do not enable or disable non user ports"), gswip_port_enable/disable() were also executed for the cpu port in gswip_setup() which disabled the cpu port during initialization. Let's restore this by removing the dsa_is_user_port checks. Also, let's clean up the gswip_port_enable() function so that we only have to check for the cpu port once. The operation reordering done here is safe. Signed-off-by: Martin Schiller Acked-by: Hauke Mehrtens --- drivers/net/dsa/lantiq_gswip.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswi= p.c index c1f9419af35f..8ec329d0c136 100644 --- a/drivers/net/dsa/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq_gswip.c @@ -695,13 +695,18 @@ static int gswip_port_enable(struct dsa_switch *ds,= int port, struct gswip_priv *priv =3D ds->priv; int err; =20 - if (!dsa_is_user_port(ds, port)) - return 0; - if (!dsa_is_cpu_port(ds, port)) { + u32 mdio_phy =3D 0; + err =3D gswip_add_single_port_br(priv, port, true); if (err) return err; + + if (phydev) + mdio_phy =3D phydev->mdio.addr & GSWIP_MDIO_PHY_ADDR_MASK; + + gswip_mdio_mask(priv, GSWIP_MDIO_PHY_ADDR_MASK, mdio_phy, + GSWIP_MDIO_PHYp(port)); } =20 /* RMON Counter Enable for port */ @@ -714,16 +719,6 @@ static int gswip_port_enable(struct dsa_switch *ds, = int port, gswip_switch_mask(priv, 0, GSWIP_SDMA_PCTRL_EN, GSWIP_SDMA_PCTRLp(port)); =20 - if (!dsa_is_cpu_port(ds, port)) { - u32 mdio_phy =3D 0; - - if (phydev) - mdio_phy =3D phydev->mdio.addr & GSWIP_MDIO_PHY_ADDR_MASK; - - gswip_mdio_mask(priv, GSWIP_MDIO_PHY_ADDR_MASK, mdio_phy, - GSWIP_MDIO_PHYp(port)); - } - return 0; } =20 @@ -731,9 +726,6 @@ static void gswip_port_disable(struct dsa_switch *ds,= int port) { struct gswip_priv *priv =3D ds->priv; =20 - if (!dsa_is_user_port(ds, port)) - return; - gswip_switch_mask(priv, GSWIP_FDMA_PCTRL_EN, 0, GSWIP_FDMA_PCTRLp(port)); gswip_switch_mask(priv, GSWIP_SDMA_PCTRL_EN, 0, --=20 2.39.2