Subject: Re: Problems with Xircom PCMCIA cards (device timeout)
To: None <tech-kern@netbsd.org>
From: David Laight <David.Laight@btinternet.com>
List: tech-kern
Date: 01/05/2002 17:50:39
> > The CIS is (on the cards I've seem) that of a modem - so the modem will
> > work in a standard system without any Xircom drivers.
> 
> The one I've seen has the CIS of a modem, put points to the ethernet
> registers.

OK: From my driver for this card - the Xircom spec has been available
without NDA from their website, although I needed info from the one
we signed an NDA for and the 'free' one (there are subtle differences).

/* layout of control registers at offset 0x800 in attribute space */

typedef struct {
    vuint8 dg_ecor;  /* ethernet configuration option */
#define DG_ECOR_ENABLE 0x01  /*  1 => enabled */
#define DG_ECOR_IOBASE 0x02  /*  2 => iobase enabled */
#define DG_ECOR_INT_EN 0x04  /*  4 => interrupt enabled */
#define DG_ECOR_INDEX 0x18   /* 18 => iobase 300/310/320/everwhere */
#define DG_ECOR_STSCHG 0x20  /* 20 => interrupt via 'STSCHG' */
#define DG_ECOR_LEVEL 0x40   /* 40 => uses level interrupts */
#define DG_ECOR_SRESET 0x80  /* 80 => reset */
    uint8 dg_f_1;
    vuint8 dg_ecsr;          /* ethernet configuration status */
#define DG_ECRS_INTACK 0x01  /*  1 => software intack required */
#define DG_ECRS_INT 0x02     /*  2 => interrupt pending */
#define DG_ECRS_PWR_OFF 0x04 /*  4 => power down ethernet */

/* Registers below here only exist for the REM10 (ethernet + modem) card */
    uint8 dg_f_3_9[7];
    vuint8 dg_ebar0;         /* eth base address low (if enabled) */
    uint8 dg_f_b;
    vuint8 dg_ebar1;         /* eth base address high */
    uint8 dg_f_d_1f[0x13];

    vuint8 dg_dcor0;         /* option config 0 */
#define DG_DCOR0_SF_INT 0x01 /*  1 => second function int enable */
#define DG_DCOR0_DECODE 0x04 /*  2 => sf decode in dingo */
#define DG_DCOR0_BUS 0x08    /*  4 => sf ISA (else PCMCIA) */
#define DG_DCOR0_SFLED3 0x30 /* 30 => LED3 drive selecet */
#define DG_DCOR0_SFRST 0xC0  /* C0 => sf reset source */
    uint8 dg_f_21;
    vuint8 dg_dcor1;         /* option config 1 */
#define DG_DCOR1_SF_I_S 0x01 /*  1 => sf int => STSCHG pin */
#define DG_DCOR1_SF_STS 0x02 /*  2 => sf STSCHG => STSCHG pin */
#define DG_DCOR1_SF_LVL 0x0c /*  c => sf interrupt level */
/* The rest can be ignored - second function is external pcmcia */
} dingo_cfg_t;

The initialisation contains (probably executed in this order:-)

    /* ensure function enabled and not powered down */
    td->td_dingo_cfg->dg_ecsr = 0;
    td->td_dingo_cfg->dg_ecor = DG_ECOR_ENABLE;
    /* software reset ethernet controller */
    td->td_dingo_cfg->dg_ecor = DG_ECOR_ENABLE | DG_ECOR_SRESET;
    drv_usecwait( 1 );
    td->td_dingo_cfg->dg_ecor = DG_ECOR_ENABLE;
    drv_usecwait( 2 );
...
    /* If modem+ethernet card... (10M or 100M) */
    if (td->td_board_type == XIRCOM_PRODUCT_REM10) {
        /* set second function to interrupt via INTR */
        td->td_dingo_cfg->dg_dcor0 = DG_DCOR0_SF_INT;
        td->td_dingo_cfg->dg_dcor1 = DG_DCOR1_SF_LVL;
    }
...
    /* enable interrupt, routed to status_change line */
    if (td->td_board_type == XIRCOM_PRODUCT_REM10)
        td->td_dingo_cfg->dg_ecor = DG_ECOR_ENABLE | DG_ECOR_LEVEL
                | DG_ECOR_STSCHG | DG_ECOR_INT_EN;
    else
        td->td_dingo_cfg->dg_ecor = DG_ECOR_ENABLE | DG_ECOR_LEVEL
                | DG_ECOR_INT_EN;


I don't have an x86 pc - so can't test this on netBSD.  The StrongArm
box I wrote the drivers for needs a netbsd port.....

    David