Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp322194rdb; Thu, 1 Feb 2024 09:23:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IHcRGUZ7kJjHvglMjUsmR1nSAw9eu3dd8QvKenMlEGVYWgNtNp0piG6I+CovIr3+qitBXNX X-Received: by 2002:a17:90a:d503:b0:290:d726:2a73 with SMTP id t3-20020a17090ad50300b00290d7262a73mr5758161pju.2.1706808217287; Thu, 01 Feb 2024 09:23:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706808217; cv=pass; d=google.com; s=arc-20160816; b=ZvtLxC41a056Zl/+IWAlltp51FHG2QemSLlOKxbseOt2+YOEVRmGWMzUDf5mQOZG2c kiQymUnYw62wXbkMFiGeuosZPV3EhDxQld3lcpjB7ZEWJVUS5yrgxjec1zHwWZ4V62m2 EqBzjJZzxZxKeDMlKjm1TWmPkcuhYnj/dExJXENxc0jGDnMr2x/KmZVEAihrwTzSm2Z9 DlzeYvDYzR9Zx7635fnD0DITbpCLKAIwkBszFkbP1h+j4/DnhcMhkcVEnVmId7O/3/dA ytUrKHfADKu04xSXr++jmhd3niwEh080X7uXN9Xxkq0LLnMOZtcoSOFNe/gJ9jWLhmSF 7FJg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:to:from:subject:references:in-reply-to :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=z/WWCPzfGRVugDnZX5TM8d7H4TNbc91ohazAKfIw9So=; fh=Ce2C34ayAwRCESs1h9ZXx9bt1upzDZ8G3GCAe9Xhq9Y=; b=JUEyED0cHCCAKS9TZzdEpIsg4cgP14o9rIsHVVVaTVYMg4WJRIOoEZxdvWyGZF/a1c BMfdfrNtfQVZqJGJ5rv2ONGZztPQkB92Hr1ElSRjsqQajdK4eRoZqbjinn+WZbmY8r1U eH/n8tAjRYHQud4P7jjg9jTx8xZQMGfufZ3Q47FhZLMLrKY1W3xpRL8Q85DBxyoENu7Y 0eAc3RWopGvQ5D5A3ySX7TrZGiN/cm2l/y346UpGe3YkBwMchAeuWsLuL0Z1PFk/3XGa wMiyoIyXUZ5d2DROh3ULt6XahdT2o1xjOkuVvaXhRDHYJJuVVzi1FzluJT8CMNQrJBwN 4nJA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u3viytOj; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-48520-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48520-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCVtvOK1XlRQA4SH2xQVyS21/kqbioDEhugXFsjEh//t8hDZ09IuOhndYX8V7Qj8Dt2Rai3VLDfkcRvR/IQv9DvV+B7qBPWWn0/+K9IZYw== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id ms18-20020a17090b235200b0029022ab651bsi3966955pjb.173.2024.02.01.09.23.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 09:23:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48520-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u3viytOj; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-48520-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48520-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 166EFB33410 for ; Thu, 1 Feb 2024 16:27:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 26D865E238; Thu, 1 Feb 2024 16:25:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="u3viytOj" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C7A47E0E5; Thu, 1 Feb 2024 16:25:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706804740; cv=none; b=ZOEtcCjQCkE925YoUYdWLKNDQp86cSW+C0JyQQRU1AQLc7MhZgckL7iR9J07OGgMBOLVH/Y/H5a1BNDk34UfsBELedXa6YSFZhgZiu4DLwsmBZLaUwP+E+RyjsS6WhEcmPv9n42DzNz75KH4+Lnxjx6CrQkAUf6TZgMwzUemJN0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706804740; c=relaxed/simple; bh=r33SDu8/DM+zYKaYrvveD9kjvKPsy8EfeVfboKSVxPM=; h=Content-Type:MIME-Version:In-Reply-To:References:Subject:From:To: Date:Message-ID; b=VZuERazOe58z2bqDLG+DyXabdg6CcfyzRIhVd14jpfatC7CLvhjYXxkRIIBNv1sjKi8nCW7lbW+2je5Td+2bs3xs2nhRjd9jlPvx7eF2xXThrVZiouPTt8QMH9/uOMyclhgyq6z+B1FgL0r52z+x2KY6c86bwMCqmZ3OarXtG1I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=u3viytOj; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 381D3C433C7; Thu, 1 Feb 2024 16:25:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706804739; bh=r33SDu8/DM+zYKaYrvveD9kjvKPsy8EfeVfboKSVxPM=; h=In-Reply-To:References:Subject:From:To:Date:From; b=u3viytOjwSNjSnVkgzp2uAPROok+mMNDNYZk4Q+0x+XlJ74NdrGuNDjrou+uuaRS4 WB56T4MxsZF8A25dCZQaI1d15Xc2w98GIdZk0tPRZRjJaizzgsVbqHNUB19ETTOgTf qOYx8R4RHtvrvHAgmZJYvgauhy42IVf+92/3vIj/0naFRCKecYewRQGh09MiD+2W+U h+bFpjdOevJCcu2QD5FemcC7jDX0EXVMOtiAjy9894TN/dyOYbffvhmTnVnkOSA/BS 0kcDkYfkmFx1LeLhi0z4bf0eFSszovujShUkmK4aLP9YGwLju1txIHkVO+Vlsw83uz uH+4QepaYkM6Q== Content-Type: text/plain; charset="utf-8" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20240201151747.7524-3-ansuelsmth@gmail.com> References: <20240201151747.7524-1-ansuelsmth@gmail.com> <20240201151747.7524-3-ansuelsmth@gmail.com> Subject: Re: [net-next PATCH v5 2/9] net: phy: add support for scanning PHY in PHY packages nodes From: Antoine Tenart To: Andrew Lunn , Bjorn Andersson , Christian Marangi , Conor Dooley , David S. Miller , Eric Dumazet , Frank Rowand , Heiner Kallweit , Jakub Kicinski , Konrad Dybcio , Krzysztof Kozlowski , Paolo Abeni , Rob Herring , Robert Marko , Russell King , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Date: Thu, 01 Feb 2024 17:25:36 +0100 Message-ID: <170680473689.4979.1991415008659281513@kwain> Quoting Christian Marangi (2024-02-01 16:17:28) >=20 > +static int __of_mdiobus_parse_phys(struct mii_bus *mdio, struct device_n= ode *np, > + int base_addr, bool *scanphys) > +{ > + struct device_node *child; > + int addr, rc =3D 0; > + > + /* Loop over the child nodes and register a phy_device for each p= hy */ > + for_each_available_child_of_node(np, child) { > + if (of_node_name_eq(child, "ethernet-phy-package")) { > + rc =3D of_property_read_u32(child, "reg", &addr); > + if (rc) > + goto exit; This means a PHY package node w/o a reg property will prevent all other PHYs in the same parent node to be found? > + > + rc =3D __of_mdiobus_parse_phys(mdio, child, addr,= scanphys); You might want to save passing scanphys down, PHYs w/o a reg property in a PHY package won't be "auto scanned" later. > diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c > index afbad1ad8683..7737d0101d7b 100644 > --- a/drivers/net/phy/mdio_bus.c > +++ b/drivers/net/phy/mdio_bus.c > @@ -459,20 +459,33 @@ EXPORT_SYMBOL(of_mdio_find_bus); > * found, set the of_node pointer for the mdio device. This allows > * auto-probed phy devices to be supplied with information passed in > * via DT. > + * If a PHY package is found, PHY is searched also there. > */ > -static void of_mdiobus_link_mdiodev(struct mii_bus *bus, > - struct mdio_device *mdiodev) > +static int of_mdiobus_find_phy(struct device *dev, struct mdio_device *m= diodev, > + struct device_node *np, int base_addr) > { > - struct device *dev =3D &mdiodev->dev; > struct device_node *child; > =20 > - if (dev->of_node || !bus->dev.of_node) > - return; > + for_each_available_child_of_node(np, child) { > + int addr, ret; > =20 > - for_each_available_child_of_node(bus->dev.of_node, child) { > - int addr; > + if (of_node_name_eq(child, "ethernet-phy-package")) { > + ret =3D of_property_read_u32(child, "reg", &addr); > + if (ret) > + return ret; of_node_put