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 Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0A3EDC433EF for ; Sat, 30 Apr 2022 23:28:35 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C659583AF6; Sun, 1 May 2022 01:28:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="VMC3cxNy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B230E83C8C; Sun, 1 May 2022 01:28:24 +0200 (CEST) Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 655F583AF6 for ; Sun, 1 May 2022 01:28:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rfried.dev@gmail.com Received: by mail-qk1-x72d.google.com with SMTP id s4so9148099qkh.0 for ; Sat, 30 Apr 2022 16:28:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Dr5hr1LEUU8NehQDhrKD5LtqYwyKw8e814kgin4dL6I=; b=VMC3cxNyNspHUiNoyGcqyO8+x+7XGgqyAudSAoFBrHaqhedFAU3Yd5Huy8rWs9Isyg nFLgEpTKQrQA35hPBpIs2MY1/kch3uQWNK3zP3KljSBMnwXoSYNJc0NloplhRlabe7Tg 48FMb2lizrF4kJNbxfnlIWuZT1U9diyM5PXgrpXxqa4/BAgnfOdgZqvH8woE/UNycMng cPRAoY2xooTZu62gqzARNVxj98SFPEzbb3J+3+XKesXNCHCtKKhdeocO9Os2QIrHYFzA Ka16ogTYggp04NSvVxXJK77jIzypjyAQQKd5kydBR9PzemeFYLkgrhVtA9hzMdbUVOPb A+Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Dr5hr1LEUU8NehQDhrKD5LtqYwyKw8e814kgin4dL6I=; b=kar+2ZQRIE3sapb4/LW8Fu8gtLDKdBx6edw4Mx2cKfrbzU3Yoscuza4+qdzz54++b9 ltpiQJ+Q1LJnGxv87Q7De7BGYRzUUje60uf60OONBvectI8Q0QwTCUBkLtrRPsb0QP1Z S5VJJTopBbR/bmkGUO7hGTnLI2xI/w1iHTzYgsHWtk+AUmzA2wqd3ddN6mKpAwl97eXe sp6JVHKsRJN+sRNUGRM0MXwJZyS/bHIzwVBexIZoSiWpFSSOfvhY/4W3K8pgrs0G6o9K jOlrvTje7WDO1CTK2PaWa9SO3gz2h4OX30VkznkyW876eDWypXtqDtGcKiZtuuyX7aLd CLAA== X-Gm-Message-State: AOAM531JMWLeZiWuNlV3zCGEIuRVEsjZIPV/A1o2/JQs840BGc3zeXC6 H8KAH10h2Mq3WjkbL4bSG/bsQQb2RcUOo2vy4bg= X-Google-Smtp-Source: ABdhPJwQRS3FJVrftdWxnTXTqdu4WZu7VGAmsRuKUc8WDKxR64F1t+zno7FYMxc20pU10YpeJKPw59nX9C33G4ZLvfg= X-Received: by 2002:ae9:ddc5:0:b0:69e:6b21:10c8 with SMTP id r188-20020ae9ddc5000000b0069e6b2110c8mr4156963qkf.677.1651361300251; Sat, 30 Apr 2022 16:28:20 -0700 (PDT) MIME-Version: 1.0 References: <20220427104202.1205-1-kabel@kernel.org> <20220427104202.1205-7-kabel@kernel.org> In-Reply-To: <20220427104202.1205-7-kabel@kernel.org> From: Ramon Fried Date: Sun, 1 May 2022 02:28:09 +0300 Message-ID: Subject: Re: [PATCH u-boot-marvell 06/19] net: mdio-uclass: add dm_phy_find_by_ofnode() helper To: =?UTF-8?B?TWFyZWsgQmVow7pu?= Cc: Stefan Roese , Robert Marko , =?UTF-8?Q?Pali_Roh=C3=A1r?= , U-Boot-Denx , Joe Hershberger , =?UTF-8?B?TWFyZWsgQmVow7pu?= , Heinrich Schuchardt , Vladimir Oltean , Simon Glass Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean On Wed, Apr 27, 2022 at 1:42 PM Marek Beh=C3=BAn wrote: > > From: Marek Beh=C3=BAn > > Add helper to resolve PHY node from it's ofnode via DM MDIO subsystem. > > Signed-off-by: Marek Beh=C3=BAn > --- > include/miiphy.h | 9 +++++++++ > net/mdio-uclass.c | 22 ++++++++++++++++++++++ > 2 files changed, 31 insertions(+) > > diff --git a/include/miiphy.h b/include/miiphy.h > index 110921f20d..c66a1845b5 100644 > --- a/include/miiphy.h > +++ b/include/miiphy.h > @@ -188,6 +188,15 @@ int dm_mdio_write(struct udevice *mdio_dev, int addr= , int devad, int reg, u16 va > */ > int dm_mdio_reset(struct udevice *mdio_dev); > > +/** > + * dm_phy_find_by_ofnode - Find PHY device by ofnode > + * > + * @phynode: PHY's ofnode > + * > + * Return: pointer to phy_device, or NULL on error > + */ > +struct phy_device *dm_phy_find_by_ofnode(ofnode phynode); > + > /** > * dm_mdio_phy_connect - Wrapper over phy_connect for DM MDIO > * > diff --git a/net/mdio-uclass.c b/net/mdio-uclass.c > index 7593618d9a..4401492ca0 100644 > --- a/net/mdio-uclass.c > +++ b/net/mdio-uclass.c > @@ -129,6 +129,28 @@ static int dm_mdio_pre_remove(struct udevice *dev) > return 0; > } > > +struct phy_device *dm_phy_find_by_ofnode(ofnode phynode) > +{ > + struct mdio_perdev_priv *pdata; > + struct udevice *mdiodev; > + u32 phy_addr; > + > + if (ofnode_read_u32(phynode, "reg", &phy_addr)) > + return NULL; > + > + if (uclass_get_device_by_ofnode(UCLASS_MDIO, > + ofnode_get_parent(phynode), > + &mdiodev)) > + return NULL; > + > + if (device_probe(mdiodev)) > + return NULL; > + > + pdata =3D dev_get_uclass_priv(mdiodev); > + > + return phy_find_by_mask(pdata->mii_bus, BIT(phy_addr)); > +} > + > struct phy_device *dm_mdio_phy_connect(struct udevice *mdiodev, int phya= ddr, > struct udevice *ethdev, > phy_interface_t interface) > -- > 2.35.1 > Reviewed-by: Ramon Fried