From patchwork Sun Mar 19 19:18:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 665061 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 6D42DC6FD1F for ; Sun, 19 Mar 2023 19:18:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229928AbjCSTSp (ORCPT ); Sun, 19 Mar 2023 15:18:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229771AbjCSTSi (ORCPT ); Sun, 19 Mar 2023 15:18:38 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93B2314233; Sun, 19 Mar 2023 12:18:37 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id y14so8526012wrq.4; Sun, 19 Mar 2023 12:18:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679253516; 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=GZlbVr+kRuncwwnT6LLkn+z1GbeVbbgNOpIQsx+kap4=; b=kGfhcZ29TV1AFihf/U0KwX6O19Vt2sziL8rPM/vaeQilQmSKIWRZAt2SLxmNjtmO7L i3zK9opWElQcVKvfzD01lD5m5uloElPA2CjfBqTlo6D12B8ABcueS1smdqHEWlLJIrDK e2J+kJIfunRuRasi791pEc//OKALLWO2VtHvgMvAz9dNuHKI6gf04uYtAdDehVqVoGS4 dvfZG6c+Rgk6VsGZ66BrTtJ+S2/kf8uOkAwwD61q9L8cI0Gbdg90qxIrJAE9kNqE6OSq XYT3YSrOtwVu77Xo0l0x7rNvfEnqjlpkKsnUBNM60C/doWjEhn5XFSaElP+GB7TisBtc xSTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679253516; 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=GZlbVr+kRuncwwnT6LLkn+z1GbeVbbgNOpIQsx+kap4=; b=00AIOKgTgwdP3Io/iMpCbeoyx/hK5YnCW/ZgpMoMvkRpai3fkxGAxln2sQ1+mPUN4D lKkpbdBiTxSXWdg+aBbIe7V1JkvT2KTMrLkCm988p0EcKOKuW77eHLaZfuGt9mxbMvah amt1Z3nkbxq1KVWx5AK/8f0hETmUq7u9SNc9cHjp1Rx1v+CY71uM7ne6kpgfgM8PPJx6 7/M2uc+pOAkT4eA7Sm7D4CorS9AWaDnROpiFA9xsNfDNCEo38wfPvNSptssQMzdgJJBe c2UBbB28lIi2SwQrFWbpvnugXuMzVyxFx51WgboX5IL3wNrgOsTufyHDklw+2dEJFSgr 4qhw== X-Gm-Message-State: AO0yUKWeNZ+QvMez4LHVPAgiJf0kfGWL9V86WQRnTXfbn/J3S5BD7lyW 7IpnjbQDsXEuRmB7MH3NbM0= X-Google-Smtp-Source: AK7set8ciMx8i3EllThIErYmn4MqYzNrnB1JWZ6MJqeJ2mbh9EnOe5oCp1IsfnAuKPvWQvcoD6976A== X-Received: by 2002:adf:f2ce:0:b0:2cf:f44e:45e1 with SMTP id d14-20020adff2ce000000b002cff44e45e1mr11248548wrp.19.1679253515935; Sun, 19 Mar 2023 12:18:35 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id b7-20020a5d4b87000000b002cfe0ab1246sm7165167wrt.20.2023.03.19.12.18.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Mar 2023 12:18:35 -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 , Pavel Machek , Lee Jones , 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, linux-leds@vger.kernel.org Subject: [net-next PATCH v5 01/15] net: dsa: qca8k: move qca8k_port_to_phy() to header Date: Sun, 19 Mar 2023 20:18:00 +0100 Message-Id: <20230319191814.22067-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230319191814.22067-1-ansuelsmth@gmail.com> References: <20230319191814.22067-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.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 --- 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 55df4479ea30..459ea687444a 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;