/*-
* Copyright (c) 1997, 1998, 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center, and Jaromir Dolecek.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Device driver for National Semiconductor DS8390/WD83C690 based ethernet
* adapters.
*
* Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
*
* Copyright (C) 1993, David Greenman. This software may be used, modified,
* copied, distributed, and sold, in both source and binary form provided that
* the above copyright and these terms are retained. Under no circumstances is
* the author responsible for the proper functioning of this software, nor does
* the author assume any responsibility for damages incurred with its use.
*/
/*
* Device driver for the Western Digital/SMC 8003 and 8013 series,
* and the SMC Elite Ultra (8216).
*
* Currently only tested with WD8003W/A and EtherCard PLUS Elite 10T/A
* (8013WP/A). Other WD8003 and SMC Elite based cards should work
* without problems too.
*/
/*
* POS registers differ a lot between 8003 and 8013, so they are
* divided to two sections.
*
* 8003: POS register 2: (adf pos0)
* 7 6 5 4 3 2 1 0
* 0 0 1 \_____/ \__ enable: 0=adapter disabled, 1=adapter enabled
* \____ Adapter I/O Space: 0x200-0x21F + XX*0x20
*
* 8003: POS register 3: (adf pos1)
* 7 6 5 4 3 2 1 0
* 1 1 0 \___/ 1 X
* \______ Shared Ram Space (16K Bytes):
* 0xC0000-0xC3FFF + XX * 0x4000
*
* 8003: POS register 5: (adf pos3)
* 7 6 5 4 3 2 1 0
* \_/
* \__ Interrupt Level: 00=3 01=4 10=10 11=15
*
* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
*
* 8013: POS register 2: (adf pos0)
* 7 6 5 4 3 2 1 0
* \____/ \__ enable: 0=adapter disabled, 1=adapter enabled
* \___________ Adapter I/O Space: 0x0800-0x081F + XX * 0x1000
*
* 8013: POS register 3: (adf pos1)
* 7 6 5 4 3 2 1 0
* | X 0 | \_____/
* | | \__ Shared RAM Base Address
* | | 0xc0000 + ((xx & 0x0f) * 0x2000)
* | \____________ Ram size: 0 = 8k, 1 = 16k
* | some size and address combinations are
* | not supported, varies by card :(
* \__________________ If set, add 0xf00000 to shared RAM base addr
* puts shared RAM near top of 16MB address space
*
* 8013: POS register 5: (adf pos3)
* 7 6 5 4 3 2 1 0
* \_/ \_/
* \ \__ Media Select: 00=TwPr (no link) 10=BNC
* \ 01=AUI|AUI or 10BaseT
* \____ Interrupt Level: 00=3 01=4 10=10 11=14
*/
wep = we_mca_lookup(ma->ma_id);
#ifdef DIAGNOSTIC
if (wep == NULL) {
aprint_error("\n%s: where did the card go?\n",
device_xname(self));
return;
}
#endif
wsc->sc_type = wep->we_type;
/* all cards we support are 16bit native (no need for reset) */
wsc->sc_flags = WE_16BIT_ENABLE|WE_16BIT_NOTOGGLE;
sc->is790 = 0;
typestr = wep->we_typestr;
/* Interface is always enabled. */
sc->sc_enabled = 1;
wsc->sc_init_hook = we_mca_init_hook;
if (we_config(self, wsc, typestr))
return;
/* Map and establish the interrupt. */
wsc->sc_ih = mca_intr_establish(ma->ma_mc, irq,
IPL_NET, dp8390_intr, sc);
if (wsc->sc_ih == NULL) {
aprint_error_dev(self, "can't establish interrupt\n");
return;
}
}
void
we_mca_init_hook(struct we_softc *wsc)
{
/*
* Enable interrupts. This is required for at least WD8003W/A, without
* this, the card doesn't send any interrupts in 16bit mode. The code
* was taken from Linux smc-mca.c driver.
*/
bus_space_write_1(wsc->sc_asict, wsc->sc_asich, WE_LAAR, 0x04);
wsc->sc_laar_proto |= 0x04;
}