mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-30 11:01:33 +00:00
net: sh_eth: Collect up EDMR_INIT_CNT to TIMEOUT_CNT
EDMR_INIT_CNT holds the check count of initialization. Since there were more same values (1000), this collected as TIMEOUT_CNT. Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com> Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
This commit is contained in:
parent
1d4a2c913f
commit
4ba62c7290
1 changed files with 5 additions and 4 deletions
|
@ -44,6 +44,8 @@
|
||||||
#define flush_cache_wback(...)
|
#define flush_cache_wback(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define TIMEOUT_CNT 1000
|
||||||
|
|
||||||
int sh_eth_send(struct eth_device *dev, volatile void *packet, int len)
|
int sh_eth_send(struct eth_device *dev, volatile void *packet, int len)
|
||||||
{
|
{
|
||||||
struct sh_eth_dev *eth = dev->priv;
|
struct sh_eth_dev *eth = dev->priv;
|
||||||
|
@ -78,7 +80,7 @@ int sh_eth_send(struct eth_device *dev, volatile void *packet, int len)
|
||||||
outl(EDTRR_TRNS, EDTRR(port));
|
outl(EDTRR_TRNS, EDTRR(port));
|
||||||
|
|
||||||
/* Wait until packet is transmitted */
|
/* Wait until packet is transmitted */
|
||||||
timeout = 1000;
|
timeout = TIMEOUT_CNT;
|
||||||
while (port_info->tx_desc_cur->td0 & TD_TACT && timeout--)
|
while (port_info->tx_desc_cur->td0 & TD_TACT && timeout--)
|
||||||
udelay(100);
|
udelay(100);
|
||||||
|
|
||||||
|
@ -134,7 +136,6 @@ int sh_eth_recv(struct eth_device *dev)
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define EDMR_INIT_CNT 1000
|
|
||||||
static int sh_eth_reset(struct sh_eth_dev *eth)
|
static int sh_eth_reset(struct sh_eth_dev *eth)
|
||||||
{
|
{
|
||||||
int port = eth->port;
|
int port = eth->port;
|
||||||
|
@ -146,13 +147,13 @@ static int sh_eth_reset(struct sh_eth_dev *eth)
|
||||||
|
|
||||||
/* Perform a software reset and wait for it to complete */
|
/* Perform a software reset and wait for it to complete */
|
||||||
outl(EDMR_SRST, EDMR(port));
|
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))
|
if (!(inl(EDMR(port)) & EDMR_SRST))
|
||||||
break;
|
break;
|
||||||
udelay(1000);
|
udelay(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == EDMR_INIT_CNT) {
|
if (i == TIMEOUT_CNT) {
|
||||||
printf(SHETHER_NAME ": Software reset timeout\n");
|
printf(SHETHER_NAME ": Software reset timeout\n");
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue