DM9000: improve eth_send() routine
The eth_send routine of the U-boot DM9000x driver does not match the DM9000 or DM9000A application notes/programming guides. This change improves the stability of the DM9000A network controller. This change has been tested with DM9000A, DM9000E, DM9000EP. Signed-off-by: Remy Bohmer <linux@bohmer.net> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
This commit is contained in:
parent
134e266253
commit
acba31847f
|
@ -42,6 +42,9 @@ v1.2 03/18/2003 Weilun Huang <weilun_huang@davicom.com.tw>:
|
||||||
06/03/2008 Remy Bohmer <linux@bohmer.net>
|
06/03/2008 Remy Bohmer <linux@bohmer.net>
|
||||||
- Added autodetect of databus width.
|
- Added autodetect of databus width.
|
||||||
- Made debug code compile again.
|
- Made debug code compile again.
|
||||||
|
- Adapt eth_send such that it matches the DM9000*
|
||||||
|
application notes. Needed to make it work properly
|
||||||
|
for DM9000A.
|
||||||
These changes are tested with DM9000{A,EP,E} together
|
These changes are tested with DM9000{A,EP,E} together
|
||||||
with a 200MHz Atmel AT91SAM92161 core
|
with a 200MHz Atmel AT91SAM92161 core
|
||||||
|
|
||||||
|
@ -505,15 +508,16 @@ int
|
||||||
eth_send(volatile void *packet, int length)
|
eth_send(volatile void *packet, int length)
|
||||||
{
|
{
|
||||||
char *data_ptr;
|
char *data_ptr;
|
||||||
u32 tmplen, i;
|
|
||||||
int tmo;
|
int tmo;
|
||||||
struct board_info *db = &dm9000_info;
|
struct board_info *db = &dm9000_info;
|
||||||
|
|
||||||
DM9000_DMP_PACKET("eth_send", packet, length);
|
DM9000_DMP_PACKET("eth_send", packet, length);
|
||||||
|
|
||||||
|
DM9000_iow(DM9000_ISR, IMR_PTM); /* Clear Tx bit in ISR */
|
||||||
|
|
||||||
/* Move data to DM9000 TX RAM */
|
/* Move data to DM9000 TX RAM */
|
||||||
data_ptr = (char *) packet;
|
data_ptr = (char *) packet;
|
||||||
DM9000_outb(DM9000_MWCMD, DM9000_IO);
|
DM9000_outb(DM9000_MWCMD, DM9000_IO); /* Prepare for TX-data */
|
||||||
|
|
||||||
/* push the data to the TX-fifo */
|
/* push the data to the TX-fifo */
|
||||||
(db->outblk)(data_ptr, length);
|
(db->outblk)(data_ptr, length);
|
||||||
|
@ -527,12 +531,15 @@ eth_send(volatile void *packet, int length)
|
||||||
|
|
||||||
/* wait for end of transmission */
|
/* wait for end of transmission */
|
||||||
tmo = get_timer(0) + 5 * CFG_HZ;
|
tmo = get_timer(0) + 5 * CFG_HZ;
|
||||||
while (DM9000_ior(DM9000_TCR) & TCR_TXREQ) {
|
while ( !(DM9000_ior(DM9000_NSR) & (NSR_TX1END | NSR_TX2END)) ||
|
||||||
|
!(DM9000_ior(DM9000_ISR) & IMR_PTM) ) {
|
||||||
if (get_timer(0) >= tmo) {
|
if (get_timer(0) >= tmo) {
|
||||||
printf("transmission timeout\n");
|
printf("transmission timeout\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DM9000_iow(DM9000_ISR, IMR_PTM); /* Clear Tx bit in ISR */
|
||||||
|
|
||||||
DM9000_DBG("transmit done\n\n");
|
DM9000_DBG("transmit done\n\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue