Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4703452pxk; Wed, 30 Sep 2020 09:29:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvMw0YJ8W0CW2FjdrdlzNyy4J57/+jA+wtrxPlvpw9uS8pWKYXlUM0CfGfUjjXyC5ArxGQ X-Received: by 2002:a17:906:a1d8:: with SMTP id bx24mr3535489ejb.161.1601483399689; Wed, 30 Sep 2020 09:29:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601483399; cv=none; d=google.com; s=arc-20160816; b=pttsPeGVF9JLdDSaVkIajNuPiY7YdD7p+/2Tq4ImKY+9IrxKmBVCaZqfCxMSUGeKeT bGhk9LOGfkpC+dlByJNpsO10XpC6JggMi9ynpb3TJiFNf7GQOIS/20TE21j0+Aj5LRBF dGcNsNc4aar+UAQX7xxJGsaB3KiecrlzN759TydMqIvA4Zl7aqU9HqJ0AWnFHEMxThzj TXYW1iNh1WVfgpIuWM5TSrTNngrat/BUY8dGrpqz4GTqlEZWP6pHDbPUzj08TwadIxU6 cJW2zIA4JPYDSHgoCQwFvYjyUHOhsuylJo+P7EHTtpOZrZbDGPC5dw/2Oq9gAImJ5SkH zXqA== 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; bh=mNkJSgFadH7tpdDMJ1pgBEFOUk9hyTPs5gyszkVYrpg=; b=AZMfcRzVQs1UC/mCQfT6O7o5Ub0IAMva6pTjyzUQkGIr7F8Y5B+C448g818nPKbOch b4LUkCxtveKB4pajEKJvLNvmVI/9MnvvRpBPA3R34Z8ehEUxYC5TmkQUabAbcoaGb2/p FX/V8ub0m2OTEZCxdGA3K5vf3XKMPU4UadRvnEANi5m0sv5cY6Fu1X5BZKRvbY6RU+qD 9xoeW2YJ+i/kQKi1/4y8+A5mOmc0k0sQ9/MqvUXWy8m1qnq2ztRXspWi3TFPUt/j1Caz LiJqs4jzwknw6FMxW3qYU885TglpCoj43wcII1Mp2iH28DxYeTi9//OeJDC211Hxp6Tn u8BQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v15si1443126edw.67.2020.09.30.09.29.34; Wed, 30 Sep 2020 09:29:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731229AbgI3Q1m (ORCPT + 99 others); Wed, 30 Sep 2020 12:27:42 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:36366 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727681AbgI3Q1m (ORCPT ); Wed, 30 Sep 2020 12:27:42 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kNex1-00GvTY-5D; Wed, 30 Sep 2020 18:27:31 +0200 Date: Wed, 30 Sep 2020 18:27:31 +0200 From: Andrew Lunn To: Calvin Johnson Cc: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , Laurentiu Tudor , "David S. Miller" , Jakub Kicinski Subject: Re: [net-next PATCH v1 7/7] net/fsl: Use _ADR ACPI object to register PHYs Message-ID: <20200930162731.GP3996795@lunn.ch> References: <20200930160430.7908-1-calvin.johnson@oss.nxp.com> <20200930160430.7908-8-calvin.johnson@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200930160430.7908-8-calvin.johnson@oss.nxp.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Calvin > priv->has_a011043 = device_property_read_bool(&pdev->dev, > "fsl,erratum-a011043"); > - > - ret = of_mdiobus_register(bus, np); > - if (ret) { > - dev_err(&pdev->dev, "cannot register MDIO bus\n"); > + if (is_of_node(pdev->dev.fwnode)) { > + ret = of_mdiobus_register(bus, np); > + if (ret) { > + dev_err(&pdev->dev, "cannot register MDIO bus\n"); > + goto err_registration; > + } > + } else if (is_acpi_node(pdev->dev.fwnode)) { > + priv->is_little_endian = true; > + /* Mask out all PHYs from auto probing. */ > + bus->phy_mask = ~0; > + ret = mdiobus_register(bus); > + if (ret) { > + dev_err(&pdev->dev, "mdiobus register err(%d)\n", ret); > + return ret; > + } > + > + fwnode = pdev->dev.fwnode; > + /* Loop over the child nodes and register a phy_device for each PHY */ > + fwnode_for_each_child_node(fwnode, child) { > + status = acpi_evaluate_integer(ACPI_HANDLE_FWNODE(child), > + "_ADR", NULL, &addr); > + if (ACPI_FAILURE(status)) { > + pr_debug("_ADR returned %d\n", status); > + continue; > + } > + > + if (addr < 0 || addr >= PHY_MAX_ADDR) > + continue; > + > + ret = fwnode_mdiobus_register_phy(bus, child, addr); > + if (ret == -ENODEV) > + dev_err(&bus->dev, > + "MDIO device at address %lld is missing.\n", > + addr); > + } Hi Calvin This looping over the properties should be in the core, in the same way of_mdiobus_register() loops over the OF properties in the core. We don't want MDIO drivers doing this in their own way, with their own bugs. Andrew