* [U-Boot] [PATCH] net: Use 0.5 sec timeout in miiphy_reset() instead of counting loop
@ 2010-02-02 12:43 Stefan Roese
2010-02-02 14:14 ` Ladislav Michl
2010-02-07 7:06 ` Ben Warren
0 siblings, 2 replies; 3+ messages in thread
From: Stefan Roese @ 2010-02-02 12:43 UTC (permalink / raw)
To: u-boot
This patch fixes a problem I've notived on a buggy PPC4xx system. This
system has problems with the PHY MDIO communication and seemed to be
stuck/crashed in miiphy_reset(). But degugging revealed, that the CPU
didn't crash, but "only" hung in this counting loop for about 2 minutes.
This patch now uses a real timeout of 0.5 seconds (as mentioned in the
comment in miiphy_reset).
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Ben Warren <biggerbadderben@gmail.com>
---
common/miiphyutil.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/common/miiphyutil.c b/common/miiphyutil.c
index 196ef4a..856fbc7 100644
--- a/common/miiphyutil.c
+++ b/common/miiphyutil.c
@@ -293,7 +293,7 @@ int miiphy_info (char *devname, unsigned char addr, unsigned int *oui,
int miiphy_reset (char *devname, unsigned char addr)
{
unsigned short reg;
- int loop_cnt;
+ int timeout = 500;
if (miiphy_read (devname, addr, PHY_BMCR, ®) != 0) {
debug ("PHY status read failed\n");
@@ -311,13 +311,13 @@ int miiphy_reset (char *devname, unsigned char addr)
* auto-clearing). This should happen within 0.5 seconds per the
* IEEE spec.
*/
- loop_cnt = 0;
reg = 0x8000;
- while (((reg & 0x8000) != 0) && (loop_cnt++ < 1000000)) {
- if (miiphy_read (devname, addr, PHY_BMCR, ®) != 0) {
- debug ("PHY status read failed\n");
- return (-1);
+ while (((reg & 0x8000) != 0) && timeout--) {
+ if (miiphy_read(devname, addr, PHY_BMCR, ®) != 0) {
+ debug("PHY status read failed\n");
+ return -1;
}
+ udelay(1000);
}
if ((reg & 0x8000) == 0) {
return (0);
--
1.6.6.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] net: Use 0.5 sec timeout in miiphy_reset() instead of counting loop
2010-02-02 12:43 [U-Boot] [PATCH] net: Use 0.5 sec timeout in miiphy_reset() instead of counting loop Stefan Roese
@ 2010-02-02 14:14 ` Ladislav Michl
2010-02-07 7:06 ` Ben Warren
1 sibling, 0 replies; 3+ messages in thread
From: Ladislav Michl @ 2010-02-02 14:14 UTC (permalink / raw)
To: u-boot
On Tue, Feb 02, 2010 at 01:43:48PM +0100, Stefan Roese wrote:
> This patch fixes a problem I've notived on a buggy PPC4xx system. This
> system has problems with the PHY MDIO communication and seemed to be
> stuck/crashed in miiphy_reset(). But degugging revealed, that the CPU
> didn't crash, but "only" hung in this counting loop for about 2 minutes.
>
> This patch now uses a real timeout of 0.5 seconds (as mentioned in the
> comment in miiphy_reset).
Well, so this also seems to fix watchdog reseting issue on few boards I see
there (udelay triggers watchdog). Thanks for fixing that!
ladis
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] net: Use 0.5 sec timeout in miiphy_reset() instead of counting loop
2010-02-02 12:43 [U-Boot] [PATCH] net: Use 0.5 sec timeout in miiphy_reset() instead of counting loop Stefan Roese
2010-02-02 14:14 ` Ladislav Michl
@ 2010-02-07 7:06 ` Ben Warren
1 sibling, 0 replies; 3+ messages in thread
From: Ben Warren @ 2010-02-07 7:06 UTC (permalink / raw)
To: u-boot
Stefan,
On 2/2/2010 4:43 AM, Stefan Roese wrote:
> This patch fixes a problem I've notived on a buggy PPC4xx system. This
> system has problems with the PHY MDIO communication and seemed to be
> stuck/crashed in miiphy_reset(). But degugging revealed, that the CPU
> didn't crash, but "only" hung in this counting loop for about 2 minutes.
>
> This patch now uses a real timeout of 0.5 seconds (as mentioned in the
> comment in miiphy_reset).
>
> Signed-off-by: Stefan Roese<sr@denx.de>
> Cc: Ben Warren<biggerbadderben@gmail.com>
> ---
> common/miiphyutil.c | 12 ++++++------
> 1 files changed, 6 insertions(+), 6 deletions(-)
>
Applied to net repo.
thanks,
Ben
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-02-07 7:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-02 12:43 [U-Boot] [PATCH] net: Use 0.5 sec timeout in miiphy_reset() instead of counting loop Stefan Roese
2010-02-02 14:14 ` Ladislav Michl
2010-02-07 7:06 ` Ben Warren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox