From: Andrew May <acmay@acmay.org>
To: linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org
Subject: [RFC Patch] 405gp IBM EMAC Phy probe fails with no link
Date: Mon, 08 Oct 2012 23:23:35 -0700 [thread overview]
Message-ID: <5073C2E7.4050903@acmay.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 732 bytes --]
I have an older PPC 405GP board with a 2.6.33 kernel that fails to
install a eth0 instance because the phy probe fails when there is no
good ethernet link.
I have looked at the latest kernel code and it seems just about the same
in this area, but I have not tried it.
Does anyone else still have a 405GP board to try and see if eth0 comes
up with not enet cable?
I tried to probe the phy earlier and skip the emac_configure() call in
emac_init_phy() to avoid doing the MR0_SRST bit set.
But the phy read still times out.
I then went with this approach to re-call emac_init_phy() after the
emac_reset() finally completes when a cable is plugged in.
Does anyone else have any ideas why the phy probe fails on the first pass?
[-- Attachment #2: ibm_phyprobe.patch --]
[-- Type: text/x-patch, Size: 2450 bytes --]
diff -ur linux.orig/drivers/net/ibm_newemac/core.c linux/drivers/net/ibm_newemac/core.c
--- linux.orig/drivers/net/ibm_newemac/core.c 2012-10-08 12:38:33.000000000 -0700
+++ linux/drivers/net/ibm_newemac/core.c 2012-10-08 14:31:35.797089192 -0700
@@ -106,6 +106,7 @@
*/
static DECLARE_WAIT_QUEUE_HEAD(emac_probe_wait);
+static int emac_init_phy(struct emac_instance *dev);
/* Having stable interface names is a doomed idea. However, it would be nice
* if we didn't have completely random interface names at boot too :-) It's
* just a matter of making everybody's life easier. Since we are doing
@@ -135,7 +136,7 @@
EMAC_FTR_440EP_PHY_CLK_FIX))
DBG(dev, "%s" NL, error);
else if (net_ratelimit())
- printk(KERN_ERR "%s: %s\n", dev->ofdev->node->full_name, error);
+ printk(KERN_INFO "%s: %s\n", dev->ofdev->node->full_name, error);
}
/* EMAC PHY clock workaround:
@@ -161,6 +162,7 @@
}
/* PHY polling intervals */
+#define PHY_POLL_NO_PHY (5 * HZ)
#define PHY_POLL_LINK_ON HZ
#define PHY_POLL_LINK_OFF (HZ / 5)
@@ -1156,8 +1158,12 @@
/* Start PHY polling now.
*/
- if (dev->phy.address >= 0) {
+ if (dev->phy.address >= 0 || dev->phy.address == -2) {
int link_poll_interval;
+ if (dev->phy.address == -2) {
+ netif_carrier_off(dev->ndev);
+ link_poll_interval = PHY_POLL_NO_PHY;
+ }else
if (dev->phy.def->ops->poll_link(&dev->phy)) {
dev->phy.def->ops->read_link(&dev->phy);
emac_rx_clk_default(dev);
@@ -1243,7 +1249,17 @@
if (!dev->opened)
goto bail;
- if (dev->phy.def->ops->poll_link(&dev->phy)) {
+
+ if (!dev->phy.def) {
+ /* If the reset finally clears, because the phy now
+ * has a link, then reprobe for the phy.
+ */
+ if (emac_reset(dev) == 0)
+ {
+ emac_init_phy(dev);
+ }
+ link_poll_interval = PHY_POLL_NO_PHY;
+ }else if (dev->phy.def->ops->poll_link(&dev->phy)) {
if (!netif_carrier_ok(dev->ndev)) {
emac_rx_clk_default(dev);
/* Get new link parameters */
@@ -2376,7 +2392,7 @@
return 0;
}
-static int __devinit emac_init_phy(struct emac_instance *dev)
+static int emac_init_phy(struct emac_instance *dev)
{
struct device_node *np = dev->ofdev->node;
struct net_device *ndev = dev->ndev;
@@ -2470,7 +2486,9 @@
mutex_unlock(&emac_phy_map_lock);
if (i == 0x20) {
printk(KERN_WARNING "%s: can't find PHY!\n", np->full_name);
- return -ENXIO;
+ busy_phy_map = 0;
+ dev->phy.address = -2;
+ return 0;
}
/* Init PHY */
reply other threads:[~2012-10-09 6:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=5073C2E7.4050903@acmay.org \
--to=acmay@acmay.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--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.