[U-Boot] [PATCH] sh_eth: Fix coding style
Nobuhiro Iwamatsu
nobuhiro.iwamatsu.yj at renesas.com
Tue Nov 15 05:24:01 CET 2011
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj at renesas.com>
---
drivers/net/sh_eth.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index 995e249..903ce23 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -44,7 +44,7 @@
#define flush_cache_wback(...)
#endif
-#define SH_ETH_PHY_DELAY 50000
+#define TIMEOUT_CNT 1000
int sh_eth_send(struct eth_device *dev, volatile void *packet, int len)
{
@@ -59,8 +59,8 @@ int sh_eth_send(struct eth_device *dev, volatile void *packet, int len)
}
/* packet must be a 4 byte boundary */
- if ((int)packet & (4 - 1)) {
- printf(SHETHER_NAME ": %s: packet not 4 byte alligned\n", __func__);
+ if ((int)packet & 3) {
+ printf(SHETHER_NAME ": packet not 4 byte alligned\n");
ret = -EFAULT;
goto err;
}
@@ -80,7 +80,7 @@ int sh_eth_send(struct eth_device *dev, volatile void *packet, int len)
outl(EDTRR_TRNS, EDTRR(port));
/* Wait until packet is transmitted */
- timeout = 1000;
+ timeout = TIMEOUT_CNT;
while (port_info->tx_desc_cur->td0 & TD_TACT && timeout--)
udelay(100);
@@ -94,7 +94,6 @@ int sh_eth_send(struct eth_device *dev, volatile void *packet, int len)
if (port_info->tx_desc_cur >= port_info->tx_desc_base + NUM_TX_DESC)
port_info->tx_desc_cur = port_info->tx_desc_base;
- return ret;
err:
return ret;
}
@@ -136,11 +135,10 @@ int sh_eth_recv(struct eth_device *dev)
return len;
}
-#define EDMR_INIT_CNT 1000
static int sh_eth_reset(struct sh_eth_dev *eth)
{
- int port = eth->port;
#if defined(CONFIG_CPU_SH7763)
+ int port = eth->port;
int ret = 0, i;
/* Start e-dmac transmitter and receiver */
@@ -148,19 +146,21 @@ static int sh_eth_reset(struct sh_eth_dev *eth)
/* Perform a software reset and wait for it to complete */
outl(EDMR_SRST, EDMR(port));
- for (i = 0; i < EDMR_INIT_CNT; i++) {
+ for (i = 0; i < TIMEOUT_CNT; i++) {
if (!(inl(EDMR(port)) & EDMR_SRST))
break;
udelay(1000);
}
- if (i == EDMR_INIT_CNT) {
+ if (i == TIMEOUT_CNT) {
printf(SHETHER_NAME ": Software reset timeout\n");
ret = -EIO;
}
return ret;
#else
+ int port = eth->port;
+
outl(inl(EDMR(port)) | EDMR_SRST, EDMR(port));
udelay(3000);
outl(inl(EDMR(port)) & ~EDMR_SRST, EDMR(port));
--
1.7.7
More information about the U-Boot
mailing list