aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/mv643xx_eth.c
diff options
context:
space:
mode:
authorLennert Buytenhek <buytenh@wantstofly.org>2008-05-31 19:29:14 -0400
committerLennert Buytenhek <buytenh@wantstofly.org>2008-06-12 02:40:27 -0400
commite1bea50ac4e950ea3249cfed219f49d6be22d280 (patch)
tree50f0c363b647b7daaedb61584091a1b697eeec84 /drivers/net/mv643xx_eth.c
parent073a345c04b01da0cc5b79ac7be0c7c8b1691ef5 (diff)
mv643xx_eth: move PHY wait defines into callers
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
Diffstat (limited to 'drivers/net/mv643xx_eth.c')
-rw-r--r--drivers/net/mv643xx_eth.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index d5c9ceb2f685..ba1348f3b25b 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -169,9 +169,6 @@ static char mv643xx_driver_version[] = "1.0";
169#define PORT_DEFAULT_TRANSMIT_QUEUE_SIZE 800 169#define PORT_DEFAULT_TRANSMIT_QUEUE_SIZE 800
170#define PORT_DEFAULT_RECEIVE_QUEUE_SIZE 400 170#define PORT_DEFAULT_RECEIVE_QUEUE_SIZE 400
171 171
172#define PHY_WAIT_ITERATIONS 1000 /* 1000 iterations * 10uS = 10mS max */
173#define PHY_WAIT_MICRO_SECONDS 10
174
175/* Buffer offset from buffer pointer */ 172/* Buffer offset from buffer pointer */
176#define RX_BUF_OFFSET 0x2 173#define RX_BUF_OFFSET 0x2
177 174
@@ -484,7 +481,7 @@ static unsigned int mv643xx_eth_port_disable_rx(struct mv643xx_private *mp)
484 /* Wait for all Rx activity to terminate. */ 481 /* Wait for all Rx activity to terminate. */
485 /* Check port cause register that all Rx queues are stopped */ 482 /* Check port cause register that all Rx queues are stopped */
486 while (rdl(mp, RXQ_COMMAND(port_num)) & 0xFF) 483 while (rdl(mp, RXQ_COMMAND(port_num)) & 0xFF)
487 udelay(PHY_WAIT_MICRO_SECONDS); 484 udelay(10);
488 } 485 }
489 486
490 return queues; 487 return queues;
@@ -510,11 +507,11 @@ static unsigned int mv643xx_eth_port_disable_tx(struct mv643xx_private *mp)
510 /* Wait for all Tx activity to terminate. */ 507 /* Wait for all Tx activity to terminate. */
511 /* Check port cause register that all Tx queues are stopped */ 508 /* Check port cause register that all Tx queues are stopped */
512 while (rdl(mp, TXQ_COMMAND(port_num)) & 0xFF) 509 while (rdl(mp, TXQ_COMMAND(port_num)) & 0xFF)
513 udelay(PHY_WAIT_MICRO_SECONDS); 510 udelay(10);
514 511
515 /* Wait for Tx FIFO to empty */ 512 /* Wait for Tx FIFO to empty */
516 while (rdl(mp, PORT_STATUS(port_num)) & ETH_PORT_TX_FIFO_EMPTY) 513 while (rdl(mp, PORT_STATUS(port_num)) & ETH_PORT_TX_FIFO_EMPTY)
517 udelay(PHY_WAIT_MICRO_SECONDS); 514 udelay(10);
518 } 515 }
519 516
520 return queues; 517 return queues;
@@ -1067,11 +1064,11 @@ static void eth_port_read_smi_reg(struct mv643xx_private *mp,
1067 1064
1068 /* wait for the SMI register to become available */ 1065 /* wait for the SMI register to become available */
1069 for (i = 0; readl(smi_reg) & ETH_SMI_BUSY; i++) { 1066 for (i = 0; readl(smi_reg) & ETH_SMI_BUSY; i++) {
1070 if (i == PHY_WAIT_ITERATIONS) { 1067 if (i == 1000) {
1071 printk("%s: PHY busy timeout\n", mp->dev->name); 1068 printk("%s: PHY busy timeout\n", mp->dev->name);
1072 goto out; 1069 goto out;
1073 } 1070 }
1074 udelay(PHY_WAIT_MICRO_SECONDS); 1071 udelay(10);
1075 } 1072 }
1076 1073
1077 writel((phy_addr << 16) | (phy_reg << 21) | ETH_SMI_OPCODE_READ, 1074 writel((phy_addr << 16) | (phy_reg << 21) | ETH_SMI_OPCODE_READ,
@@ -1079,11 +1076,11 @@ static void eth_port_read_smi_reg(struct mv643xx_private *mp,
1079 1076
1080 /* now wait for the data to be valid */ 1077 /* now wait for the data to be valid */
1081 for (i = 0; !(readl(smi_reg) & ETH_SMI_READ_VALID); i++) { 1078 for (i = 0; !(readl(smi_reg) & ETH_SMI_READ_VALID); i++) {
1082 if (i == PHY_WAIT_ITERATIONS) { 1079 if (i == 1000) {
1083 printk("%s: PHY read timeout\n", mp->dev->name); 1080 printk("%s: PHY read timeout\n", mp->dev->name);
1084 goto out; 1081 goto out;
1085 } 1082 }
1086 udelay(PHY_WAIT_MICRO_SECONDS); 1083 udelay(10);
1087 } 1084 }
1088 1085
1089 *value = readl(smi_reg) & 0xffff; 1086 *value = readl(smi_reg) & 0xffff;
@@ -1124,11 +1121,11 @@ static void eth_port_write_smi_reg(struct mv643xx_private *mp,
1124 1121
1125 /* wait for the SMI register to become available */ 1122 /* wait for the SMI register to become available */
1126 for (i = 0; readl(smi_reg) & ETH_SMI_BUSY; i++) { 1123 for (i = 0; readl(smi_reg) & ETH_SMI_BUSY; i++) {
1127 if (i == PHY_WAIT_ITERATIONS) { 1124 if (i == 1000) {
1128 printk("%s: PHY busy timeout\n", mp->dev->name); 1125 printk("%s: PHY busy timeout\n", mp->dev->name);
1129 goto out; 1126 goto out;
1130 } 1127 }
1131 udelay(PHY_WAIT_MICRO_SECONDS); 1128 udelay(10);
1132 } 1129 }
1133 1130
1134 writel((phy_addr << 16) | (phy_reg << 21) | 1131 writel((phy_addr << 16) | (phy_reg << 21) |