diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2001-10-25 19:40:15 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2001-10-25 19:40:15 +0000 |
commit | f58036892d1c192debc42d78dc8234abb13c1bca (patch) | |
tree | 88cfa8106914eb49c3562a576da001cac29de9e6 | |
parent | 18afe60068a5a19fbc93cd6522eb2882223286ad (diff) |
implement "the other" pci interface for wavelans, found on intersil
mini-pci cards. inspired by the netbsd's if_wi_pci.c .
rename WI_COR_* into WI_PLX_COR_*, per millert@'s suggestion.
tested by millert@ for the plx-based cards.
-rw-r--r-- | sys/dev/ic/if_wireg.h | 28 | ||||
-rw-r--r-- | sys/dev/pci/if_wi_pci.c | 90 |
2 files changed, 86 insertions, 32 deletions
diff --git a/sys/dev/ic/if_wireg.h b/sys/dev/ic/if_wireg.h index ad5bd7ea6ec..6e88eeabb90 100644 --- a/sys/dev/ic/if_wireg.h +++ b/sys/dev/ic/if_wireg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wireg.h,v 1.6 2001/10/25 16:39:25 mickey Exp $ */ +/* $OpenBSD: if_wireg.h,v 1.7 2001/10/25 19:40:06 mickey Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -263,8 +263,30 @@ #define WI_AUX_OFFSET 0x3C #define WI_AUX_DATA 0x3E -#define WI_COR_OFFSET 0x3E0 -#define WI_COR_VALUE 0x41 +#define WI_PLX_COR_OFFSET 0x3E0 +#define WI_PLX_COR_VALUE 0x41 + +/* + * PCI Host Interface Registers (HFA3842 Specific) + * The value of all Register's Offset, such as WI_INFO_FID and WI_PARAM0, + * has doubled. + * About WI_PCI_COR: In this Register, only soft-reset bit implement; Bit(7). + */ +#define WI_PCI_COR 0x4C +#define WI_PCI_HCR 0x5C +#define WI_PCI_MASTER0_ADDRH 0x80 +#define WI_PCI_MASTER0_ADDRL 0x84 +#define WI_PCI_MASTER0_LEN 0x88 +#define WI_PCI_MASTER0_CON 0x8C + +#define WI_PCI_STATUS 0x98 + +#define WI_PCI_MASTER1_ADDRH 0xA0 +#define WI_PCI_MASTER1_ADDRL 0xA4 +#define WI_PCI_MASTER1_LEN 0xA8 +#define WI_PCI_MASTER1_CON 0xAC + +#define WI_PCI_SOFT_RESET (1 << 7) /* * One form of communication with the Hermes is with what Lucent calls diff --git a/sys/dev/pci/if_wi_pci.c b/sys/dev/pci/if_wi_pci.c index ed42b43594a..61c5b0412bc 100644 --- a/sys/dev/pci/if_wi_pci.c +++ b/sys/dev/pci/if_wi_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wi_pci.c,v 1.8 2001/10/24 17:33:44 millert Exp $ */ +/* $OpenBSD: if_wi_pci.c,v 1.9 2001/10/25 19:40:14 mickey Exp $ */ /* * Copyright (c) 2001 Todd C. Miller <Todd.Miller@courtesan.com> @@ -108,11 +108,13 @@ #include <dev/ic/if_wi_ieee.h> #include <dev/ic/if_wivar.h> +#define WI_PCI_CBMA 0x10 #define WI_PCI_PLX_LOMEM 0x10 /* PLX chip membase */ #define WI_PCI_PLX_LOIO 0x14 /* PLX chip iobase */ #define WI_PCI_LOMEM 0x18 /* ISA membase */ #define WI_PCI_LOIO 0x1C /* ISA iobase */ +const struct wi_pci_product *wi_pci_lookup __P((struct pci_attach_args *pa)); int wi_pci_match __P((struct device *, void *, void *)); void wi_pci_attach __P((struct device *, struct device *, void *)); int wi_intr __P((void *)); @@ -125,31 +127,39 @@ struct cfattach wi_pci_ca = { static const struct wi_pci_product { pci_vendor_id_t pp_vendor; pci_product_id_t pp_product; + int pp_plx; } wi_pci_products[] = { - { PCI_VENDOR_GLOBALSUN, PCI_PRODUCT_GLOBALSUN_GL24110P }, - { PCI_VENDOR_GLOBALSUN, PCI_PRODUCT_GLOBALSUN_GL24110P02 }, - { PCI_VENDOR_EUMITCOM, PCI_PRODUCT_EUMITCOM_WL11000P }, - { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3CRWE777A }, - { PCI_VENDOR_NETGEAR, PCI_PRODUCT_NETGEAR_MA301 }, + { PCI_VENDOR_GLOBALSUN, PCI_PRODUCT_GLOBALSUN_GL24110P, 1 }, + { PCI_VENDOR_GLOBALSUN, PCI_PRODUCT_GLOBALSUN_GL24110P02, 1 }, + { PCI_VENDOR_EUMITCOM, PCI_PRODUCT_EUMITCOM_WL11000P, 1 }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3CRWE777A, 1 }, + { PCI_VENDOR_NETGEAR, PCI_PRODUCT_NETGEAR_MA301, 1 }, + { PCI_VENDOR_INTERSIL, PCI_PRODUCT_INTERSIL_MINI_PCI_WLAN, 0 }, { 0, 0 } }; -int -wi_pci_match(parent, match, aux) - struct device *parent; - void *match; - void *aux; +const struct wi_pci_product * +wi_pci_lookup(pa) + struct pci_attach_args *pa; { - struct pci_attach_args *pa = aux; const struct wi_pci_product *pp; for (pp = wi_pci_products; pp->pp_product != 0; pp++) { if (PCI_VENDOR(pa->pa_id) == pp->pp_vendor && PCI_PRODUCT(pa->pa_id) == pp->pp_product) - return(1); + return (pp); } - return(0); + return (NULL); +} + +int +wi_pci_match(parent, match, aux) + struct device *parent; + void *match; + void *aux; +{ + return (wi_pci_lookup(aux) != NULL); } void @@ -160,6 +170,7 @@ wi_pci_attach(parent, self, aux) { struct wi_softc *sc = (struct wi_softc *)self; struct pci_attach_args *pa = aux; + const struct wi_pci_product *pp; pci_intr_handle_t ih; bus_space_handle_t ioh, memh; bus_space_tag_t iot = pa->pa_iot; @@ -168,17 +179,30 @@ wi_pci_attach(parent, self, aux) pcireg_t csr; const char *intrstr; - /* Map memory and I/O registers. */ - if (pci_mapreg_map(pa, WI_PCI_LOMEM, PCI_MAPREG_TYPE_MEM, 0, - &memt, &memh, NULL, NULL, 0) != 0) { - printf(": can't map mem space\n"); - return; - } - if (pci_mapreg_map(pa, WI_PCI_LOIO, PCI_MAPREG_TYPE_IO, 0, - &iot, &ioh, NULL, NULL, 0) != 0) { - printf(": can't map I/O space\n"); - return; + pp = wi_pci_lookup(pa); + if (pp->pp_plx) { + /* Map memory and I/O registers. */ + if (pci_mapreg_map(pa, WI_PCI_LOMEM, PCI_MAPREG_TYPE_MEM, 0, + &memt, &memh, NULL, NULL, 0) != 0) { + printf(": can't map mem space\n"); + return; + } + if (pci_mapreg_map(pa, WI_PCI_LOIO, PCI_MAPREG_TYPE_IO, 0, + &iot, &ioh, NULL, NULL, 0) != 0) { + printf(": can't map I/O space\n"); + return; + } + } else { + if (pci_mapreg_map(pa, WI_PCI_CBMA, PCI_MAPREG_TYPE_MEM, + 0, &iot, &ioh, NULL, NULL, 0) != 0) { + printf(": can't map mem space\n"); + return; + } + + memt = iot; + memh = ioh; } + sc->wi_btag = iot; sc->wi_bhandle = ioh; @@ -208,11 +232,19 @@ wi_pci_attach(parent, self, aux) } printf(": %s", intrstr); - /* - * Setup the PLX chip for level interrupts and config index 1 - * XXX - should really reset the PLX chip too. - */ - bus_space_write_1(memt, memh, WI_COR_OFFSET, WI_COR_VALUE); + if (pp->pp_plx) + /* + * Setup the PLX chip for level interrupts and config index 1 + * XXX - should really reset the PLX chip too. + */ + bus_space_write_1(memt, memh, + WI_PLX_COR_OFFSET, WI_PLX_COR_VALUE); + else { + bus_space_write_2(iot, ioh, WI_PCI_COR, WI_PCI_SOFT_RESET); + DELAY(100*1000); /* 100 m sec */ + bus_space_write_2(iot, ioh, WI_PCI_COR, 0x0); + DELAY(100*1000); /* 100 m sec */ + } wi_attach(sc, 1); } |