From patchwork Sat Jan 16 23:16:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1427666 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=dVe158pK; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DJDTC3qMdz9sVn for ; Sun, 17 Jan 2021 10:16:37 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CE69A82A0F; Sun, 17 Jan 2021 00:16:25 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1610838986; bh=giChx0Kkedk7sDgPOpi/UznUhsg6XRxmVczbHOi9H2M=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=dVe158pKehn7UajU1X3WrJ0fSd9BWfLv9S2NP1XIwb7/Vl4ePUlMJpr9f9wfheVLV +4dwvxic0/EP61wa3lQFYyZXb3PoBO4en6MDJfkA0/lzRqY3N8/sv81NNr8ravBWOz 8A6YbHQN8lcJIXvcq1POg8W7LTniytD8IpwkxAQWhHliOFSZpeyz2VII880IbvF6OK MhIjS27k0jzTX1XyaFN6/5wsnLFT/QzZQGqsaCF/7dpr//F67nlEwrjS3v1MybWvEf oJOrOqudD9d7RnoqOFXXbhaBw4WXg4AUoAh0Kp1W9xP6MsBM/aKHep1pcKkCcUBXXj WUyuCIXBsgX+g== Received: by phobos.denx.de (Postfix, from userid 109) id 49E65829E3; Sun, 17 Jan 2021 00:16:24 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-out.m-online.net (mail-out.m-online.net [IPv6:2001:a60:0:28:0:1:25:1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C81AB829E3 for ; Sun, 17 Jan 2021 00:16:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=marex@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4DJDSh74RJz1rvxj; Sun, 17 Jan 2021 00:16:20 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4DJDSh6lTjz1qqkk; Sun, 17 Jan 2021 00:16:20 +0100 (CET) Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id cFQFoFiM8Nzv; Sun, 17 Jan 2021 00:16:20 +0100 (CET) X-Auth-Info: vRCffKr22ruSeARNgTJlmVhYE//otobwxiqhOJan9qg= Received: from tr.lan (ip-89-176-112-137.net.upcbroadband.cz [89.176.112.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sun, 17 Jan 2021 00:16:20 +0100 (CET) From: Marek Vasut To: u-boot@lists.denx.de Cc: Marek Vasut , Joe Hershberger , Ramon Fried Subject: [PATCH] net: phy: micrel: Try default PHY ofnode first Date: Sun, 17 Jan 2021 00:16:16 +0100 Message-Id: <20210116231616.302205-1-marex@denx.de> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean The phydev structure has a PHY OF node pointer in it, use that OF node first when looking up PHY OF node properties, since that is likely the correct PHY OF node pointer. If the pointer is not valid, which is the case e.g. on legacy DTs, fall back to parsing MAC ethernet-phy subnode. Signed-off-by: Marek Vasut Cc: Joe Hershberger Cc: Ramon Fried --- drivers/net/phy/micrel_ksz90x1.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/micrel_ksz90x1.c b/drivers/net/phy/micrel_ksz90x1.c index f0032e8ce16..23a018c2c25 100644 --- a/drivers/net/phy/micrel_ksz90x1.c +++ b/drivers/net/phy/micrel_ksz90x1.c @@ -120,8 +120,13 @@ static int ksz90x1_of_config_group(struct phy_device *phydev, if (!drv || !drv->writeext) return -EOPNOTSUPP; - /* Look for a PHY node under the Ethernet node */ - node = dev_read_subnode(dev, "ethernet-phy"); + node = phydev->node; + + if (!ofnode_valid(node)) { + /* Look for a PHY node under the Ethernet node */ + node = dev_read_subnode(dev, "ethernet-phy"); + } + if (!ofnode_valid(node)) { /* No node found, look in the Ethernet node */ node = dev_ofnode(dev);