Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1005487iog; Thu, 30 Jun 2022 14:57:54 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uw/jlvCn1vPljsJ9/Jdw2pPP80yj+jqUuN6u07DomTuOTHjafu8oDTrm5CmArvTKyDutU9 X-Received: by 2002:a17:90a:e7c7:b0:1ec:99eb:ff3a with SMTP id kb7-20020a17090ae7c700b001ec99ebff3amr13986787pjb.204.1656626274382; Thu, 30 Jun 2022 14:57:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656626274; cv=none; d=google.com; s=arc-20160816; b=xYIh+k0K1RfctQYkNWBlGRtY3EjzXr+i6a2eVZOK0X/XJy7pm8FgHd7d05oEpPr+90 39yk9yMuxgU2J7bRIUvRGihLzwlkReBU8hwAuCr4l0TZ+RGDH01EKQSsTHGzcwqF1cKi lR5bHml5uk2lzbK28VYb2Lid75GiKNekqARXEN+GFUHS0sdZ3Z4hxJ3QHkU6w4umEfEV LrxB4qmOoF9gGmJokzAd5lKZi/w5P/9W9aI3SF7ysAS4brhRZky8qu94S6R1KCKhuU4X M729zD4EeYxeUgpztuVwc6f0h9K7NHTQdY2twoZa0z02g2faaylhh/LbB+FXcycigXSl CRMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :dkim-signature; bh=hhIM7xkXVLpCgTOC9u3u0l6IjtG+a88bi2pntBrpJIo=; b=J/ij5s1BGJmBukxg2ANlId3IS/d06hzFwBkQIDTfPXmh9wcsnmRlKZVUo5t0Jot7qb MthPCNA05bnjZOgvN4SgurzzVipB9ZZOgbzTQaVqeff7IforpBzfzDGDG+kmpkjPK4qD N6b9PY2vKkwEWz8VWuuojCgHGG99OB/jUXi/iXss77/RqG75CTe7RHEzpK6VTEhrTA5a 7OZC10Vm6YaNaFEEyajKQy1gvKtUxsbEHCektmzPA9KJXZsvBiXupZCzy/QwgTJD2/wh pCJ9JY6oZK6AvRRnfMP/7a5I7jM32c9RZc5n4khe8WwyBy6qQ1MQbi8uWK2lj/lGZWwK Jyvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=hT11cBNX; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oa7-20020a17090b1bc700b001e30a3a5f49si8899092pjb.121.2022.06.30.14.57.43; Thu, 30 Jun 2022 14:57:54 -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=@walle.cc header.s=mail2016061301 header.b=hT11cBNX; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237591AbiF3Vca (ORCPT + 99 others); Thu, 30 Jun 2022 17:32:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233496AbiF3VcZ (ORCPT ); Thu, 30 Jun 2022 17:32:25 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25E0E50715; Thu, 30 Jun 2022 14:32:25 -0700 (PDT) Received: from ssl.serverraum.org (web.serverraum.org [172.16.0.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 2DA3D22236; Thu, 30 Jun 2022 23:32:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1656624742; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hhIM7xkXVLpCgTOC9u3u0l6IjtG+a88bi2pntBrpJIo=; b=hT11cBNXtnyB1FKwoVxTYskaPjbn+HRZOW0dtvXqnJjTwl4IOPN22WvQMtA18pog25XKyP SnIMOdm11PExB994mPfRKmKLvxSf2D7NXOQAF2cSXI5tC9D/dUfSXs1kCa2XgpQ3UMtEAr XJ1mefUOgXAdvhuqdxj2p/hWOZ/ZqlA= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 30 Jun 2022 23:32:21 +0200 From: Michael Walle To: Vladimir Oltean Cc: Horatiu Vultur , Andy Shevchenko , Krzysztof Kozlowski , Andy Shevchenko , "Rafael J. Wysocki" , Rob Herring , Krzysztof Kozlowski , ACPI Devel Maling List , devicetree , Linux Kernel Mailing List Subject: Re: fwnode_for_each_child_node() and OF backend discrepancy In-Reply-To: <20220630212120.t3in6i7s7chaqacr@skbuf> References: <3ab8afab-b6b7-46aa-06d4-6740cee422d7@linaro.org> <288f56ba9cfad46354203b7698babe91@walle.cc> <96f40ae6abf76af3b643b1e1c60d1d9f@walle.cc> <20220628205254.gnllvaz7w5jmpfe5@soft-dev3-1.localhost> <4782de1fc6692a98bd6c267c2714325f@walle.cc> <20220630201617.sqpihcevym7sxqng@soft-dev3-1.localhost> <20220630212120.t3in6i7s7chaqacr@skbuf> User-Agent: Roundcube Webmail/1.4.13 Message-ID: <65a17cff8d80b0c27976a2c2a17519bf@walle.cc> X-Sender: michael@walle.cc X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 Am 2022-06-30 23:21, schrieb Vladimir Oltean: > On Thu, Jun 30, 2022 at 11:00:37PM +0200, Michael Walle wrote: >> > > > It is not possible to have a defined for the MAX number of ports that >> > > > supported by lan966x. Which is 8. And assigned that define to >> > > > num_phys_ports instead of counting the entries in DT? >> > > >> > > You mean also for the lan9662? I'm pretty sure that doesn't >> > > work. Have a look where num_phys_ports is used. One random >> > > example: >> > > https://elixir.bootlin.com/linux/latest/source/drivers/net/ethernet/microchip/lan966x/lan966x_main.c#L874 >> > > >> > > So if your switch only has 4 ports, then I'd guess you'll >> > > access a non-existing register. >> > >> > Underneath lan662 and lan668 is the same chip. The HW people disable >> > some ports/features on each platform but from what I know you will still >> > be able to access the registers. >> >> I noticed that there are still 8 ports in the register description and >> assumed that it was wrong [1]. But ok, that makes sense in some way. >> OTOH that means, we cannot do the guesswork Vladimir proposed. >> >> -michael >> >> [1] >> https://microchip-ung.github.io/lan9662_reginfo/reginfo_LAN9662.html > > Are you 100% positive that the default values for the flooding PGIDs > are > GENMASK(8, 0) for a 4-port switch? And that the packet buffer has the > same size for a switch with half as many ports? Ok... > > But in that case, what exactly is the problem if the port count of 8 is > a synthesis time constant for lan966x, and if the CPU port module is > always at index 8 in the analyzer (with a gap between indices 4 and 7)? > Just hardcode lan966x->num_phys_ports to 8 and work with that > throughout. > Allocate lan966x->ports as an array of 8 pointers to struct > lan966x_port > (which they are already), and the pointers themselves are populated as > being the netdev_priv of the interfaces that are actually present and > used. Literally the only thing you need to fix is that you need to > hardcode num_phys_ports to 8, problem solved. It means that lan9662 is > nothing but a lan9668 where the last 4 ports have 'status = "disabled"' > in the device tree. If that's the case, sure. The last four ports can just be omitted no? Of course you'll lose the possibility to validate the device tree ports input, i.e. port@5 would perfectly valid although it doesn't make any sense for the lan9662. (Regardless if it is disabled, or if it's omitted) -michael