* [RFC Patch] 405gp IBM EMAC Phy probe fails with no link
@ 2012-10-09 6:23 Andrew May
0 siblings, 0 replies; only message in thread
From: Andrew May @ 2012-10-09 6:23 UTC (permalink / raw)
To: linuxppc-dev, netdev
[-- 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 */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-10-09 6:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-09 6:23 [RFC Patch] 405gp IBM EMAC Phy probe fails with no link Andrew May
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.