All of lore.kernel.org
 help / color / mirror / Atom feed
From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
To: Giulio Benetti <giulio.benetti@micronovasrl.com>
Cc: netdev@vger.kernel.org
Subject: Re: macb phy address bug?
Date: Tue, 18 Nov 2008 16:35:08 +0100	[thread overview]
Message-ID: <4922E0AC.6080801@st.com> (raw)
In-Reply-To: <gfuad2$907$1@ger.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 83 bytes --]

Thanks Giulio for your feedback.

So I do think, this is the patch we need.

Peppe

[-- Attachment #2: phy_dev_uid_detection.patch --]
[-- Type: text/x-patch, Size: 920 bytes --]

Fix phy_id detection also for broken hardware.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

--- a/drivers/net/phy/phy_device.c.orig	2008-11-18 09:25:06.929041000 +0100
+++ a/drivers/net/phy/phy_device.c	2008-11-18 16:34:12.929001000 +0100
@@ -227,8 +227,17 @@ struct phy_device * get_phy_device(struc
 	if (r)
 		return ERR_PTR(r);
 
-	/* If the phy_id is all Fs or all 0s, there is no device there */
-	if ((0xffff == phy_id) || (0x00 == phy_id))
+	/* If the phy_id is mostly Fs, there is no device there */
+	if ((phy_id & 0x1fffffff) == 0x1fffffff)
+		return NULL;
+
+	/*
+	 * Broken hardware is sometimes missing the pull down resistor on the
+	 * MDIO line, which results in reads to non-existent devices returning
+	 * 0 rather than 0xffff. Catch this here and treat 0 as a non-existent
+	 * device as well.
+	 */ 
+	if (phy_id == 0)
 		return NULL;
 
 	dev = phy_device_create(bus, addr, phy_id);

  reply	other threads:[~2008-11-18 15:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-16  9:50 macb phy address bug? David Miller
2008-11-18  8:50 ` Giuseppe CAVALLARO
2008-11-18 11:54   ` Giulio Benetti
2008-11-18 15:35     ` Giuseppe CAVALLARO [this message]
2008-11-20  9:04   ` David Miller
2008-11-20 15:59     ` Giuseppe CAVALLARO
  -- strict thread matches above, loose matches on Subject: below --
2008-11-14  7:53 Giulio Benetti
2008-11-14  8:46 ` Giuseppe CAVALLARO

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=4922E0AC.6080801@st.com \
    --to=peppe.cavallaro@st.com \
    --cc=giulio.benetti@micronovasrl.com \
    --cc=netdev@vger.kernel.org \
    /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.