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: 13180536 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 F0B2AC6FD1F for ; Sun, 19 Mar 2023 19:19:46 +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=xEatw8NiAwRNMq8oXQSjVC04CQb8I2k+PgECquqt7bw=; b=fhLm8Fxot/SYsS Cbgyw5w3Z2q/opA/t5wrgX4QnR0cI33tBQwnMRbT11QPbRmTMJT6NbKaRhF68e1ZTPJKXJ8pIOmMJ c6CXpymGQy0wtcR/gc5GcsFb3lDwVD+d0zLB/gP2Wh49fvuNXzGITIHSHOhLrHIR6vtImMaGGpVeM TqNneKo5rSJoeneMJaukHvOMj/kKvI5PkdDzZYWUXcotRV/hr8vTnw2aDtFnni86seFOG3c4SRUVO UpghInH0uawSCvyaMjhrMR8ni0DW9kZW4+FreX3Dl8ORF8PxN4BmxQNwspISvKmRK90w0bNB3JxS0 PhCLElYIoGdAWXipIz8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pdyYK-007Ec7-0J; Sun, 19 Mar 2023 19:18:48 +0000 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pdyYA-007EYk-1b for linux-arm-kernel@lists.infradead.org; Sun, 19 Mar 2023 19:18:39 +0000 Received: by mail-wr1-x42a.google.com with SMTP id v1so2417506wrv.1 for ; 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=TcQj0BMPwDW1M3kZDQJtEfN4PHt9IktUmeoOUSPl0DaocW6iE6IaVaNSoKYiFUJ9bj wjzH3OIuklgxNbCzabeNB7CSOMPjMuqMUA+WQ16esMmOTvS0YWwm8lXhcayYw14uU1/M q/ezxS29HMxTp3PJpGbcGBi55GRKKfT13FJwNIO+C0cH07fxK8x1KSdBKGSWOxQvibz/ JD1Flb1ASE+RgOiTBHcT8mDtBw4F0+ddp1yRjSezOk/rBCHUOC9n2wIMVTO+xsRxTPWv dXTXJtFz3LWzO4TnWKbGaVP6fhL7znl+GkBB1j2PGc6cY52TzTeynKAHv84xAUb47F8F 9BhA== X-Gm-Message-State: AO0yUKU5hP2gRYTqLPfJntvtOaOqAS4d7xf/xLvXzB6YwnIckioapDS6 CGnBhPztRZf/9U37Rg3IZO8= 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230319_121838_534239_3029BDC4 X-CRM114-Status: GOOD ( 14.30 ) 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 --- 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;