From patchwork Mon Mar 27 14:10:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13189454 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 0C61AC76195 for ; Mon, 27 Mar 2023 14:12:35 +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=1Rdwvew+siEBVbdiJh+xVqMsF+ccdjtmy0rWMMWtqA0=; b=mU9DtV9BGH0TW+ Iugznn6IpVpsLUDYaYISlBpXROHWIpev1C+fm83SMXW9uqFgK2p32w2uLfatpzbFT3s1UdY/jbPc+ 9pGcAQ4mNqyEkxsY931ao03MKvbSQG0qdF7qs0909Mdw9MM6RRPt8WtYqeQQOE1xPAkuXsfWaSjPp 2WMIRbXbPOzflnlknGlyOE3cZLHArOB7j/qLvLN8nEI1m5usG+VrT2+VcyWimJHXu3RBPI2/i7E66 t16zV+tIiqPzgwta+3rseOL4KoTAoMin7kmIYhhkjLcyd/io1nYk4OtfP0bTB0KWWKdQdqIflIhMR R1IN7EucOWTSgoFpcqeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pgnZE-00BEV9-2c; Mon, 27 Mar 2023 14:11:24 +0000 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pgnYs-00BEFF-1x for linux-arm-kernel@lists.infradead.org; Mon, 27 Mar 2023 14:11:04 +0000 Received: by mail-wr1-x436.google.com with SMTP id t4so3712977wra.7 for ; Mon, 27 Mar 2023 07:11:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679926260; 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=sVb+VQvq+8Sp9A/ftRiE2SBUlVZOPfZp868HAFVyi3c=; b=CSyUh1s0w5yFDOYYim2gDh/XdZVgY4x5WIM7D9EFchqjrBGIoB/cqSyoJtTYOODyai 7MpTyay9H1Y3VKimKvpTwkv3cA+qV7X6XDG+lQdFpfJ3uYJbZBTVvKso5gIK8rkMTfeW q+j+cMzVlGa7iyNMhrOXFzryqnRZoUoof9+Q3uk1jzn8Z9iKyLwz5fxYpm9Alm61T77d eoEcAcRHjuUUuD+zDASjwY1Vu9Jd5xJ2vp2uoHsR+Lp5pNhybmATSM1K0aTo6GZM6jET jGmktpw48fOPtcC2ZNFfrIx+xqqTdZzBfUI3QPyg1gjoDbCYP1VsnIBJ+CsRdjXQFbnJ HhmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679926260; 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=sVb+VQvq+8Sp9A/ftRiE2SBUlVZOPfZp868HAFVyi3c=; b=ALUVByqg6cX0NTdoFupU7DjnpPyybCamiZmIrUZcV4F1TFIfqz1nTqYgznegR5USkf GJJmiyQfBh/NHaJlWHEjkMqPmhnivz7isPlSBzJeyU4byOL00LpZqunStQaMh/JFRu7R yjoHRFNlUo3s7ShXlf+hvge2ezt3eEMJyq5yMw+fM9LylJ48SfRvOw86vyEGpajdC7Hl damLa58M96phj25qZ9xymGMSMO3uqfIXeobtM8bUl/MhrAuqjqswKn7oDZf8InnYsyZx rVzT4jTxsPku8KsoLhJOwn/oRLIJtvyyKqTbD3gFNiIK4ULfQHmRaBjXZ2AILcXrdQge cCrg== X-Gm-Message-State: AAQBX9fzT26g8yD48XAG3dsBwF/QM+wDdLk3ZlXq/YKRCtPqAFGGTpSL hvVHWHn+kBL7OgtYW5kqOfY= X-Google-Smtp-Source: AKy350aDLHalH3aNV282D1N2/QiTPAFTdA8GfvAaGOScx9xjF+NAVltJg896kFvtPuTG4kFRcOWNAw== X-Received: by 2002:adf:e90c:0:b0:2cf:eeae:88c3 with SMTP id f12-20020adfe90c000000b002cfeeae88c3mr10206818wrm.32.1679926259563; Mon, 27 Mar 2023 07:10:59 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id p17-20020adfcc91000000b002c71dd1109fsm25307591wrj.47.2023.03.27.07.10.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 07:10:59 -0700 (PDT) From: Christian Marangi To: Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Cc: Michal Kubiak Subject: [net-next PATCH v6 01/16] net: dsa: qca8k: move qca8k_port_to_phy() to header Date: Mon, 27 Mar 2023 16:10:16 +0200 Message-Id: <20230327141031.11904-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230327141031.11904-1-ansuelsmth@gmail.com> References: <20230327141031.11904-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230327_071102_649064_A8F2BB5B X-CRM114-Status: GOOD ( 14.21 ) 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 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;