From patchwork Mon Apr 17 15:17:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13214241 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 58F51C77B76 for ; Mon, 17 Apr 2023 15:19:39 +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:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VX65wKbm1T8XJhplBrHWZSmphFWTxV3SOhvKaTeSsmo=; b=mEw3fsZQkj3nQQ 8YL+vk8H8e0QUMH+QOa7zqroiihLTLueAun0pyqqx63f9hHN8ZRCR1dQt8upkRHA6JQUUEftYL+lI EE3AK4fA+S5s9mPRFSzTDLqKl/sk30vXg8Nd+gjlVQmEgYFIoAPXWpZL+jXobQcv0qDzdqu5LWneM xLk6WFHShlh5iv3L1eoZBzos80U/nqV06JrTvpTe2z1USI6YgdBVooMwzYFG5bJSnkha2lCDrKSzL aXwbpai5eebci1nrGfDG3hhroDnV+iW1setehd1PSp8vXw0IdxQY06/CIf5/0YqaHGPdHXGFJjCm5 BAVxadtlCVv8dPASqOAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1poQcu-00Gos1-1A; Mon, 17 Apr 2023 15:18:44 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1poQcr-00Goqz-18 for linux-arm-kernel@lists.infradead.org; Mon, 17 Apr 2023 15:18:42 +0000 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-2efac435608so1514726f8f.3 for ; Mon, 17 Apr 2023 08:18:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681744717; x=1684336717; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=k1MW6xivzd352Exo6BdAvt5sq+6GrYH5KFNVqtE0mY4=; b=Z76/rwOAOzlCNPMvtwsPc95hcbuhG7GML/sUigWaLACArj62a9yF7sWrPfhSrSK2En jKiHl2xRx5JVtGPVmB/2wst28I8Sk0dHEkvD6N07F9QVXD0qbmSH2DI9zldH8QzISyo0 CleUj9QyBl5ze+34wyIQZ+95tWZwTUckG95Y9Et3m/5UCo5cagoDPgBOW/ZbCEp8KVEO WC289cFr7Gc2trt/hALwEaQbL9cSjevEkRNi0ykCUrYXyM97mthjBSUCHHzo8EhzVQn/ uY0V1mWmTZWYZZ8/ZRc2NoFev87B9mvN3ytEyhEtup9gOUl1gmtELDh2z3WcvFG2rmFb zfrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681744717; x=1684336717; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k1MW6xivzd352Exo6BdAvt5sq+6GrYH5KFNVqtE0mY4=; b=lr+hKgigPx7MO17veqNSt0GnHMjONPdHexRpat3+TPkp4cyN2MeugfXFaWhfGvSmNq PGJ4K/LniXa/CcLy/wORZ3LxLdCTlW5LP+DMqkoUiNpiqkWXumAGI5D5ngM8I3tvWh6q G8oy9hIAz9YMZIwJWPv2yIodmOsWjot1Q8xp2x652AKJnfkLiRnWINEmjv/UGKBS/eT7 oWj0JjXoAq999rOvgWsrqYxX3Kn44YcYiW/3jTpSA/HxXtrNOHSlLpaH+9n9Un6v7PWe drCPRaG47ZTz2ImlyRnZxAUSdSGo+cXrKKX2TDRr4W4hpSP1k0bgEaLyDAFM6BRsyhXd to3w== X-Gm-Message-State: AAQBX9cR5gVxnqWDz07xA+H77tiLA0112qlghkEo/X93sULvsTu9FQNL 5R/SMIokiAV2I9aaYMUXPP0= X-Google-Smtp-Source: AKy350YfdukjmZAn6zy7Y3dzj+UEoeFI/PVFj+jnOKCyq4V8KA9k1cD0MZFo0ouLfAB5+j7uo6k0tw== X-Received: by 2002:a5d:6289:0:b0:2f9:357:bb5a with SMTP id k9-20020a5d6289000000b002f90357bb5amr5264134wru.25.1681744716939; Mon, 17 Apr 2023 08:18:36 -0700 (PDT) Received: from localhost.localdomain (host-87-7-13-196.retail.telecomitalia.it. [87.7.13.196]) by smtp.googlemail.com with ESMTPSA id j15-20020a05600c1c0f00b003f173be2ccfsm3501354wms.2.2023.04.17.08.18.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 08:18:22 -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 , Jonathan Corbet , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Pavel Machek , Lee Jones , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-leds@vger.kernel.org Cc: Michal Kubiak Subject: [net-next PATCH v7 01/16] net: dsa: qca8k: move qca8k_port_to_phy() to header Date: Mon, 17 Apr 2023 17:17:23 +0200 Message-Id: <20230417151738.19426-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417151738.19426-1-ansuelsmth@gmail.com> References: <20230417151738.19426-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230417_081841_388211_C406194C X-CRM114-Status: GOOD ( 13.91 ) 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 Reviewed-by: Michal Kubiak Reviewed-by: Florian Fainelli --- 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 62810903f1b3..20acbd0292f1 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -772,21 +772,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 7996975d29d3..dd7deb9095d3 100644 --- a/drivers/net/dsa/qca/qca8k.h +++ b/drivers/net/dsa/qca/qca8k.h @@ -421,6 +421,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;