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 X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77A8AC433DB for ; Mon, 8 Feb 2021 16:30:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 450D264E8C for ; Mon, 8 Feb 2021 16:30:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233841AbhBHQaC (ORCPT ); Mon, 8 Feb 2021 11:30:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234387AbhBHQ3k (ORCPT ); Mon, 8 Feb 2021 11:29:40 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED05BC061786; Mon, 8 Feb 2021 08:28:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=wd3NQ7jvBJekE/Q3L0BhBL56hsU4rrZSvP5lEzeZjdQ=; b=gyYwk9jV5WbkAYSYTsOv5WiVB viFcAotojHEvc8naHZ5pZw4qc22smB/hwFUhAbPxpS9JNfRhtZgXf1VYgbUFHkO7hBAmHX/aqqW9N eFR34uk7+QT2j4nzDyE8NgqNSROLGyMinjmalsjwTlRKTK0YGH8tfnvYEnn2rB2p4x1Wj/r6sABJI ZtJGYCsixRYaR8ZRFim+7K2ownflUlp0FjpxcyQ0LytPRUlXsW890TncOIysi9ltzQyOdo70ydkAL LWNUVyN+xiZ2y/PknqLK6r5y5Pfp3SKLyIqMLaFzOYjZuJgfjAEWD/B/cfqvSfhG+wIwitiobo2LL yxbaSx/xg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:40832) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l99Oq-0002GK-F2; Mon, 08 Feb 2021 16:28:32 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1l99Op-0003Bv-EX; Mon, 08 Feb 2021 16:28:31 +0000 Date: Mon, 8 Feb 2021 16:28:31 +0000 From: Russell King - ARM Linux admin To: Calvin Johnson Cc: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap , Laurentiu Tudor , linux-kernel@vger.kernel.org, linux.cj@gmail.com, Diana Madalina Craciun , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, "David S. Miller" , Ioana Radulescu , Jakub Kicinski Subject: Re: [net-next PATCH v5 15/15] net: dpaa2-mac: Add ACPI support for DPAA2 MAC driver Message-ID: <20210208162831.GM1463@shell.armlinux.org.uk> References: <20210208151244.16338-1-calvin.johnson@oss.nxp.com> <20210208151244.16338-16-calvin.johnson@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210208151244.16338-16-calvin.johnson@oss.nxp.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: Russell King - ARM Linux admin Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Mon, Feb 08, 2021 at 08:42:44PM +0530, Calvin Johnson wrote: > Modify dpaa2_mac_connect() to support ACPI along with DT. > Modify dpaa2_mac_get_node() to get the dpmac fwnode from either > DT or ACPI. > > Replace of_get_phy_mode with fwnode_get_phy_mode to get > phy-mode for a dpmac_node. > > Use helper function phylink_fwnode_phy_connect() to find phy_dev and > connect to mac->phylink. > > Signed-off-by: Calvin Johnson I don't think this does the full job. > static int dpaa2_pcs_create(struct dpaa2_mac *mac, > - struct device_node *dpmac_node, int id) > + struct fwnode_handle *dpmac_node, > + int id) > { > struct mdio_device *mdiodev; > - struct device_node *node; > + struct fwnode_handle *node; > > - node = of_parse_phandle(dpmac_node, "pcs-handle", 0); > - if (!node) { > + node = fwnode_find_reference(dpmac_node, "pcs-handle", 0); > + if (IS_ERR(node)) { > /* do not error out on old DTS files */ > netdev_warn(mac->net_dev, "pcs-handle node not found\n"); > return 0; > } > > - if (!of_device_is_available(node)) { > + if (!of_device_is_available(to_of_node(node))) { If "node" is an ACPI node, then to_of_node() returns NULL, and of_device_is_available(NULL) is false. So, if we're using ACPI and we enter this path, we will always hit the error below: > netdev_err(mac->net_dev, "pcs-handle node not available\n"); > - of_node_put(node); > + of_node_put(to_of_node(node)); > return -ENODEV; > } > @@ -306,7 +321,7 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac) > * error out if the interface mode requests them and there is no PHY > * to act upon them > */ > - if (of_phy_is_fixed_link(dpmac_node) && > + if (of_phy_is_fixed_link(to_of_node(dpmac_node)) && If "dpmac_node" is an ACPI node, to_of_node() will return NULL, and of_phy_is_fixed_link() will oops. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! 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 X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA449C433DB for ; Mon, 8 Feb 2021 16:30:05 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4E9FA64E87 for ; Mon, 8 Feb 2021 16:30:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4E9FA64E87 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BHwn6xwp/g83pU4jPVUNmpZoHRqBKYNPGnV/1POZoIY=; b=E8ntHvi99t9Lr7IHDfj1lbliN yPYaAiQIL5sB1ktKWjWlmSvfD0Ikg87zZc34PTnSyqGD29ie0iZVowDiEiR4t0/TrPONvI0pP6kQ9 cbFpqWSSCSFT15BzBvnO48n1rXK4a2wWdYXdrdGANRDuVf/+8Cpfq9KvA1SyVCdUCF5Egk1hbHi5Y 4FFCb3f9UNTP0kjsJlE6BJ9ihFZ0FZLU+ert9fS6F19SzDfm7X2WKQOJewW9kuOCqy4SOQC7bAhaS qaah0gKe60PH8yfZH4+OtCfz6rWfoXggQtyZAePXXNFU0excUOZH2Z5bBNJA/DpHWuCGBa3kVfiIh PADdnX7KQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l99P5-00088h-K4; Mon, 08 Feb 2021 16:28:47 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l99P4-00088J-0U for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 16:28:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=wd3NQ7jvBJekE/Q3L0BhBL56hsU4rrZSvP5lEzeZjdQ=; b=gyYwk9jV5WbkAYSYTsOv5WiVB viFcAotojHEvc8naHZ5pZw4qc22smB/hwFUhAbPxpS9JNfRhtZgXf1VYgbUFHkO7hBAmHX/aqqW9N eFR34uk7+QT2j4nzDyE8NgqNSROLGyMinjmalsjwTlRKTK0YGH8tfnvYEnn2rB2p4x1Wj/r6sABJI ZtJGYCsixRYaR8ZRFim+7K2ownflUlp0FjpxcyQ0LytPRUlXsW890TncOIysi9ltzQyOdo70ydkAL LWNUVyN+xiZ2y/PknqLK6r5y5Pfp3SKLyIqMLaFzOYjZuJgfjAEWD/B/cfqvSfhG+wIwitiobo2LL yxbaSx/xg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:40832) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l99Oq-0002GK-F2; Mon, 08 Feb 2021 16:28:32 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1l99Op-0003Bv-EX; Mon, 08 Feb 2021 16:28:31 +0000 Date: Mon, 8 Feb 2021 16:28:31 +0000 From: Russell King - ARM Linux admin To: Calvin Johnson Subject: Re: [net-next PATCH v5 15/15] net: dpaa2-mac: Add ACPI support for DPAA2 MAC driver Message-ID: <20210208162831.GM1463@shell.armlinux.org.uk> References: <20210208151244.16338-1-calvin.johnson@oss.nxp.com> <20210208151244.16338-16-calvin.johnson@oss.nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210208151244.16338-16-calvin.johnson@oss.nxp.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_112846_114475_530CF003 X-CRM114-Status: GOOD ( 17.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , Heikki Krogerus , "Rafael J . Wysocki" , Grant Likely , Ioana Ciornei , Florian Fainelli , Saravana Kannan , Jon , Diana Madalina Craciun , linux-acpi@vger.kernel.org, Andy Shevchenko , Jakub Kicinski , Florin Laurentiu Chiculita , Madalin Bucur , Pieter Jansen Van Vuuren , Marcin Wojtas , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor , Ioana Radulescu , netdev@vger.kernel.org, Randy Dunlap , linux-kernel@vger.kernel.org, Jeremy Linton , Cristi Sovaiala , linux.cj@gmail.com, "David S. Miller" 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 Mon, Feb 08, 2021 at 08:42:44PM +0530, Calvin Johnson wrote: > Modify dpaa2_mac_connect() to support ACPI along with DT. > Modify dpaa2_mac_get_node() to get the dpmac fwnode from either > DT or ACPI. > > Replace of_get_phy_mode with fwnode_get_phy_mode to get > phy-mode for a dpmac_node. > > Use helper function phylink_fwnode_phy_connect() to find phy_dev and > connect to mac->phylink. > > Signed-off-by: Calvin Johnson I don't think this does the full job. > static int dpaa2_pcs_create(struct dpaa2_mac *mac, > - struct device_node *dpmac_node, int id) > + struct fwnode_handle *dpmac_node, > + int id) > { > struct mdio_device *mdiodev; > - struct device_node *node; > + struct fwnode_handle *node; > > - node = of_parse_phandle(dpmac_node, "pcs-handle", 0); > - if (!node) { > + node = fwnode_find_reference(dpmac_node, "pcs-handle", 0); > + if (IS_ERR(node)) { > /* do not error out on old DTS files */ > netdev_warn(mac->net_dev, "pcs-handle node not found\n"); > return 0; > } > > - if (!of_device_is_available(node)) { > + if (!of_device_is_available(to_of_node(node))) { If "node" is an ACPI node, then to_of_node() returns NULL, and of_device_is_available(NULL) is false. So, if we're using ACPI and we enter this path, we will always hit the error below: > netdev_err(mac->net_dev, "pcs-handle node not available\n"); > - of_node_put(node); > + of_node_put(to_of_node(node)); > return -ENODEV; > } > @@ -306,7 +321,7 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac) > * error out if the interface mode requests them and there is no PHY > * to act upon them > */ > - if (of_phy_is_fixed_link(dpmac_node) && > + if (of_phy_is_fixed_link(to_of_node(dpmac_node)) && If "dpmac_node" is an ACPI node, to_of_node() will return NULL, and of_phy_is_fixed_link() will oops. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel