* [U-Boot-Users] [PATCH] NE2000 working again
@ 2007-10-04 17:47 Vlad Lungu
2007-10-20 23:01 ` Wolfgang Denk
0 siblings, 1 reply; 4+ messages in thread
From: Vlad Lungu @ 2007-10-04 17:47 UTC (permalink / raw)
To: u-boot
Fixed typo in ne2000.h, thinko re n2k_inb() usage, don't try
to do anything in eth_stop() if eth_init() was not called.
Simplified RX path in order to avoid timeouts on really really
fast NE2000 cards (read: qemu with internal tftp), NetLoop() is
clever enough to cope with 1 packet per eth_rx().
Signed-off-by: Vlad Lungu <vlad@comsys.ro>
---
drivers/ne2000.c | 36 +++++++++++++-----------------------
drivers/ne2000.h | 2 +-
2 files changed, 14 insertions(+), 24 deletions(-)
diff --git a/drivers/ne2000.c b/drivers/ne2000.c
index b7ed876..0bfe74e 100644
--- a/drivers/ne2000.c
+++ b/drivers/ne2000.c
@@ -755,7 +755,7 @@ static void pcnet_reset_8390(void)
#endif
n2k_outb(E8390_NODMA+E8390_PAGE0+E8390_STOP, E8390_CMD);
- n2k_outb(n2k_inb(nic_base + PCNET_RESET), PCNET_RESET);
+ n2k_outb(n2k_inb(PCNET_RESET), PCNET_RESET);
for (i = 0; i < 100; i++) {
if ((r = (n2k_inb(EN0_ISR) & ENISR_RESET)) != 0)
@@ -833,6 +833,7 @@ static int plen[NB];
static int nrx = 0;
static int pkey = -1;
+static int initialized=0;
void uboot_push_packet_len(int len) {
PRINTK("pushed len = %d, nrx = %d\n", len, nrx);
@@ -846,7 +847,12 @@ void uboot_push_packet_len(int len) {
}
plen[nrx] = len;
dp83902a_recv(&pbuf[nrx*2000], len);
+/*Just pass it to the upper layer*/
+ NetReceive(&pbuf[nrx*2000], plen[nrx]);
+/*eth_rx() was gutted, so this is not needed anymore*/
+#if 0
nrx++;
+#endif
}
void uboot_push_tx_done(int key, int val) {
@@ -903,37 +909,21 @@ int eth_init(bd_t *bd) {
if (dp83902a_init() == false)
return -1;
dp83902a_start(dev_addr);
+ initialized=1;
return 0;
}
void eth_halt() {
PRINTK("### eth_halt\n");
-
- dp83902a_stop();
+ if(initialized)
+ dp83902a_stop();
+ initialized=0;
}
int eth_rx() {
- int j, tmo;
-
- PRINTK("### eth_rx\n");
-
- tmo = get_timer (0) + TOUT * CFG_HZ;
- while(1) {
- dp83902a_poll();
- if (nrx > 0) {
- for(j=0; j<nrx; j++) {
- NetReceive(&pbuf[j*2000], plen[j]);
- }
- nrx = 0;
- return 1;
- }
- if (get_timer (0) >= tmo) {
- printf("timeout during rx\n");
- return 0;
- }
- }
- return 0;
+dp83902a_poll();
+return 1;
}
int eth_send(volatile void *packet, int length) {
diff --git a/drivers/ne2000.h b/drivers/ne2000.h
index 2955533..c13d9f0 100644
--- a/drivers/ne2000.h
+++ b/drivers/ne2000.h
@@ -42,7 +42,7 @@ are GPL, so this is, of course, GPL.
this file might be covered by the GNU General Public License.
Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
- at http://sources.redhat.com/ecos/ecos-license/ */
+ at http://sources.redhat.com/ecos/ecos-license/
-------------------------------------------
####ECOSGPLCOPYRIGHTEND####
####BSDCOPYRIGHTBEGIN####
--
1.5.2.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* [U-Boot-Users] [PATCH] NE2000 working again
2007-10-04 17:47 [U-Boot-Users] [PATCH] NE2000 working again Vlad Lungu
@ 2007-10-20 23:01 ` Wolfgang Denk
2007-10-21 17:53 ` Vlad Lungu
0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Denk @ 2007-10-20 23:01 UTC (permalink / raw)
To: u-boot
In message <4705271E.1010906@comsys.ro> you wrote:
> Fixed typo in ne2000.h, thinko re n2k_inb() usage, don't try
> to do anything in eth_stop() if eth_init() was not called.
> Simplified RX path in order to avoid timeouts on really really
> fast NE2000 cards (read: qemu with internal tftp), NetLoop() is
> clever enough to cope with 1 packet per eth_rx().
>
> Signed-off-by: Vlad Lungu <vlad@comsys.ro>
Applied. Thanks.
But now it would be only consequent to remove all references to the
"nrx" variable as well. Looking forward to your follow-up patch
(sorry, I can't test this atm).
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Two wrongs don't make a right, but three rights make a left.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot-Users] [PATCH] NE2000 working again
2007-10-20 23:01 ` Wolfgang Denk
@ 2007-10-21 17:53 ` Vlad Lungu
2007-10-23 22:40 ` Wolfgang Denk
0 siblings, 1 reply; 4+ messages in thread
From: Vlad Lungu @ 2007-10-21 17:53 UTC (permalink / raw)
To: u-boot
Wolfgang Denk wrote:
> In message <4705271E.1010906@comsys.ro> you wrote:
>
>> Fixed typo in ne2000.h, thinko re n2k_inb() usage, don't try
>> to do anything in eth_stop() if eth_init() was not called.
>> Simplified RX path in order to avoid timeouts on really really
>> fast NE2000 cards (read: qemu with internal tftp), NetLoop() is
>> clever enough to cope with 1 packet per eth_rx().
>>
>> Signed-off-by: Vlad Lungu <vlad@comsys.ro>
>>
>
> Applied. Thanks.
>
> But now it would be only consequent to remove all references to the
> "nrx" variable as well. Looking forward to your follow-up patch
> (sorry, I can't test this atm).
>
There are a lot more things to remove or change : NB, pbuf, plen just to
name a few.
AFAIK, there's no board in the current tree that uses it, not
counting my patch for Qemu -M mips.
How about I look into this after 1.3.0 is released?
Vlad
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot-Users] [PATCH] NE2000 working again
2007-10-21 17:53 ` Vlad Lungu
@ 2007-10-23 22:40 ` Wolfgang Denk
0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2007-10-23 22:40 UTC (permalink / raw)
To: u-boot
Dear Vlad,
in message <471B9220.8000206@comsys.ro> you wrote:
>
> > Applied. Thanks.
> >
> > But now it would be only consequent to remove all references to the
> > "nrx" variable as well. Looking forward to your follow-up patch
> > (sorry, I can't test this atm).
> >
> There are a lot more things to remove or change : NB, pbuf, plen just to
> name a few.
Ah, I see.
> AFAIK, there's no board in the current tree that uses it, not
> counting my patch for Qemu -M mips.
> How about I look into this after 1.3.0 is released?
Agreed. Thanks in advance.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Those who hate and fight must stop themselves -- otherwise it is not
stopped.
-- Spock, "Day of the Dove", stardate unknown
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-10-23 22:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-04 17:47 [U-Boot-Users] [PATCH] NE2000 working again Vlad Lungu
2007-10-20 23:01 ` Wolfgang Denk
2007-10-21 17:53 ` Vlad Lungu
2007-10-23 22:40 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox