All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: "Marek Behún" <kabel@kernel.org>
Cc: "Robert Marko" <robert.marko@sartura.hr>,
	"Pali Rohár" <pali@kernel.org>,
	U-Boot-Denx <u-boot@lists.denx.de>,
	"Ramon Fried" <rfried.dev@gmail.com>,
	"Joe Hershberger" <joe.hershberger@ni.com>,
	"Marek Behún" <marek.behun@nic.cz>,
	"Heinrich Schuchardt" <xypron.glpk@gmx.de>,
	"Vladimir Oltean" <vladimir.oltean@nxp.com>,
	"Simon Glass" <sjg@chromium.org>
Subject: Re: [PATCH u-boot-marvell 06/19] net: mdio-uclass: add dm_phy_find_by_ofnode() helper
Date: Mon, 2 May 2022 09:00:40 +0200	[thread overview]
Message-ID: <655df3b8-5ee1-5443-ea8f-e53cde98ccef@denx.de> (raw)
In-Reply-To: <20220427104202.1205-7-kabel@kernel.org>

On 27.04.22 12:41, Marek Behún wrote:
> From: Marek Behún <marek.behun@nic.cz>
> 
> Add helper to resolve PHY node from it's ofnode via DM MDIO subsystem.
> 
> Signed-off-by: Marek Behún <marek.behun@nic.cz>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan


> ---
>   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 = 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 phyaddr,
>   				       struct udevice *ethdev,
>   				       phy_interface_t interface)

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

  parent reply	other threads:[~2022-05-02  7:01 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-27 10:41 [PATCH u-boot-marvell 00/19] some mvneta changes, cleanups, fixes Marek Behún
2022-04-27 10:41 ` [PATCH u-boot-marvell 01/19] net: mvneta: Get rid of platdata Marek Behún
2022-04-30 23:28   ` Ramon Fried
2022-05-02  6:48   ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 02/19] net: mvneta: Fix 10Mbps speed Marek Behún
2022-04-30 23:28   ` Ramon Fried
2022-05-02  6:48   ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 03/19] net: mvneta: Use DM MDIO API for connecting PHY Marek Behún
2022-04-30 23:28   ` Ramon Fried
2022-05-02  6:48   ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 04/19] net: mvneta: Remember fixed link instead of PHY address in priv data Marek Behún
2022-04-30 23:28   ` Ramon Fried
2022-05-02  6:48   ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 05/19] arm: mvebu: Espressobin: Use DM registered MDIO to configure switch Marek Behún
2022-05-02  6:48   ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 06/19] net: mdio-uclass: add dm_phy_find_by_ofnode() helper Marek Behún
2022-04-30 23:28   ` Ramon Fried
2022-05-02  7:00   ` Stefan Roese [this message]
2022-04-27 10:41 ` [PATCH u-boot-marvell 07/19] arm: mvebu: turris_mox: Use DM registered MDIO Marek Behún
2022-05-02  7:00   ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 08/19] net: mvneta: Don't register MDIO bus Marek Behún
2022-04-30 23:29   ` Ramon Fried
2022-05-02  7:01   ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 09/19] net: mvneta: Fix unused variable warning if DM_GPIO is disabled Marek Behún
2022-04-30 23:29   ` Ramon Fried
2022-05-02  7:01   ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 10/19] net: mvneta: Drop one indentation level in mvneta_adjust_link() Marek Behún
2022-04-30 23:29   ` Ramon Fried
2022-05-02  7:01   ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 11/19] net: mvneta: Use bool instead of int for boolean variable Marek Behún
2022-04-30 23:29   ` Ramon Fried
2022-05-02  7:01   ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 12/19] net: mvneta: Drop unnecessary space Marek Behún
2022-04-30 23:30   ` Ramon Fried
2022-05-02  7:01   ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 13/19] net: mvneta: Don't check for CONFIG_PHYLIB Marek Behún
2022-04-30 23:30   ` Ramon Fried
2022-05-02  7:02   ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 14/19] net: mvneta: Rename CONFIG_NR_CPUS to MVNETA_NR_CPUS Marek Behún
2022-04-30 23:30   ` Ramon Fried
2022-05-02  7:02   ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 15/19] net: mvneta: Convert to use PHY_FIXED for fixed-link Marek Behún
2022-04-30 23:31   ` Ramon Fried
2022-05-02  7:02   ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 16/19] net: mvneta: Write PHY address just before enabling HW polling Marek Behún
2022-04-30 23:31   ` Ramon Fried
2022-05-02  7:03   ` Stefan Roese
2022-04-27 10:42 ` [PATCH u-boot-marvell 17/19] net: mvneta: Drop fixed_link member from private struct Marek Behún
2022-04-30 23:31   ` Ramon Fried
2022-05-02  7:03   ` Stefan Roese
2022-04-27 10:42 ` [PATCH u-boot-marvell 18/19] net: mvneta: Disable fixed PHY code if PHY_FIXED is not compiled in Marek Behún
2022-04-30 23:32   ` Ramon Fried
2022-05-02  7:03   ` Stefan Roese
2022-04-27 10:42 ` [PATCH u-boot-marvell 19/19] net: mvneta: Drop unneeded macro Marek Behún
2022-04-30 23:32   ` Ramon Fried
2022-05-02  7:03   ` Stefan Roese
2022-05-02  5:39 ` [PATCH u-boot-marvell 00/19] some mvneta changes, cleanups, fixes Stefan Roese
2022-05-04  9:25 ` Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=655df3b8-5ee1-5443-ea8f-e53cde98ccef@denx.de \
    --to=sr@denx.de \
    --cc=joe.hershberger@ni.com \
    --cc=kabel@kernel.org \
    --cc=marek.behun@nic.cz \
    --cc=pali@kernel.org \
    --cc=rfried.dev@gmail.com \
    --cc=robert.marko@sartura.hr \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=vladimir.oltean@nxp.com \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.