From mboxrd@z Thu Jan 1 00:00:00 1970 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 59D13C678D5 for ; Tue, 7 Mar 2023 23:22:14 +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:In-Reply-To:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=45oRxLVpdo1L4UITvaQWmsk5YvxwOcSC66GZmItPy+Q=; b=XzFF+b2bDiAXyv G3GUusYR9K0AAr7YZZVNBaE1UIEIHuxgIBet2RDkvervc6XXE9BjMkfntDbwtNbhBASRE64cKPqjr kz2PqYE3wvjhxH6GUkMCJ05gCPpoFmXoE/dyPDSjHhI/ct7fD1scd9vgeOsoiF6TigrMXvkL9qBbD y7rPZnIqd5W9LxGht3JsVVUFUS5WMz8bOaNXKMeOII7DY5k3+ZlGTk67tsllcWUU44v7kzXgrxTfH LxWpNNs82ctv3gn0g2cl5dlnfjKUwFNJCOBFKeAhr2ZY97C/i2/HGedAcA6IavF4AJPoR2HqO/5M0 SNlMXIur79l0UmyV7Y8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZgcS-002q6e-Et; Tue, 07 Mar 2023 23:21:20 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZgcP-002q5I-7K for linux-arm-kernel@lists.infradead.org; Tue, 07 Mar 2023 23:21:18 +0000 Received: by mail-wm1-x333.google.com with SMTP id l7-20020a05600c4f0700b003e79fa98ce1so132675wmq.2 for ; Tue, 07 Mar 2023 15:21:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678231275; h=in-reply-to:content-disposition:mime-version:references:subject:cc :to:from:date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=HYZwdboZtaofkxYF/AMrNWZjuYShpz74P+9J9F7wGPo=; b=IE/EuwubCFwIUiQ1UCE4AQ9bBvgVDhBE1KKV+0aeH1NMR7eb8xDrgfzzfrLqnqrovt 6B2Xb3Rupbpw3LTDODH/hN4Gf5oLSExy3UW2IH9b+TpOLAXDQOVNPr56NTAYDLJG6shc /1YfSYvhTWyRfWP7+zOsBKaKUj0sb81i/u9vOcZg85orYZ5BI695HdwWBD5mAnNGlrpg 3kGkmUWH0E/niYYU567fwBzCIcMRDgYC4qLiPFsZiFX6NHRkFXUGZbg37ZHj7PKfOT8T CkFynM2V4fBgrPArtyb5FKB+6tYGfPhq9ajWABkQifjxVfC88+oXpo3fC59Nvqt+4IFQ 5Jaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678231275; h=in-reply-to:content-disposition:mime-version:references:subject:cc :to:from:date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=HYZwdboZtaofkxYF/AMrNWZjuYShpz74P+9J9F7wGPo=; b=AftuR8iHSdaYH5nR2pVbuva1M/y2iK2rg4WV6OHZX7mJe2m1kyA+bLxoDe0Wy++PTa dCfDPC44wTEEYjoH5drhReAekMMOWpgVHcap4Anm3lD1Snz4cSTPFrj9TR91MhQPmfQ7 duSYiK7K3L4efIP1/m4I0y9aDOeLQwK7+npCzo7g75Y2joMGgr75o5XSZFOI5KwEAbic JTqcElSjcjWzrnYa7ppbv5tK4Qs0bRBXNjhKK0bVyqiVwtRIJq5+mHpQgsITKdV5rJi6 9tnGSC+UwITqKooBXozox5VkjzQawgCwab3URXRmVm1OaVZw6GaNXMePITOV8drDvtWb sEag== X-Gm-Message-State: AO0yUKXGuZpH0YaG5Ds1ATggO1+/1Yg187V/pDWFfUG6pmktxeuhrJdd kPqrLyfoWjeKx7pUy0dxAbU= X-Google-Smtp-Source: AK7set8d6nc3OMllfFEEVMQ2FWoY8wuoG+KGTEyes4OWEZZRiJ4RDuQzLH5PGcqH5tUcjI/Eb3a8yg== X-Received: by 2002:a05:600c:348d:b0:3eb:9822:2907 with SMTP id a13-20020a05600c348d00b003eb98222907mr10953463wmq.4.1678231274745; Tue, 07 Mar 2023 15:21:14 -0800 (PST) Received: from Ansuel-xps. (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.gmail.com with ESMTPSA id m1-20020a05600c4f4100b003e01493b136sm19403673wmq.43.2023.03.07.15.21.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 15:21:14 -0800 (PST) Message-ID: <6407c6ea.050a0220.7c931.824f@mx.google.com> X-Google-Original-Message-ID: Date: Tue, 7 Mar 2023 18:57:10 +0100 From: Christian Marangi To: Andrew Lunn Cc: 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 , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Lee Jones , linux-leds@vger.kernel.org Subject: Re: [net-next PATCH 01/11] net: dsa: qca8k: add LEDs basic support References: <20230307170046.28917-1-ansuelsmth@gmail.com> <20230307170046.28917-2-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230307_152117_301949_0DE45299 X-CRM114-Status: GOOD ( 19.81 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Mar 08, 2023 at 12:16:13AM +0100, Andrew Lunn wrote: > > +qca8k_setup_led_ctrl(struct qca8k_priv *priv) > > +{ > > + struct fwnode_handle *ports, *port; > > + int port_num; > > + int ret; > > + > > + ports = device_get_named_child_node(priv->dev, "ports"); > > + if (!ports) { > > + dev_info(priv->dev, "No ports node specified in device tree!\n"); > > + return 0; > > + } > > + > > + fwnode_for_each_child_node(ports, port) { > > + struct fwnode_handle *phy_node, *reg_port_node = port; > > + > > + phy_node = fwnode_find_reference(port, "phy-handle", 0); > > + if (!IS_ERR(phy_node)) > > + reg_port_node = phy_node; > > I don't understand this bit. Why are you looking at the phy-handle? > > > + > > + if (fwnode_property_read_u32(reg_port_node, "reg", &port_num)) > > + continue; > > I would of expect port, not reg_port_node. I'm missing something > here.... > It's really not to implement ugly things like "reg - 1" On qca8k the port index goes from 0 to 6. 0 is cpu port 1 1 is port0 at mdio reg 0 2 is port1 at mdio reg 1 ... 6 is cpu port 2 Each port have a phy-handle that refer to a phy node with the correct reg and that reflect the correct port index. Tell me if this looks wrong, for qca8k we have qca8k_port_to_phy() and at times we introduced the mdio thing to describe the port - 1 directly in DT. If needed I can drop the additional fwnode and use this function but I would love to use what is defined in DT thatn a simple - 1. -- Ansuel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel