public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Markus Koch <markus@notsyncing.net>
To: ioana.ciornei@nxp.com, joe.hershberger@ni.com, rfried.dev@gmail.com
Cc: madalin.bucur@oss.nxp.com, camelia.groza@nxp.com,
	u-boot@lists.denx.de, Markus Koch <markus@notsyncing.net>
Subject: [PATCH v2] net: fsl_mdio: Fix busy flag polling register
Date: Tue,  4 Jan 2022 16:41:50 +0100	[thread overview]
Message-ID: <20220104154149.9473-1-markus@notsyncing.net> (raw)

NXP's mEMAC reference manual, Chapter 6.5.5 "MDIO Ethernet Management
Interface usage", specifies to poll the BSY (0) bit in the CFG/STAT
register to wait until a transaction has finished, not bit 31 in the
data register.

In the Linux kernel, this has already been fixed in commit 26eee0210ad7
("net/fsl: fix a bug in xgmac_mdio").

Signed-off-by: Markus Koch <markus@notsyncing.net>
---

Changed to use the mdio_stat register. Thanks, Ioana!

 drivers/net/fm/memac_phy.c | 2 +-
 include/fsl_memac.h        | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/fm/memac_phy.c b/drivers/net/fm/memac_phy.c
index 72b500a6d1..3ddae97e09 100644
--- a/drivers/net/fm/memac_phy.c
+++ b/drivers/net/fm/memac_phy.c
@@ -64,7 +64,7 @@ static int memac_wait_until_done(struct memac_mdio_controller *regs)
 {
 	unsigned int timeout = MAX_NUM_RETRIES;
 
-	while ((memac_in_32(&regs->mdio_data) & MDIO_DATA_BSY) && timeout--)
+	while ((memac_in_32(&regs->mdio_stat) & MDIO_STAT_BSY) && timeout--)
 		;
 
 	if (!timeout) {
diff --git a/include/fsl_memac.h b/include/fsl_memac.h
index d067f1511c..6ac1e558b9 100644
--- a/include/fsl_memac.h
+++ b/include/fsl_memac.h
@@ -254,7 +254,6 @@ struct memac_mdio_controller {
 #define MDIO_CTL_READ		(1 << 15)
 
 #define MDIO_DATA(x)		(x & 0xffff)
-#define MDIO_DATA_BSY		(1 << 31)
 
 struct fsl_enet_mac;
 
-- 
2.34.1


             reply	other threads:[~2022-01-04 15:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04 15:41 Markus Koch [this message]
2022-01-07 16:23 ` [PATCH v2] net: fsl_mdio: Fix busy flag polling register Camelia Alexandra Groza (OSS)
2022-01-07 17:49   ` Markus Koch
2022-01-10 17:42     ` Camelia Alexandra Groza (OSS)

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=20220104154149.9473-1-markus@notsyncing.net \
    --to=markus@notsyncing.net \
    --cc=camelia.groza@nxp.com \
    --cc=ioana.ciornei@nxp.com \
    --cc=joe.hershberger@ni.com \
    --cc=madalin.bucur@oss.nxp.com \
    --cc=rfried.dev@gmail.com \
    --cc=u-boot@lists.denx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox