Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp27413iog; Tue, 28 Jun 2022 15:34:28 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t1w2T2LDVY292S6f2T6SwNQY3ocZF9XwDTENji+f9lzGWGzBjSqo4r1A0mCKKeST7v2gKB X-Received: by 2002:a63:4f04:0:b0:408:8206:5bcd with SMTP id d4-20020a634f04000000b0040882065bcdmr163399pgb.105.1656455667801; Tue, 28 Jun 2022 15:34:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656455667; cv=none; d=google.com; s=arc-20160816; b=B0QkljjdIdnixhu6jnHy19qJ1eXXsalCsxF9CceqZjoZ7m9lZmkn/iyjyPPldiaW+4 BsiGd29ea3rE7IEKrhnHQhndv1GF6XB/ec8s+7/r60QNimKRj1fXKMuCzwGLo94urX+Z sOlhkc9yO/L8V2aw3hxbCquw9k5RB3K5BLXJ5HD1kdBSZewT1moENX5uUpASj+J+CQGv XwLbS9LLgXF5fX3QQkSHine4gWii+10becZA7uM74omEHcVVVwH90Mh+imgG40I53a+1 S3Clz4O5kaI3PeTKhqGloJSvOirZY42HGhBf/8BYAA3rs4JPkAUcsqZS6rDQ/FFXf+oe lUDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2rpwnPjlltrxBnhTO6X3iXYjEJte1aFjs9YX4vq4uj0=; b=kUUbhaw49InNgAGfwkO1juKHuYwJ+a2qoIN2tgssoBiw10/D50IIBXxBAStQKlU605 +aNWLztGiqHwYGF7+AaL0L6mgtl5EdwMHxwDWej3zYsEHGM1oYJzGdPl4X/qfUKQbmIL 5s4vny0aSGgIq1HdrXSIFUTHzlmn2rKz/8j/saimQgxQ4pKLCVKIZlI/m7nkPzOuuUA1 tevlYlaVq0MN30POxAy1w8EiwDMbFO/mj9HenvRW0Y+qCNbltZXAdouCH19qR6ry7k5j CpEZgKD4QnOeobYSYOnXR7dr5dcLigGaYuvU8mh2bSfFwhhBbyTAKephNXdI5LvwcGRM Me6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=AY2ZtgJ+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nu17-20020a17090b1b1100b001eaf4d29385si1196880pjb.127.2022.06.28.15.34.01; Tue, 28 Jun 2022 15:34:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=AY2ZtgJ+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229953AbiF1V7V (ORCPT + 99 others); Tue, 28 Jun 2022 17:59:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229484AbiF1V7T (ORCPT ); Tue, 28 Jun 2022 17:59:19 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1225E2251A; Tue, 28 Jun 2022 14:59:19 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id q6so28450836eji.13; Tue, 28 Jun 2022 14:59:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=2rpwnPjlltrxBnhTO6X3iXYjEJte1aFjs9YX4vq4uj0=; b=AY2ZtgJ+zx20TDaoSF0ooOu97YXXajZ22O4cf9ZA2B9z2f9vJ/aeB7v+c07qUEk1M5 vc31W2mpxCw4NmqfBVU3P/g3nlKgLEph4qUbSlL+bWAuRX6fKV+HiPNROnATM+CDSgI3 KA/4gGsMhWNjh3tuE8OL9eh3fLe+SszqeHS24odRQ9xVXHpOFs0EIiqpjunqsulLK8vn Mx55h2+ZijNvLnT2jaehOXm9yI54ObK1wXP9Up0W6QMMOtotrGU5xLMkqqA4qXhL9nYv 4NCiNvcjhv7J98sjaaghu76BYrKgnrgNwy2D3szboGry+j0yPmqQqYzE9f9xhWfTLoQm t8XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=2rpwnPjlltrxBnhTO6X3iXYjEJte1aFjs9YX4vq4uj0=; b=3zpL6JB294+0471SQWswTF0XzQiO/e09XjodOBFByIwuft0Ej3yZrKaO54auBmqg1n PS0lixvaQ4Mi87rJCyWJgPZXZu+5BjWpf3GIS9nSXJn+ZZ6yZq0+IE9FKGULCQ6SFnHI 4X1D6g71GyTT86LubkkpbYACjqiTDmR64aTKiaQmA8HPomc7P2C7CJ99ev0BwJvdD21L MPhMhT98TIuwbX4DluzuG2cwbH4pbW+MIp6gHpiMTPpIRDPAo4J6RC3q9aRoZ+YDScxW T9M2CSBNSXxgyNCBXE4QBZgDbMGe6T+s1cGzpwSPzifL5Vd/ueoAsi2xS3QZLPUSIaNk LoTA== X-Gm-Message-State: AJIora+F9LbQTJtpk16qlsRnNIMy6LIhW40GuU0He/hMvxDjQw6I2Z3L m9lP9jPA8a20caamkmQONOU= X-Received: by 2002:a17:907:9620:b0:726:9316:54b7 with SMTP id gb32-20020a170907962000b00726931654b7mr221324ejc.73.1656453557501; Tue, 28 Jun 2022 14:59:17 -0700 (PDT) Received: from skbuf ([188.25.231.135]) by smtp.gmail.com with ESMTPSA id t27-20020a17090616db00b0071cbc7487e1sm6901859ejd.69.2022.06.28.14.59.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jun 2022 14:59:16 -0700 (PDT) Date: Wed, 29 Jun 2022 00:59:13 +0300 From: Vladimir Oltean To: Michael Walle Cc: Andy Shevchenko , Andy Shevchenko , "Rafael J. Wysocki" , Rob Herring , Krzysztof Kozlowski , ACPI Devel Maling List , devicetree , Linux Kernel Mailing List , Horatiu Vultur Subject: Re: fwnode_for_each_child_node() and OF backend discrepancy Message-ID: <20220628215913.d3oicaa6qkkgpdph@skbuf> References: <4e1d5db9dea68d82c94336a1d6aac404@walle.cc> <2f2d7685e0e43194270a310034004970@walle.cc> <9e58f421c27121977d11381530757a6e@walle.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9e58f421c27121977d11381530757a6e@walle.cc> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 28, 2022 at 03:47:59PM +0200, Michael Walle wrote: > Horatiu, can we determine the actual number of ports (or maybe > determine if its a LAN9668 or a LAN9662) from the hardware itself > in an easy way? That way we wouldn't need a new compatible string, > but could use the generic "lan966x" one. Never seen a lan966x switch, but if it's anything like the Ocelot-1 family, you should be able to determine the port count by reading the out-of-reset value of any register that contains a port mask which has all ones by default (any of the PGIDs in the multicast/flooding destinations range, or the VLAN table port masks for any VLAN ID). Or you can read the size of the packet buffer and infer from that which switch model it is, based on a driver hardcoded lookup table. I fully expect a switch with fewer ports to have smaller packet buffer. See ocelot_detect_features() for an example of registers I am talking about. Maybe lan966x has something similar. Of course these are just band aids and it would still be good to modify the device trees with the proper compatible = "microchip,lan9668-switch", "microchip,lan966x-switch"; rather than rely on educated guesswork (which is still guesswork, after all).