Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Add Intersil Prism2.5 Mini-PCI wavelan.



details:   https://anonhg.NetBSD.org/src/rev/74886f7f09a3
branches:  trunk
changeset: 516010:74886f7f09a3
user:      ichiro <ichiro%NetBSD.org@localhost>
date:      Sat Oct 13 15:00:23 2001 +0000

description:
Add Intersil Prism2.5 Mini-PCI wavelan.

diffstat:

 sys/dev/ic/wi.c               |   20 +++-
 sys/dev/ic/wireg.h            |   59 +++++++--
 sys/dev/ic/wivar.h            |    4 +-
 sys/dev/pci/files.pci         |    5 +-
 sys/dev/pci/if_wi_pci.c       |  260 ++++++++++++++++++++++++++++++++++++++++++
 sys/dev/pcmcia/if_wi_pcmcia.c |    3 +-
 6 files changed, 333 insertions(+), 18 deletions(-)

diffs (truncated from 484 to 300 lines):

diff -r 7c430e60b2f8 -r 74886f7f09a3 sys/dev/ic/wi.c
--- a/sys/dev/ic/wi.c   Sat Oct 13 14:46:00 2001 +0000
+++ b/sys/dev/ic/wi.c   Sat Oct 13 15:00:23 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wi.c,v 1.25 2001/09/22 17:22:25 explorer Exp $ */
+/*     $NetBSD: wi.c,v 1.26 2001/10/13 15:00:23 ichiro Exp $   */
 
 /*
  * Copyright (c) 1997, 1998, 1999
@@ -707,6 +707,20 @@
        return;
 }
 
+void
+wi_pci_reset(sc)
+       struct wi_softc         *sc;
+{
+
+       bus_space_write_2(sc->sc_iot, sc->sc_ioh, WI_PCI_COR, 0x80);
+       DELAY(100*1000); /* 100 m sec */
+
+       bus_space_write_2(sc->sc_iot, sc->sc_ioh, WI_PCI_COR, 0x0);
+       DELAY(100*1000); /* 100 m sec */
+
+       return;
+}
+
 /*
  * Read an LTV record from the NIC.
  */
@@ -1891,6 +1905,10 @@
                printf("RF:PRISM2.5 MAC:ISL3873");
                sc->sc_prism2 = 1;
                break;
+       case WI_NIC_3874A:
+               printf("RF:PRISM2.5 MAC:ISL3874A(PCI)");
+               sc->sc_prism2 = 1;
+               break;
        default:
                printf("Lucent chip or unknown chip\n");
                sc->sc_prism2 = 0;
diff -r 7c430e60b2f8 -r 74886f7f09a3 sys/dev/ic/wireg.h
--- a/sys/dev/ic/wireg.h        Sat Oct 13 14:46:00 2001 +0000
+++ b/sys/dev/ic/wireg.h        Sat Oct 13 15:00:23 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wireg.h,v 1.10 2001/09/22 17:22:25 explorer Exp $      */
+/*     $NetBSD: wireg.h,v 1.11 2001/10/13 15:00:23 ichiro Exp $        */
 
 /*
  * Copyright (c) 1997, 1998, 1999
@@ -96,18 +96,24 @@
  * register space access macros
  */
 #define CSR_WRITE_4(sc, reg, val)      \
-       bus_space_write_4(sc->sc_iot, sc->sc_ioh, reg, val)
+       bus_space_write_4(sc->sc_iot, sc->sc_ioh,       \
+                       (sc->sc_pci? reg * 2: reg) , val)
 #define CSR_WRITE_2(sc, reg, val)      \
-       bus_space_write_2(sc->sc_iot, sc->sc_ioh, reg, val)
+       bus_space_write_2(sc->sc_iot, sc->sc_ioh,       \
+                       (sc->sc_pci? reg * 2: reg), val)
 #define CSR_WRITE_1(sc, reg, val)      \
-       bus_space_write_1(sc->sc_iot, sc->sc_ioh, reg, val)
+       bus_space_write_1(sc->sc_iot, sc->sc_ioh,       \
+                       (sc->sc_pci? reg * 2: reg), val)
 
 #define CSR_READ_4(sc, reg)            \
