diff options
author | Wolfgang Denk <wd@denx.de> | 2010-12-17 20:10:49 +0100 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2010-12-17 20:10:49 +0100 |
commit | 2ad6eee1a4d1bf683bc27f909f64d8f6c92376b6 (patch) | |
tree | 64e2f01e7faf84160154b7f89a50747cecaca2ae /post | |
parent | 93eab86bfdcd0104ed255333aea8bcb52c0d394c (diff) | |
parent | d20b9991154241466802ceb17169dc8b5f7e58df (diff) | |
download | u-boot-imx-2ad6eee1a4d1bf683bc27f909f64d8f6c92376b6.zip u-boot-imx-2ad6eee1a4d1bf683bc27f909f64d8f6c92376b6.tar.gz u-boot-imx-2ad6eee1a4d1bf683bc27f909f64d8f6c92376b6.tar.bz2 |
Merge branch 'next' of git://www.denx.de/git/u-boot-ppc4xx into next
Diffstat (limited to 'post')
-rw-r--r-- | post/cpu/ppc4xx/ether.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/post/cpu/ppc4xx/ether.c b/post/cpu/ppc4xx/ether.c index 7f44f38..c508670 100644 --- a/post/cpu/ppc4xx/ether.c +++ b/post/cpu/ppc4xx/ether.c @@ -34,7 +34,10 @@ * are transmitted. The configurable test parameters are: * MIN_PACKET_LENGTH - minimum size of packet to transmit * MAX_PACKET_LENGTH - maximum size of packet to transmit - * TEST_NUM - number of tests + * CONFIG_SYS_POST_ETH_LOOPS - Number of test loops. Each loop + * is tested with a different frame length. Starting with + * MAX_PACKET_LENGTH and going down to MIN_PACKET_LENGTH. + * Defaults to 10 and can be overriden in the board config header. */ #include <post.h> @@ -77,8 +80,12 @@ DECLARE_GLOBAL_DATA_PTR; #endif #define MIN_PACKET_LENGTH 64 -#define MAX_PACKET_LENGTH 256 -#define TEST_NUM 1 +#define MAX_PACKET_LENGTH 1514 +#ifndef CONFIG_SYS_POST_ETH_LOOPS +#define CONFIG_SYS_POST_ETH_LOOPS 10 +#endif +#define PACKET_INCR ((MAX_PACKET_LENGTH - MIN_PACKET_LENGTH) / \ + CONFIG_SYS_POST_ETH_LOOPS) static volatile mal_desc_t tx __cacheline_aligned; static volatile mal_desc_t rx __cacheline_aligned; @@ -361,29 +368,27 @@ static int packet_check (char *packet, int length) return 0; } + char packet_send[MAX_PACKET_LENGTH]; + char packet_recv[MAX_PACKET_LENGTH]; static int test_ctlr (int devnum, int hw_addr) { int res = -1; - char packet_send[MAX_PACKET_LENGTH]; - char packet_recv[MAX_PACKET_LENGTH]; int length; - int i; int l; ether_post_init (devnum, hw_addr); - for (i = 0; i < TEST_NUM; i++) { - for (l = MIN_PACKET_LENGTH; l <= MAX_PACKET_LENGTH; l++) { - packet_fill (packet_send, l); + for (l = MAX_PACKET_LENGTH; l >= MIN_PACKET_LENGTH; + l -= PACKET_INCR) { + packet_fill (packet_send, l); - ether_post_send (devnum, hw_addr, packet_send, l); + ether_post_send (devnum, hw_addr, packet_send, l); - length = ether_post_recv (devnum, hw_addr, packet_recv, - sizeof (packet_recv)); + length = ether_post_recv (devnum, hw_addr, packet_recv, + sizeof (packet_recv)); - if (length != l || packet_check (packet_recv, length) < 0) { - goto Done; - } + if (length != l || packet_check (packet_recv, length) < 0) { + goto Done; } } |