Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Jun 2000 18:33:56 +0000
From:      David Bauer <bauer@genprofile.com>
To:        Robert Withrow <witr@rwwa.com>
Cc:        freebsd-mobile@freebsd.org
Subject:   Re: Netgear FA410TX - ed0: device timeout?
Message-ID:  <395B9694.DB049721@genprofile.com>
References:  <200006291715.NAA96283@pobox.rwwa.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------F8495A8F8EC94DE23ECBFCAD
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

>   io 0x120-0x13f
>   config 0x20 "ed0" 11
> 
> This card has exactly *one* config tuple (the 0x20 one).  Also, I'm using
> the latest version of if_ed.c in the releng_4 branch, but I have no idea
> if that helps or hinders.

Yup? So your card is probably somewhat different from my version. 0x20
is the default index. I have other config tuples:
0x1 with IO at	0x300 this is what I use together with IRQ 11.
The other are:0x2 with IO at 0x320; 0x3 - 0x340; 0x4 - 0x380.

> I may be wrong, but I don't think that will cause the "ed0: device timeout"
> thing.  That message happens when the card isn't interrupting correctly.

You are wrong. The horrible is that the autonegotiation problem gives
exactly the same kind of error one would expect from and interrupt
problem. I had exactly the same trouble with my FA410TX. As far as I
have followed the list, in 4.0-STABLE this problem should be fixed in
the ed driver source. But I'm not sure.

I have attached the fa_select.c. Caution !! The io addr. is hard coded
(see comment in the code).

Hope this helps,
David.
--------------F8495A8F8EC94DE23ECBFCAD
Content-Type: text/plain; charset=us-ascii;
 name="fa_select.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="fa_select.c"

/* fa_select.c			*/
/* modified for FreeBSD 4.x	*/
/*				*/
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <machine/sysarch.h>

#define BASE_ADDR	0x300 /* replace with the card base address */


inline unsigned char
inb (unsigned short port)
{
    unsigned char _v;
    
    __asm__ __volatile__ ("inb %w1,%0":"=a" (_v):"Nd" (port));
    return _v;
}

inline void
outb (unsigned char value, unsigned short port)
{
    __asm__ __volatile__ ("outb %b0,%w1"::"a" (value), "Nd" (port));
}

static int sockets_open(void)
{
    int sock;
    if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) != -1)
	return sock;
    else if ((sock = socket(AF_IPX, SOCK_DGRAM, 0)) != -1)
	return sock;
    else
	return socket(AF_APPLETALK, SOCK_DGRAM, 0);
}
void write_bit(int port, int bit)
{
    outb((bit << 6) + 0x20, port);
    usleep(1);
    outb((bit << 6) + 0xa0, port);
    usleep(1);
    outb((bit << 6) + 0x20, port);
}
int read_bit(int port)
{
    int i;
    outb(0,    port);
    usleep(1);
    outb(0x80, port);
    usleep(1);
    i = inb(port);
    outb(0,    port);
    return (i & 0x10) >> 4;
}
void reset(int port)
{
    outb(0x08, port);
    usleep(1);
    outb(0x0C, port);
    usleep(1);
    outb(0x08, port);
    usleep(1);
    outb(0x0C, port);
    outb(0x00, port);
}
int reada(int port, int adr)
{
    int i,j;
    
    for (i=0; i<0x20; i++)
	write_bit(port, 1);
    
    write_bit(port, 0);
    write_bit(port, 1);
    write_bit(port, 1);
    write_bit(port, 0);
    
    write_bit(port, 0);
    write_bit(port, 0);
    write_bit(port, 0);
    write_bit(port, 0);
    write_bit(port, 0);
    
    write_bit(port, (adr & 0x10) >> 4);
    write_bit(port, (adr & 0x08) >> 3);
    write_bit(port, (adr & 0x04) >> 2);
    write_bit(port, (adr & 0x02) >> 1);
    write_bit(port, (adr & 0x01) >> 0);
    
    j = read_bit(port);
    if (j == 1)
	j = read_bit(port);
    for (i=0; i<16; i++) {
	j = (j << 1) + read_bit(port);
    }
    write_bit(port, 1);
    return j;
}
int writea(int port, int adr, int val)
{
    int i;
    
    outb(0x08, port);
    usleep(1);
    outb(0x0C, port);
    usleep(1);
    outb(0x08, port);
    usleep(1);
    outb(0x0C, port);
    outb(0x00, port);
    
    for (i=0; i<0x20; i++)
	write_bit(port, 1);
    
    write_bit(port, 0);
    write_bit(port, 1);
    write_bit(port, 0);
    write_bit(port, 1);
    
    write_bit(port, 0);
    write_bit(port, 0);
    write_bit(port, 0);
    write_bit(port, 0);
    write_bit(port, 0);
    
    write_bit(port, (adr & 0x10) >> 4);
    write_bit(port, (adr & 0x08) >> 3);
    write_bit(port, (adr & 0x04) >> 2);
    write_bit(port, (adr & 0x02) >> 1);
    write_bit(port, (adr & 0x01) >> 0);
    
    write_bit(port, 1);
    write_bit(port, 0);
    
    write_bit(port, (val & 0x8000) >> 15);
    write_bit(port, (val & 0x4000) >> 14);
    write_bit(port, (val & 0x2000) >> 13);
    write_bit(port, (val & 0x1000) >> 12);
    write_bit(port, (val & 0x0800) >> 11);
    write_bit(port, (val & 0x0400) >> 10);
    write_bit(port, (val & 0x0200) >> 9);
    write_bit(port, (val & 0x0100) >> 8);
    write_bit(port, (val & 0x0080) >> 7);
    write_bit(port, (val & 0x0040) >> 6);
    write_bit(port, (val & 0x0020) >> 5);
    write_bit(port, (val & 0x0010) >> 4);
    write_bit(port, (val & 0x0008) >> 3);
    write_bit(port, (val & 0x0004) >> 2);
    write_bit(port, (val & 0x0002) >> 1);
    write_bit(port, (val & 0x0001) >> 0);
    
    write_bit(port, 1);
    return 0;
}
int 
main(int argc, char **argv)
{
    int skfd, i, sub;
    struct ifreq ifr;
    
/*    base_addr = atoi(argv[3]);*/
/*    printf ("%i",base_addr);*/
    skfd = sockets_open();
    if (skfd == -1) {
	perror("socket");
	exit(1);
    }
    strcpy(ifr.ifr_name, argv[1]);
/*    if (ioctl(skfd, SIOCGIFMAP, &ifr) < 0) {
	perror("ioctl");
	exit(1);
    }*/
    i = atoi(argv[2]);
    switch(i) {
    case 0:
	sub = 0x0000;
	break;
    case 1:
	sub = 0x0100;
	break;
    case 2:
	sub = 0x2000;
	break;
    default:
	sub = 0x2100;
	break;
    }
    i386_set_ioperm(BASE_ADDR+0x1c, 1, 1);
    reset(BASE_ADDR+0x1c);
    writea(BASE_ADDR+0x1c, 0, 0x8000);
    writea(BASE_ADDR+0x1c, 0, sub);
    close(skfd);
    exit(0);
    return 0;
}

--------------F8495A8F8EC94DE23ECBFCAD--



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-mobile" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?395B9694.DB049721>