U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Enrico Leto <enrico.leto@siemens.com>,
	Walter Schweizer <walter.schweizer@siemens.com>,
	Alexander Sverdlin <alexander.sverdlin@siemens.com>,
	Heiko Schocher <hs@denx.de>, Anatolij Gustschin <agust@denx.de>,
	Baruch Siach <baruch@tkos.co.il>,
	Fabio Estevam <festevam@gmail.com>,
	Jerome Forissier <jerome.forissier@linaro.org>,
	Joe Hershberger <joe.hershberger@ni.com>,
	Peng Fan <peng.fan@nxp.com>,
	Peter Robinson <pbrobinson@gmail.com>,
	Ramon Fried <rfried.dev@gmail.com>,
	Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>,
	Troy Kisky <troy.kisky@boundarydevices.com>,
	Ye Li <ye.li@nxp.com>
Subject: [PATCH v1 02/22] net: fec_mxc: fix probing for imx8qxp
Date: Fri,  8 Nov 2024 06:21:23 +0100	[thread overview]
Message-ID: <20241108052143.26874-3-hs@denx.de> (raw)
In-Reply-To: <20241108052143.26874-1-hs@denx.de>

probing on capricorn board (imx8qxp based) brings:

Can't find FEC0 clk rate: -19

Cause is that when probing fec_mxc driver, fec_mii_setspeed()
is called which calls fec_get_clk_rate().

fec_mii_setspeed() calls fec_get_clk_rate with NULL pointer
for udev and so as in IMX8QXP case CLK_CCF is enabled
udev gets searched with:

uclass_get_device_by_seq(UCLASS_ETH, idx, &dev);

but we do not have yet a UCLASS_ETH ! as we just probing it!

Prevent this by passing udev to fec_get_clk_rate()

Signed-off-by: Heiko Schocher <hs@denx.de>
---

 board/boundary/nitrogen6x/nitrogen6x.c |  2 +-
 board/solidrun/mx6cuboxi/mx6cuboxi.c   |  2 +-
 drivers/net/fec_mxc.c                  | 14 +++++++-------
 include/netdev.h                       |  2 +-
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c
index b85fd806cba..1adee9a461f 100644
--- a/board/boundary/nitrogen6x/nitrogen6x.c
+++ b/board/boundary/nitrogen6x/nitrogen6x.c
@@ -281,7 +281,7 @@ int board_eth_init(struct bd_info *bis)
 	setup_iomux_enet();
 
 #ifdef CONFIG_FEC_MXC
-	bus = fec_get_miibus(base, -1);
+	bus = fec_get_miibus(NULL, base, -1);
 	if (!bus)
 		return -EINVAL;
 	/* scan phy 4,5,6,7 */
diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
index e9269ef5353..b543bf8c1fb 100644
--- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
+++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
@@ -385,7 +385,7 @@ static int find_ethernet_phy(void)
 	int phy_addr = -ENOENT;
 
 #ifdef CONFIG_FEC_MXC
-	bus = fec_get_miibus(ENET_BASE_ADDR, -1);
+	bus = fec_get_miibus(NULL, ENET_BASE_ADDR, -1);
 	if (!bus)
 		return -ENOENT;
 
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index d6d5cb52fdd..eca681b16d1 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -160,7 +160,7 @@ static int fec_get_clk_rate(void *udev, int idx)
 	}
 }
 
-static void fec_mii_setspeed(struct ethernet_regs *eth)
+static void fec_mii_setspeed(struct udevice *dev, struct ethernet_regs *eth)
 {
 	/*
 	 * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
@@ -182,7 +182,7 @@ static void fec_mii_setspeed(struct ethernet_regs *eth)
 	u32 hold;
 	int ret;
 
-	ret = fec_get_clk_rate(NULL, 0);
+	ret = fec_get_clk_rate(dev, 0);
 	if (ret < 0) {
 		printf("Can't find FEC0 clk rate: %d\n", ret);
 		return;
@@ -581,7 +581,7 @@ static int fecmxc_init(struct udevice *dev)
 	fec_reg_setup(fec);
 
 	if (fec->xcv_type != SEVENWIRE)
-		fec_mii_setspeed(fec->bus->priv);
+		fec_mii_setspeed(dev, fec->bus->priv);
 
 	/* Set Opcode/Pause Duration Register */
 	writel(0x00010020, &fec->eth->op_pause);	/* FIXME 0xffff0020; */
@@ -996,7 +996,7 @@ static void fec_free_descs(struct fec_priv *fec)
 	free(fec->tbd_base);
 }
 
-struct mii_dev *fec_get_miibus(ulong base_addr, int dev_id)
+struct mii_dev *fec_get_miibus(struct udevice *dev, ulong base_addr, int dev_id)
 {
 	struct ethernet_regs *eth = (struct ethernet_regs *)base_addr;
 	struct mii_dev *bus;
@@ -1018,7 +1018,7 @@ struct mii_dev *fec_get_miibus(ulong base_addr, int dev_id)
 		free(bus);
 		return NULL;
 	}
-	fec_mii_setspeed(eth);
+	fec_mii_setspeed(dev, eth);
 	return bus;
 }
 
@@ -1354,10 +1354,10 @@ static int fecmxc_probe(struct udevice *dev)
 	if (!bus) {
 		dm_mii_bus = false;
 #ifdef CONFIG_FEC_MXC_MDIO_BASE
-		bus = fec_get_miibus((ulong)CONFIG_FEC_MXC_MDIO_BASE,
+		bus = fec_get_miibus(dev, (ulong)CONFIG_FEC_MXC_MDIO_BASE,
 				     dev_seq(dev));
 #else
-		bus = fec_get_miibus((ulong)priv->eth, dev_seq(dev));
+		bus = fec_get_miibus(dev, (ulong)priv->eth, dev_seq(dev));
 #endif
 	}
 	if (!bus) {
diff --git a/include/netdev.h b/include/netdev.h
index 2a06d9a261b..949245ecdec 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -117,7 +117,7 @@ static inline int pci_eth_init(struct bd_info *bis)
 	return num;
 }
 
-struct mii_dev *fec_get_miibus(ulong base_addr, int dev_id);
+struct mii_dev *fec_get_miibus(struct udevice *dev, ulong base_addr, int dev_id);
 
 #ifdef CONFIG_PHYLIB
 struct phy_device;
-- 
2.20.1


  parent reply	other threads:[~2024-11-08  5:22 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08  5:21 [PATCH v1 00/22] imx8qxp: siemens board: updates / sync with mainline Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 01/22] wdt: imx8qxp: add option to control external PMIC wdt via IMX8 SCU Heiko Schocher
2024-11-08  7:19   ` Stefan Roese
2024-11-08 11:47     ` Sverdlin, Alexander
2024-11-08  5:21 ` Heiko Schocher [this message]
2024-11-08  5:21 ` [PATCH v1 03/22] tools: imx8image: Improve error message Heiko Schocher
2024-11-11  8:03   ` Sverdlin, Alexander
2024-11-08  5:21 ` [PATCH v1 04/22] imx: imx_cntr_image.sh: prevent warning for missing spl Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 05/22] imx8qxp: Fix build when using SPL Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 06/22] siemens: capricorn: move to cxg3 reference project with deneb board Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 07/22] siemens: imx8qxp-capricorn-u-boot.dtsi: fix boot Heiko Schocher
2024-11-11  8:34   ` Sverdlin, Alexander
2024-11-08  5:21 ` [PATCH v1 08/22] siemens: capricorn: use DCD_SKIP entry Heiko Schocher
2024-11-11  8:35   ` Schweizer, Walter
2024-11-11  8:49     ` Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 09/22] siemens: imximage.cfg: correct comment Heiko Schocher
2024-11-11  8:41   ` Sverdlin, Alexander
2024-11-08  5:21 ` [PATCH v1 10/22] siemens: imximage.cfg: sync image names Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 11/22] siemens: imx8-capricorn-u-boot.dtsi: add fec2 Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 12/22] siemens: capricorn: add missing ARCH_MISC_INIT Heiko Schocher
2024-11-09 12:03   ` Fabio Estevam
2024-11-08  5:21 ` [PATCH v1 13/22] siemens: configs/capricorn_cxg3_defconfig: updates Heiko Schocher
2024-11-09 12:10   ` Fabio Estevam
2024-11-11 10:04   ` Sverdlin, Alexander
2024-11-08  5:21 ` [PATCH v1 14/22] siemens: capricorn: sync spl code with 8qxp-mek Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 15/22] siemens: imx8-capricorn.dtsi: small adaptions Heiko Schocher
2024-11-09 12:03   ` Fabio Estevam
2024-11-11  5:52     ` Heiko Schocher
2024-11-11  8:25       ` Leto, Enrico
2024-11-11  8:47         ` Heiko Schocher
2024-11-11  9:24           ` Leto, Enrico
2024-11-11 12:08           ` Sverdlin, Alexander
2024-11-11 10:36       ` Sverdlin, Alexander
2024-11-08  5:21 ` [PATCH v1 16/22] siemens: capricorn: board.c fixes Heiko Schocher
2024-11-09 16:38   ` Fabio Estevam
2024-11-11  6:01     ` Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 17/22] siemens: capricorn: add HW version information to boot log Heiko Schocher
2024-11-09 12:09   ` Fabio Estevam
2024-11-11  5:57     ` Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 18/22] siemens: capricorn: get ram size from system controller Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 19/22] siemens: capricorn: get module name from eeprom Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 20/22] siemens: add ddr full memory test Heiko Schocher
2024-11-09 12:06   ` Fabio Estevam
2024-11-11  5:55     ` Heiko Schocher
2024-11-11  8:48       ` Leto, Enrico
2024-11-08  5:21 ` [PATCH v1 21/22] siemens: add ddr signal integrity test Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 22/22] siemens: capricorn: update maintainers Heiko Schocher
2024-11-08 11:51   ` Sverdlin, Alexander

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=20241108052143.26874-3-hs@denx.de \
    --to=hs@denx.de \
    --cc=agust@denx.de \
    --cc=alexander.sverdlin@siemens.com \
    --cc=baruch@tkos.co.il \
    --cc=enrico.leto@siemens.com \
    --cc=festevam@gmail.com \
    --cc=jerome.forissier@linaro.org \
    --cc=joe.hershberger@ni.com \
    --cc=pbrobinson@gmail.com \
    --cc=peng.fan@nxp.com \
    --cc=rfried.dev@gmail.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=troy.kisky@boundarydevices.com \
    --cc=u-boot@lists.denx.de \
    --cc=walter.schweizer@siemens.com \
    --cc=ye.li@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox