aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/r8169.c
diff options
context:
space:
mode:
authorFrancois Romieu <romieu@fr.zoreil.com>2006-01-28 18:49:09 -0500
committerFrancois Romieu <romieu@fr.zoreil.com>2006-01-28 18:49:09 -0500
commit2371408c021f961b92fd2c42480cfddc9c6254f0 (patch)
treea3a1af14f9048a3492faf1ce044caea5236f84e1 /drivers/net/r8169.c
parent3ee68c4af3fd7228c1be63254b9f884614f9ebb2 (diff)
r8169: prevent excessive busy-waiting
The MII registers read/write function blindly busy waits for an amount of 1000 us (1 ms), then up to 200 ms. These functions are called from irq disabled context. Depending on the clock management, it triggers lost ticks events. Since the value is way above the standard delay required for mii register access, it strangely looks like a bandaid against posted writes. Fixes http://bugzilla.kernel.org/show_bug.cgi?id=5947 Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Diffstat (limited to 'drivers/net/r8169.c')
-rw-r--r--drivers/net/r8169.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 2e1bed153c39..a81338b501fb 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -484,13 +484,12 @@ static void mdio_write(void __iomem *ioaddr, int RegAddr, int value)
484 int i; 484 int i;
485 485
486 RTL_W32(PHYAR, 0x80000000 | (RegAddr & 0xFF) << 16 | value); 486 RTL_W32(PHYAR, 0x80000000 | (RegAddr & 0xFF) << 16 | value);
487 udelay(1000);
488 487
489 for (i = 2000; i > 0; i--) { 488 for (i = 20; i > 0; i--) {
490 /* Check if the RTL8169 has completed writing to the specified MII register */ 489 /* Check if the RTL8169 has completed writing to the specified MII register */
491 if (!(RTL_R32(PHYAR) & 0x80000000)) 490 if (!(RTL_R32(PHYAR) & 0x80000000))
492 break; 491 break;
493 udelay(100); 492 udelay(25);
494 } 493 }
495} 494}
496 495
@@ -499,15 +498,14 @@ static int mdio_read(void __iomem *ioaddr, int RegAddr)
499 int i, value = -1; 498 int i, value = -1;
500 499
501 RTL_W32(PHYAR, 0x0 | (RegAddr & 0xFF) << 16); 500 RTL_W32(PHYAR, 0x0 | (RegAddr & 0xFF) << 16);
502 udelay(1000);
503 501
504 for (i = 2000; i > 0; i--) { 502 for (i = 20; i > 0; i--) {
505 /* Check if the RTL8169 has completed retrieving data from the specified MII register */ 503 /* Check if the RTL8169 has completed retrieving data from the specified MII register */
506 if (RTL_R32(PHYAR) & 0x80000000) { 504 if (RTL_R32(PHYAR) & 0x80000000) {
507 value = (int) (RTL_R32(PHYAR) & 0xFFFF); 505 value = (int) (RTL_R32(PHYAR) & 0xFFFF);
508 break; 506 break;
509 } 507 }
510 udelay(100); 508 udelay(25);
511 } 509 }
512 return value; 510 return value;
513} 511}