-       bus_space_read_4(sc->sc_iot, sc->sc_ioh, reg)
+       bus_space_read_4(sc->sc_iot, sc->sc_ioh,        \
+                       (sc->sc_pci? reg * 2: reg))
 #define CSR_READ_2(sc, reg)            \
-       bus_space_read_2(sc->sc_iot, sc->sc_ioh, reg)
+       bus_space_read_2(sc->sc_iot, sc->sc_ioh,        \
+                       (sc->sc_pci? reg * 2: reg))
 #define CSR_READ_1(sc, reg)            \
-       bus_space_read_1(sc->sc_iot, sc->sc_ioh, reg)
+       bus_space_read_1(sc->sc_iot, sc->sc_ioh,        \
+                       (sc->sc_pci? reg * 2: reg))
 
 #ifndef __BUS_SPACE_HAS_STREAM_METHODS
 #define bus_space_write_stream_2       bus_space_write_2
@@ -117,13 +123,17 @@
 #endif
 
 #define CSR_WRITE_STREAM_2(sc, reg, val)       \
-       bus_space_write_stream_2(sc->sc_iot, sc->sc_ioh, reg, val)
+       bus_space_write_stream_2(sc->sc_iot, sc->sc_ioh,        \
+                       (sc->sc_pci? reg * 2: reg), val)
 #define CSR_WRITE_MULTI_STREAM_2(sc, reg, val, count)  \
-       bus_space_write_multi_stream_2(sc->sc_iot, sc->sc_ioh, reg, val, count)
+       bus_space_write_multi_stream_2(sc->sc_iot, sc->sc_ioh,  \
+                       (sc->sc_pci? reg * 2: reg), val, count)
 #define CSR_READ_STREAM_2(sc, reg)             \
-       bus_space_read_stream_2(sc->sc_iot, sc->sc_ioh, reg)
+       bus_space_read_stream_2(sc->sc_iot, sc->sc_ioh, \
+                       (sc->sc_pci? reg * 2: reg))
 #define CSR_READ_MULTI_STREAM_2(sc, reg, buf, count)           \
-       bus_space_read_multi_stream_2(sc->sc_iot, sc->sc_ioh, reg, buf, count)
+       bus_space_read_multi_stream_2(sc->sc_iot, sc->sc_ioh,   \
+                       (sc->sc_pci? reg * 2: reg), buf, count)
 
 /*
  * The WaveLAN/IEEE cards contain an 802.11 MAC controller which Lucent
@@ -165,12 +175,13 @@
  */
 
 /*
- * Size of Hermes I/O space.
+ * Size of Hermes & Prism2 I/O space.
  */
 #define WI_IOSIZE              0x40
+#define WI_PCI_CBMA            0x10    /* Configuration Base Memory Address */
 
 /*
- * Hermes register definitions and what little I know about them.
+ * Hermes & Prism2 register definitions 
  */
 
 /* Hermes command/status registers. */
@@ -285,7 +296,7 @@
 #define WI_SW0                 0x28
 #define WI_SW1                 0x2A
 #define WI_SW2                 0x2C
-#define WI_SW3                 0x2E
+#define WI_SW3                 0x2E    /* does not appear in Prism2 */
 
 #define WI_CNTL                        0x14
 
@@ -300,6 +311,25 @@
 #define WI_AUX_DATA            0x3E
 
 /*
+ * PCI Host Interface Registers (HFA3842 Specific)
+ * The value of all Register's Offset, such as WI_INFO_FID and WI_PARAM0,
+ * has doubled.
+ */
+#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    
+
+/*
  * One form of communication with the Hermes is with what Lucent calls
  * LTV records, where LTV stands for Length, Type and Value. The length
  * and type are 16 bits and are in native byte order. The value is in
@@ -381,6 +411,7 @@
 #define WI_NIC_HWB1153 0x8007
 #define WI_NIC_P2_SST  0x8008  /* Prism2 with SST flush */
 #define WI_NIC_PRISM2_5        0x800C
