summaryrefslogtreecommitdiff
path: root/drivers/cs8900.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-12-07 18:32:37 +0000
committerwdenk <wdenk>2003-12-07 18:32:37 +0000
commita2663ea4fc9d18cb8000c97ed92c3c668eda8e04 (patch)
tree9eb328b497d6f482e5571635fa00b1d0cae5b185 /drivers/cs8900.c
parentef5a9672c778e22ecb522db625b5df78ea40ed23 (diff)
downloadu-boot-imx-a2663ea4fc9d18cb8000c97ed92c3c668eda8e04.zip
u-boot-imx-a2663ea4fc9d18cb8000c97ed92c3c668eda8e04.tar.gz
u-boot-imx-a2663ea4fc9d18cb8000c97ed92c3c668eda8e04.tar.bz2
* Patches by David Müller, 14 Nov 2003:
- board/mpl/common/common_util.c * implement support for BZIP2 compressed images * various cleanups (printf -> puts, ...) - board/mpl/common/flash.c * report correct errors to upper layers * check the erase fail and VPP low bits in status reg - board/mpl/vcma9/cmd_vcma9.c - board/mpl/vcma9/flash.c * various cleanups (printf -> puts, ...) - common/cmd_usb.c * fix typo in comment - cpu/arm920t/usb_ohci.c * support for S3C2410 is missing in #if line - drivers/cs8900.c * reinit some registers in case of error (cable missing, ...) - fs/fat/fat.c * support for USB/MMC devices is missing in #if line - include/configs/MIP405.h - include/configs/PIP405.h * enable BZIP2 support * enlarge malloc space to 1MiB because of BZIP2 support - include/configs/VCMA9.h * enable BZIP2 support * enlarge malloc space to 1MiB because of BZIP2 support * enable USB support - lib_arm/armlinux.c * change calling convention of ARM Linux kernel as described on http://www.arm.linux.org.uk/developer/booting.php * Patch by Thomas Lange, 14 Nov 2003: Split dbau1x00 into dbau1000, dbau1100 and dbau1500 configs to support all these AMD boards. * Patch by Thomas Lange, 14 Nov 2003: Workaround for mips au1x00 physical memory accesses (the au1x00 uses a 36 bit bus internally and cannot access physical memory directly. Use the uncached SDRAM address instead of the physical one.)
Diffstat (limited to 'drivers/cs8900.c')
-rw-r--r--drivers/cs8900.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/drivers/cs8900.c b/drivers/cs8900.c
index d35332c..082434c 100644
--- a/drivers/cs8900.c
+++ b/drivers/cs8900.c
@@ -45,6 +45,7 @@
#if (CONFIG_COMMANDS & CFG_CMD_NET)
+#undef DEBUG
/* packet page register access functions */
@@ -99,6 +100,20 @@ static void eth_reset (void)
/*NOP*/;
}
+static void eth_reginit (void)
+{
+ /* receive only error free packets addressed to this card */
+ put_reg (PP_RxCTL, PP_RxCTL_IA | PP_RxCTL_Broadcast | PP_RxCTL_RxOK);
+ /* do not generate any interrupts on receive operations */
+ put_reg (PP_RxCFG, 0);
+ /* do not generate any interrupts on transmit operations */
+ put_reg (PP_TxCFG, 0);
+ /* do not generate any interrupts on buffer operations */
+ put_reg (PP_BufCFG, 0);
+ /* enable transmitter/receiver mode */
+ put_reg (PP_LineCTL, PP_LineCTL_Rx | PP_LineCTL_Tx);
+}
+
void cs8900_get_enetaddr (uchar * addr)
{
int i;
@@ -181,21 +196,7 @@ int eth_init (bd_t * bd)
put_reg (PP_IA + 2, bd->bi_enetaddr[2] | (bd->bi_enetaddr[3] << 8));
put_reg (PP_IA + 4, bd->bi_enetaddr[4] | (bd->bi_enetaddr[5] << 8));
- /* receive only error free packets addressed to this card */
- put_reg (PP_RxCTL, PP_RxCTL_IA | PP_RxCTL_Broadcast | PP_RxCTL_RxOK);
-
- /* do not generate any interrupts on receive operations */
- put_reg (PP_RxCFG, 0);
-
- /* do not generate any interrupts on transmit operations */
- put_reg (PP_TxCFG, 0);
-
- /* do not generate any interrupts on buffer operations */
- put_reg (PP_BufCFG, 0);
-
- /* enable transmitter/receiver mode */
- put_reg (PP_LineCTL, PP_LineCTL_Rx | PP_LineCTL_Tx);
-
+ eth_reginit ();
return 0;
}
@@ -215,9 +216,10 @@ extern int eth_rx (void)
status = CS8900_RTDATA; /* stat */
rxlen = CS8900_RTDATA; /* len */
+#ifdef DEBUG
if (rxlen > PKTSIZE_ALIGN + PKTALIGN)
printf ("packet too big!\n");
-
+#endif
for (addr = (unsigned short *) NetRxPackets[0], i = rxlen >> 1; i > 0;
i--)
*addr++ = CS8900_RTDATA;
@@ -245,10 +247,13 @@ retry:
/* Test to see if the chip has allocated memory for the packet */
if ((get_reg (PP_BusSTAT) & PP_BusSTAT_TxRDY) == 0) {
/* Oops... this should not happen! */
+#ifdef DEBUG
printf ("cs: unable to send packet; retrying...\n");
+#endif
for (tmo = get_timer (0) + 5 * CFG_HZ; get_timer (0) < tmo;)
/*NOP*/;
eth_reset ();
+ eth_reginit ();
goto retry;
}
@@ -266,7 +271,9 @@ retry:
/* nothing */ ;
if ((s & (PP_TER_CRS | PP_TER_TxOK)) != PP_TER_TxOK) {
+#ifdef DEBUG
printf ("\ntransmission error %#x\n", s);
+#endif
}
return 0;