From patchwork Fri Mar 17 02:31:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13178443 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 36CC1C74A5B for ; Fri, 17 Mar 2023 02:35:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RYLfsmQ/xRPUUdM5q7nNeYaZsKr4m2rzA06oDphDbBk=; b=3cPxHeq+e9ZvTD 7mb6GbBF9MsHf1f3GvQiJp3yFo06JCvZSp8wwhydioqJSlt9rjUskiD9KmwXzZ3dshoVkH4Mpx9Wv pdi7q8USAMVp2TjdhS5f6vpywGjUNS6EfxmhSENHVvMmLWJxlrJGNMySqBdAvyEhP0XZy+uDhA7XG 2fSG4dIBXnvm2V/1tGAj3+3VtgVbqy4qEe/swb2F0Y87MTd2SsfNAy0UdDdjg76AD+LBpZpgsfXDD y+NGguHy9WWedvSxsgWCut33RlIbbuDiQRe3cNtnsX3dZmEkA+PvJ+MZjjSPk5F/Arl+So2A3mI+E KU9dbUNlS2Tde1sS9vyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pczut-000fFP-19; Fri, 17 Mar 2023 02:34:03 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pczuT-000f3x-0u for linux-arm-kernel@lists.infradead.org; Fri, 17 Mar 2023 02:33:40 +0000 Received: by mail-wm1-x32d.google.com with SMTP id j42-20020a05600c1c2a00b003ed363619ddso2707929wms.1 for ; Thu, 16 Mar 2023 19:33:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679020401; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ymG14CaAzsom/NpfgXxdIjVcFWXkyKWBzQS1t9W8TsU=; b=ZnLfPimuNMRCq+vueikd9c51+25vJac2ZxxU7UyB76QTmrEIwo4rN+PyOOWNsvEoaj Jpk2GQC59J0kpQPcP4jlt+pBegpHzcQs6kh34OmzoU3nzzmauNRSFH96dVwUqrKqwO1J DR3CoZhP+vfNFcJET39aGxyGhiakx+KWxKqc+BVFrSlps7tyjCZJ+aMqv/hESueQcCW5 86DbqSuK0vu9AGUfCmv2UZkJQhivnD5SN5YoBUBk0UK0W4waKdMM4f7UdCROArjIZPZR e9u9xV6K7b65yrY8SOtrKbAfXKCOwPdLSi/d8lpeL9OBJrxV1MZTaeL5iHskCQsBiGVy BOzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679020401; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ymG14CaAzsom/NpfgXxdIjVcFWXkyKWBzQS1t9W8TsU=; b=ctPpuGdCM7YvNDfrWl8D+7q4BdgiRwYPr6Sy9zqztkKdWvm3CLDgPGwZWIuXvE2lJK c6xKRlIyubIk4SZvHQvr27BPLaT2bCOHynSbvcWV+NQ/mAMjl3HBd7QfF/5yyit+Ftww D1P6gJEgUnBX2aKFEskrdso/FaMt+MvPoRoRSY4tLWBAuppjgfuDRV0zpIveTusoX20i sOfUT7a2yM4EggHjghDr8KeV/OtxSroLyUKWECc+fJkgRviZmIUi/M4I9W1wcYRpXiJE HIrcM1hrAXLXnIsEXEDyBpTBKrE/RNbKeu6WjzaqVSXB/Jd4YJzikx0OmjSiWbGJQH8V DGfw== X-Gm-Message-State: AO0yUKWU+tKtoZ4XAYaOsIAnsFY478Uq+5y9mhGzXoPPg3i3oNzcBIwS iOr0FL+hkebkSb1OmMG98+k= X-Google-Smtp-Source: AK7set90zN/Pajq1elk40QOIzkhud0Nl/bWmI2MgiOSNGVnEUw+fEjcL397+mkdD/mEEhTY3UR+VpQ== X-Received: by 2002:a05:600c:5487:b0:3ed:418a:ec06 with SMTP id iv7-20020a05600c548700b003ed418aec06mr5342265wmb.28.1679020401323; Thu, 16 Mar 2023 19:33:21 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id z15-20020a5d44cf000000b002ce9f0e4a8fsm782313wrr.84.2023.03.16.19.33.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 19:33:21 -0700 (PDT) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v4 01/14] net: dsa: qca8k: move qca8k_port_to_phy() to header Date: Fri, 17 Mar 2023 03:31:12 +0100 Message-Id: <20230317023125.486-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230317023125.486-1-ansuelsmth@gmail.com> References: <20230317023125.486-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230316_193337_319655_1DD6FCE2 X-CRM114-Status: GOOD ( 13.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Move qca8k_port_to_phy() to qca8k header as it's useful for future reference in Switch LEDs module since the same logic is applied to get the right index of the switch port. Make it inline as it's simple function that just decrease the port. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/dsa/qca/qca8k-8xxx.c | 15 --------------- drivers/net/dsa/qca/qca8k.h | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c index 2f224b166bbb..8dfc5db84700 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -716,21 +716,6 @@ qca8k_phy_eth_command(struct qca8k_priv *priv, bool read, int phy, return ret; } -static u32 -qca8k_port_to_phy(int port) -{ - /* From Andrew Lunn: - * Port 0 has no internal phy. - * Port 1 has an internal PHY at MDIO address 0. - * Port 2 has an internal PHY at MDIO address 1. - * ... - * Port 5 has an internal PHY at MDIO address 4. - * Port 6 has no internal PHY. - */ - - return port - 1; -} - static int qca8k_mdio_busy_wait(struct mii_bus *bus, u32 reg, u32 mask) { diff --git a/drivers/net/dsa/qca/qca8k.h b/drivers/net/dsa/qca/qca8k.h index 03514f7a20be..4e48e4dd8b0f 100644 --- a/drivers/net/dsa/qca/qca8k.h +++ b/drivers/net/dsa/qca/qca8k.h @@ -422,6 +422,20 @@ struct qca8k_fdb { u8 mac[6]; }; +static inline u32 qca8k_port_to_phy(int port) +{ + /* From Andrew Lunn: + * Port 0 has no internal phy. + * Port 1 has an internal PHY at MDIO address 0. + * Port 2 has an internal PHY at MDIO address 1. + * ... + * Port 5 has an internal PHY at MDIO address 4. + * Port 6 has no internal PHY. + */ + + return port - 1; +} + /* Common setup function */ extern const struct qca8k_mib_desc ar8327_mib[]; extern const struct regmap_access_table qca8k_readable_table;