All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim Harvey <tharvey@gateworks.com>
To: Stefano Babic <sbabic@denx.de>,
	Fabio Estevam <festevam@gmail.com>,
	"NXP i . MX U-Boot Team" <uboot-imx@nxp.com>,
	Joe Hershberger <joe.hershberger@ni.com>,
	Ramon Fried <rfried.dev@gmail.com>,
	u-boot@lists.denx.de, Vladimir Oltean <vladimir.oltean@nxp.com>,
	Claudiu Manoil <claudiu.manoil@nxp.com>,
	Michael Walle <michael@walle.cc>
Cc: Tim Harvey <tharvey@gateworks.com>
Subject: [PATCH 2/9] net: fec: use device sequence vs index when fetching fec
Date: Wed, 30 Jun 2021 16:50:03 -0700	[thread overview]
Message-ID: <20210630235010.27536-3-tharvey@gateworks.com> (raw)
In-Reply-To: <20210630235010.27536-1-tharvey@gateworks.com>

When using uclass_get_device* to get the FEC device we need to use
device sequence instead of index into UCLASS_ETH. In systems where for
example a I2C based DSA switch exists it will probe before the FEC
master and its ports will be registered first and have the first
indexes yet the FEC's sequence comes from the device-tree alias.

Take for example the imx8mm-venice-gw7901 board which has an i2c based
DSA switch:

u-boot=> net list
eth1 : lan1 00:0d:8d:aa:00:2f
eth2 : lan2 00:0d:8d:aa:00:30
eth3 : lan3 00:0d:8d:aa:00:31
eth4 : lan4 00:0d:8d:aa:00:32
eth0 : ethernet@30be0000 00:0d:8d:aa:00:2e active

Thus in this case uclass_get_device(UCLASS_ETH, 0, &dev) returns lan1
which is wrong but uclass_get_device_seq(UCLASS_ETH, 0, &dev) returns
ethernet@30be000 which is correct.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 drivers/net/fec_mxc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 4fd5c01b4a..3abf914833 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -146,7 +146,7 @@ static int fec_get_clk_rate(void *udev, int idx)
 	    CONFIG_IS_ENABLED(CLK_CCF)) {
 		dev = udev;
 		if (!dev) {
-			ret = uclass_get_device(UCLASS_ETH, idx, &dev);
+			ret = uclass_get_device_by_seq(UCLASS_ETH, idx, &dev);
 			if (ret < 0) {
 				debug("Can't get FEC udev: %d\n", ret);
 				return ret;
-- 
2.17.1


  parent reply	other threads:[~2021-06-30 23:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-30 23:50 [PATCH 0/9] Add support for imx8mm-venice-gw7901 and DSA switch Tim Harvey
2021-06-30 23:50 ` [PATCH 1/9] board: gateworks: venice: add imx8mm-gw7901 support Tim Harvey
2021-07-10 19:35   ` sbabic
2021-06-30 23:50 ` Tim Harvey [this message]
2021-07-02  9:44   ` [PATCH 2/9] net: fec: use device sequence vs index when fetching fec Ramon Fried
2021-07-10 19:35   ` sbabic
2021-06-30 23:50 ` [PATCH 3/9] net: fec: set phy_of_node properly for fixed-link phy Tim Harvey
2021-07-02  9:44   ` Ramon Fried
2021-07-10 19:34   ` sbabic
2021-06-30 23:50 ` [PATCH 4/9] net: add set_promisc function to enable/disable Promiscuous mode Tim Harvey
2021-07-02  9:46   ` Ramon Fried
2021-07-10 19:36   ` sbabic
2021-06-30 23:50 ` [PATCH 5/9] net: fec: add set_promisc function Tim Harvey
2021-07-02  9:46   ` Ramon Fried
2021-07-10 19:35   ` sbabic
2021-06-30 23:50 ` [PATCH 6/9] net: dsa: enable master promisc mode if available and needed Tim Harvey
2021-07-02  9:47   ` Ramon Fried
2021-07-10 19:35   ` sbabic
2021-06-30 23:50 ` [PATCH 7/9] net: add support for KSZ9477/KSZ9897/KSZ9567 GbE switch Tim Harvey
2021-07-02  9:49   ` Ramon Fried
2021-07-10 19:35   ` sbabic
2021-06-30 23:50 ` [PATCH 8/9] arm: dts: imx8mm-venice-gw7901.dts: fix dsa switch configuration Tim Harvey
2021-07-10 19:35   ` sbabic
2021-06-30 23:50 ` [PATCH 9/9] configs: imx8mm_venice_defconfig: add support for gbe switch Tim Harvey
2021-07-10 19:37   ` sbabic

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=20210630235010.27536-3-tharvey@gateworks.com \
    --to=tharvey@gateworks.com \
    --cc=claudiu.manoil@nxp.com \
    --cc=festevam@gmail.com \
    --cc=joe.hershberger@ni.com \
    --cc=michael@walle.cc \
    --cc=rfried.dev@gmail.com \
    --cc=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-imx@nxp.com \
    --cc=vladimir.oltean@nxp.com \
    /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.