Message ID | 82f84ef9850bddf5a855f568594c403270a08249.1680483896.git.daniel@makrotopia.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2006012vqo; Sun, 2 Apr 2023 18:41:59 -0700 (PDT) X-Google-Smtp-Source: AKy350ZCSyJR6+xV5SNran7p0zoFS2dCr2iEPmzQWyczUf77Fm+Rd2x9+0ukPGvjTCTA9RjPlw7q X-Received: by 2002:a17:906:b349:b0:931:91a:fa4f with SMTP id cd9-20020a170906b34900b00931091afa4fmr37486673ejb.41.1680486119075; Sun, 02 Apr 2023 18:41:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680486119; cv=none; d=google.com; s=arc-20160816; b=MlXNWeR+MiNM+cV7mN/OD3VnhAJ1OJBqamD2OTfn9FRxjlwhefdwpKsnNJpKaBnaSK lcCYC0QY8AMrAFYSstGfCITdPzA8vjOXO3OY1X8BCye6w7Xgggae38AnYjQL8B3IhHKm YFDL7GdrCicmzco2Ly2B4TFiCerkTtITtFluHRTsYrhcYWE004/JBNSGcSIUWQreiBEs bWARN4/AZDYet7tOY2IWemTh1AYJmbd8rPmcD4WldFwKdx1RRjnN4BhgIHuRGSSHV7hG 9oMwy8uNWVN/MZ/x/mKZYgwtN9YrWNNimmfCqZHoGP4czRGHKXlxKJ9g+XtSr7b3cC0N 9TTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=CTGyR7LCQoy96a9ILhwN+Ycbc1fuDFmtWGjFfBaYhbs=; b=e5IRQ1g4Ssmxx2d/iTUfQ+skIw8xuBh5/dbwjNPFZnN9W8h8vZMsU2lIt2rtdo/+3C nw46wW6CpRN2a7OAuLVEONTGnPv3vtphhQ/aZKlRkKUZ9LfBcFgrI42KSXEO0eoDmfgy Rb8p9f/C+a6MwRLBBdsC8MotpzdOD2Z1tdOI0K2aVp/UjP7P1PMB/Zfn5SMKvLUj4fFG 4NI1UdHx+8qAmUMWR4GW/2shjh8K938EnDDQ7JUc0BUgQ9T/98hyUX9TVf+xv0rVgbdq ACaM2CRAqiY3YFtHrNkxERGietJpo2WxKft/3S7UFtvk7yWGwXLB+MZQBY3oPHlaTVZ5 /UsA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id uz29-20020a170907119d00b008e0363188e3si4056070ejb.953.2023.04.02.18.41.35; Sun, 02 Apr 2023 18:41:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231341AbjDCBUM (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Sun, 2 Apr 2023 21:20:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231282AbjDCBTy (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 2 Apr 2023 21:19:54 -0400 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A983C5FFF; Sun, 2 Apr 2023 18:19:34 -0700 (PDT) Received: from local by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from <daniel@makrotopia.org>) id 1pj8r6-0004nc-1Z; Mon, 03 Apr 2023 03:19:32 +0200 Date: Mon, 3 Apr 2023 02:19:28 +0100 From: Daniel Golle <daniel@makrotopia.org> To: netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>, Florian Fainelli <f.fainelli@gmail.com>, Vladimir Oltean <olteanv@gmail.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, Sean Wang <sean.wang@mediatek.com>, Landen Chao <Landen.Chao@mediatek.com>, DENG Qingfang <dqfext@gmail.com>, Philipp Zabel <p.zabel@pengutronix.de>, Russell King <linux@armlinux.org.uk>, =?utf-8?b?QXLEsW7DpyDDnG5hbA==?= <arinc.unal@arinc9.com> Cc: Sam Shih <Sam.Shih@mediatek.com>, Lorenzo Bianconi <lorenzo@kernel.org>, John Crispin <john@phrozen.org>, Felix Fietkau <nbd@nbd.name> Subject: [PATCH net-next v2 12/14] net: dsa: mt7530: skip locking if MDIO bus isn't present Message-ID: <82f84ef9850bddf5a855f568594c403270a08249.1680483896.git.daniel@makrotopia.org> References: <cover.1680483895.git.daniel@makrotopia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <cover.1680483895.git.daniel@makrotopia.org> X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762117412959372792?= X-GMAIL-MSGID: =?utf-8?q?1762117412959372792?= |
Series |
net: dsa: add support for MT7988
|
|
Commit Message
Daniel Golle
April 3, 2023, 1:19 a.m. UTC
As MT7530 and MT7531 internally use 32-bit wide registers, each access to any register of the switch requires several operations on the MDIO bus. Hence if there is congruent access, e.g. due to PCS or PHY polling, this can mess up and interfere with another ongoing register access sequence. However, the MDIO bus mutex is only relevant for MDIO-connected switches. Prepare switches which have there registers directly mapped into the SoCs register space via MMIO which do not require such locking. There we can simply use regmap's default locking mechanism. Hence guard mutex operations to only be performed in case of MDIO connected switches. Signed-off-by: Daniel Golle <daniel@makrotopia.org> Reviewed-by: Andrew Lunn <andrew@lunn.ch> --- drivers/net/dsa/mt7530.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index ac485ee83ed07..394fada7ddf13 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -144,13 +144,15 @@ core_write_mmd_indirect(struct mt7530_priv *priv, int prtad, static void mt7530_mutex_lock(struct mt7530_priv *priv) { - mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED); + if (priv->bus) + mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED); } static void mt7530_mutex_unlock(struct mt7530_priv *priv) { - mutex_unlock(&priv->bus->mdio_lock); + if (priv->bus) + mutex_unlock(&priv->bus->mdio_lock); } static void