+#define WI_NIC_3874A   0x8013  /* Prism2.5 Mini-PCI */
 };
 
 /*
diff -r 7c430e60b2f8 -r 74886f7f09a3 sys/dev/ic/wivar.h
--- a/sys/dev/ic/wivar.h        Sat Oct 13 14:46:00 2001 +0000
+++ b/sys/dev/ic/wivar.h        Sat Oct 13 15:00:23 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wivar.h,v 1.5 2001/09/22 17:22:25 explorer Exp $       */
+/*     $NetBSD: wivar.h,v 1.6 2001/10/13 15:00:24 ichiro Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999
@@ -50,6 +50,7 @@
        int sc_enabled;
        int sc_prism2;
        int sc_prism2_ver;
+       int sc_pci; /* attach to PCI-Bus */
 
        bus_space_tag_t         sc_iot; /* bus cookie */
        bus_space_handle_t      sc_ioh; /* bus i/o handle */
@@ -96,3 +97,4 @@
 int    wi_intr __P((void *arg));
 void   wi_power __P((struct wi_softc *, int));
 void   wi_shutdown __P((struct wi_softc *));
+void   wi_pci_reset __P((struct wi_softc *));
diff -r 7c430e60b2f8 -r 74886f7f09a3 sys/dev/pci/files.pci
--- a/sys/dev/pci/files.pci     Sat Oct 13 14:46:00 2001 +0000
+++ b/sys/dev/pci/files.pci     Sat Oct 13 15:00:23 2001 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.pci,v 1.140 2001/09/16 00:11:42 eeh Exp $
+#      $NetBSD: files.pci,v 1.141 2001/10/13 15:00:23 ichiro Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -448,6 +448,9 @@
 attach an at pci with an_pci
 file   dev/pci/if_an_pci.c             an_pci
 
+# Intersil Prism2.5 Mini-PCI
+attach wi at pci with wi_pci
+file   dev/pci/if_wi_pci.c             wi_pci
 
 # ISDN devices
 attach isic at pci with isic_pci
diff -r 7c430e60b2f8 -r 74886f7f09a3 sys/dev/pci/if_wi_pci.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/pci/if_wi_pci.c   Sat Oct 13 15:00:23 2001 +0000
@@ -0,0 +1,260 @@
+/*      $NetBSD: if_wi_pci.c,v 1.1 2001/10/13 15:01:07 ichiro Exp $  */
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Hideaki Imaizumi <hiddy%sfc.wide.ad.jp@localhost>
+ * and Ichiro FUKUHARA (ichiro%ichiro.org@localhost).
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *        This product includes software developed by the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * 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.
+ */
+
+/*
+ * PCI bus front-end for the Intersil PCI WaveLan.
+ * Works with Prism2.5 Mini-PCI wavelan.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/mbuf.h>
+#include <sys/syslog.h>
+#include <sys/socket.h>
+#include <sys/device.h>
+#include <sys/callout.h>
+
+#include <net/if.h>
+#include <net/if_ether.h>
+#include <net/if_media.h>
+#include <net/if_ieee80211.h>
+
+#include <machine/bus.h>
+#include <machine/intr.h>
+
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcidevs.h>
+
+#include <dev/ic/wi_ieee.h>
+#include <dev/ic/wireg.h>
+#include <dev/ic/wivar.h>
+
+struct wi_pci_softc {
+       struct wi_softc psc_wi;         /* real "wi" softc */
+
+       /* PCI-specific goo */
+       pci_intr_handle_t psc_ih;       
+       struct pci_attach_args *psc_pa;  
+
+       void *sc_powerhook;             /* power hook descriptor */
+};
+
+static int     wi_pci_match __P((struct device *, struct cfdata *, void *));
+static void    wi_pci_attach __P((struct device *, struct device *, void *));
+static int     wi_pci_enable __P((struct wi_softc *));
+static void    wi_pci_disable __P((struct wi_softc *));
+static void    wi_pci_powerhook __P((int, void *));
+
+static const struct wi_pci_product
+       *wi_pci_lookup __P((struct pci_attach_args *));
+
+struct cfattach wi_pci_ca = {
+       sizeof(struct wi_pci_softc), wi_pci_match, wi_pci_attach
+};
+
+const struct wi_pci_product {
+       pci_vendor_id_t         wpp_vendor;     /* vendor ID */



Home | Main Index | Thread Index | Old Index