Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pcmcia support FUJITSU MB86960/5 based ethernet cards



details:   https://anonhg.NetBSD.org/src/rev/0f96f04f601b
branches:  trunk
changeset: 519643:0f96f04f601b
user:      ichiro <ichiro%NetBSD.org@localhost>
date:      Sun Dec 23 09:25:19 2001 +0000

description:
support FUJITSU MB86960/5 based ethernet cards
FMV-J181,182,182A

diffstat:

 sys/dev/pcmcia/if_mbe_pcmcia.c     |  66 ++++++++++++++++++++++++++++++++-----
 sys/dev/pcmcia/pcmcia_cis_quirks.c |  27 ++++++++-------
 2 files changed, 70 insertions(+), 23 deletions(-)

diffs (217 lines):

diff -r 6460d449c71e -r 0f96f04f601b sys/dev/pcmcia/if_mbe_pcmcia.c
--- a/sys/dev/pcmcia/if_mbe_pcmcia.c    Sun Dec 23 09:21:00 2001 +0000
+++ b/sys/dev/pcmcia/if_mbe_pcmcia.c    Sun Dec 23 09:25:19 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_mbe_pcmcia.c,v 1.24 2001/12/18 11:32:47 ichiro Exp $        */
+/*     $NetBSD: if_mbe_pcmcia.c,v 1.25 2001/12/23 09:25:19 ichiro Exp $        */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mbe_pcmcia.c,v 1.24 2001/12/18 11:32:47 ichiro Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mbe_pcmcia.c,v 1.25 2001/12/23 09:25:19 ichiro Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -90,6 +90,8 @@
 int    mbe_pcmcia_get_enaddr_from_cis __P((struct pcmcia_tuple *, void *));
 int    mbe_pcmcia_get_enaddr_from_mem __P((struct mbe_pcmcia_softc *,
            struct mbe_pcmcia_get_enaddr_args *));
+int    mbe_pcmcia_get_enaddr_from_io __P((struct mbe_pcmcia_softc *,
+           struct mbe_pcmcia_get_enaddr_args *));
 
 static const struct mbe_pcmcia_product {
        const char      *mpp_name;              /* product name */
@@ -98,6 +100,8 @@
        const char      *mpp_cisinfo[4];        /* CIS information */
        u_int32_t       mpp_ioalign;            /* required alignment */
        int             mpp_enet_maddr;
+       int             flags;
+#define MBH10302       0x0001                  /* FUJITSU MBH10302 */
 } mbe_pcmcia_products[] = {
        { PCMCIA_STR_TDK_LAK_CD021BX,           PCMCIA_VENDOR_TDK,
          PCMCIA_PRODUCT_TDK_LAK_CD021BX,       PCMCIA_CIS_TDK_LAK_CD021BX,
@@ -110,7 +114,7 @@
 #if 0 /* XXX 86960-based? */
        { PCMCIA_STR_TDK_LAK_DFL9610,           PCMCIA_VENDOR_TDK,
          PCMCIA_PRODUCT_TDK_LAK_DFL9610,       PCMCIA_CIS_TDK_DFL9610,
-         0, -1 },
+         0, -1, MBH10302 /* XXX */ },
 #endif
 
        { PCMCIA_STR_CONTEC_CNETPC,             PCMCIA_VENDOR_CONTEC,
@@ -121,14 +125,26 @@
          PCMCIA_PRODUCT_FUJITSU_LA501,         PCMCIA_CIS_FUJITSU_LA501,
          0x20, -1 },
 
-       { PCMCIA_STR_FUJITSU_LA10S,             PCMCIA_VENDOR_FUJITSU,
-         PCMCIA_PRODUCT_FUJITSU_LA10S,         PCMCIA_CIS_FUJITSU_LA10S,
-         0, -1 },
+       { PCMCIA_STR_FUJITSU_FMV_J181,          PCMCIA_VENDOR_FUJITSU,
+         PCMCIA_PRODUCT_FUJITSU_FMV_J181,      PCMCIA_CIS_FUJITSU_FMV_J181,
+         0x20, -1, MBH10302 },
+
+       { PCMCIA_STR_FUJITSU_FMV_J182,          PCMCIA_VENDOR_FUJITSU,
+         PCMCIA_PRODUCT_FUJITSU_FMV_J182,      PCMCIA_CIS_FUJITSU_FMV_J182,
+         0, 0xf2c },
+
+       { PCMCIA_STR_FUJITSU_FMV_J182A,         PCMCIA_VENDOR_FUJITSU,
+         PCMCIA_PRODUCT_FUJITSU_FMV_J182A,     PCMCIA_CIS_FUJITSU_FMV_J182A,
+         0, 0x1cc },
 
        { PCMCIA_STR_FUJITSU_ITCFJ182A,         PCMCIA_VENDOR_FUJITSU,
          PCMCIA_PRODUCT_FUJITSU_ITCFJ182A,     PCMCIA_CIS_FUJITSU_ITCFJ182A,
          0, 0x1cc },
 
+       { PCMCIA_STR_FUJITSU_LA10S,             PCMCIA_VENDOR_FUJITSU,
+         PCMCIA_PRODUCT_FUJITSU_LA10S,         PCMCIA_CIS_FUJITSU_LA10S,
+         0, -1 },
+
        { PCMCIA_STR_RATOC_REX_R280,            PCMCIA_VENDOR_RATOC,
          PCMCIA_PRODUCT_RATOC_REX_R280,        PCMCIA_CIS_RATOC_REX_R280,
          0, 0x1fc },
@@ -151,7 +167,9 @@
                    strcmp(pa->card->cis1_info[0], mpp->mpp_cisinfo[0]) == 0 &&
                    pa->card->cis1_info[1] != NULL &&
                    mpp->mpp_cisinfo[1] != NULL &&
-                   strcmp(pa->card->cis1_info[1], mpp->mpp_cisinfo[1]) == 0)
+                   strcmp(pa->card->cis1_info[1], mpp->mpp_cisinfo[1]) == 0 &&
+                  (mpp->mpp_cisinfo[2] == NULL ||
+                   strcmp(pa->card->cis1_info[2], mpp->mpp_cisinfo[2]) == 0))
                        return (mpp);
 
                /* match by vendor/product id */
@@ -226,7 +244,8 @@
         * Don't bother checking flags; the back-end sets the chip
         * into 16-bit mode.
         */
-       if (pcmcia_io_map(pa->pf, PCMCIA_WIDTH_IO16, 0, cfe->iospace[0].length,
+       if (pcmcia_io_map(pa->pf, PCMCIA_WIDTH_IO16, 0,
+           mpp->mpp_ioalign ? mpp->mpp_ioalign : cfe->iospace[0].length,
            &psc->sc_pcioh, &psc->sc_io_window)) {
                printf(": can't map i/o space\n");
                goto iomap_failed;
@@ -234,7 +253,7 @@
 
        printf(": %s\n", mpp->mpp_name);
 
-       /* Read station address from mem or CIS. */
+       /* Read station address from io/mem or CIS. */
        if (mpp->mpp_enet_maddr >= 0) {
                pgea.maddr = mpp->mpp_enet_maddr;
                if (mbe_pcmcia_get_enaddr_from_mem(psc, &pgea) != 0) {
@@ -242,6 +261,14 @@
                            "from mem\n", sc->sc_dev.dv_xname);
                        goto no_enaddr;
                }
+       } else if ((mpp->flags & MBH10302) != 0) {
+               bus_space_write_1(sc->sc_bst, sc->sc_bsh, FE_MBH0 ,
+                                 FE_MBH0_MASK | FE_MBH0_INTR_ENABLE);
+               if (mbe_pcmcia_get_enaddr_from_io(psc, &pgea) != 0) {
+                       printf("%s: Couldn't get ethernet address "
+                           "from io\n", sc->sc_dev.dv_xname);
+                       goto no_enaddr;
+               }
        } else {
                rv = pcmcia_scan_cis(parent,
                    mbe_pcmcia_get_enaddr_from_cis, &pgea);
@@ -266,7 +293,10 @@
        }
 
        /* Perform generic initialization. */
-       mb86960_attach(sc, MB86960_TYPE_86965, pgea.enaddr);
+       if ((mpp->flags & MBH10302) != 0) 
+               mb86960_attach(sc, MB86960_TYPE_86960, pgea.enaddr);
+       else
+               mb86960_attach(sc, MB86960_TYPE_86965, pgea.enaddr);
 
        mb86960_config(sc, NULL, 0, 0);
 
@@ -371,6 +401,22 @@
 }
 
 int
+mbe_pcmcia_get_enaddr_from_io(psc, ea)
+       struct mbe_pcmcia_softc *psc;
+       struct mbe_pcmcia_get_enaddr_args *ea;
+{                       
+       int i;
+
+       for (i = 0; i < ETHER_ADDR_LEN; i++)
+               ea->enaddr[i] = bus_space_read_1(psc->sc_pcioh.iot,
+                   psc->sc_pcioh.ioh, FE_MBH_ENADDR + i);
+
+       if (ea->enaddr == NULL)
+               return (1);
+       return (0);
+}
+
+int
 mbe_pcmcia_get_enaddr_from_mem(psc, ea)
        struct mbe_pcmcia_softc *psc;
        struct mbe_pcmcia_get_enaddr_args *ea;
diff -r 6460d449c71e -r 0f96f04f601b sys/dev/pcmcia/pcmcia_cis_quirks.c
--- a/sys/dev/pcmcia/pcmcia_cis_quirks.c        Sun Dec 23 09:21:00 2001 +0000
+++ b/sys/dev/pcmcia/pcmcia_cis_quirks.c        Sun Dec 23 09:25:19 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pcmcia_cis_quirks.c,v 1.16 2001/12/16 06:07:50 ichiro Exp $    */
+/*     $NetBSD: pcmcia_cis_quirks.c,v 1.17 2001/12/23 09:25:19 ichiro Exp $    */
 
 /*
  * Copyright (c) 1998 Marc Horowitz.  All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pcmcia_cis_quirks.c,v 1.16 2001/12/16 06:07:50 ichiro Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcmcia_cis_quirks.c,v 1.17 2001/12/23 09:25:19 ichiro Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -256,22 +256,22 @@
        0,                      /* maxtwins */
 };
 
-static const struct pcmcia_function pcmcia_fujitsu_j182a_func0 = {
+static const struct pcmcia_function pcmcia_fujitsu_j181_func0 = {
        0,                      /* function number */
        PCMCIA_FUNCTION_NETWORK,
-       0x3d,                   /* last cfe number */
-       0x3f0,                  /* ccr_base */
+       0x21,                   /* last cfe number */
+       0xfe0,                  /* ccr_base */
        0xf,                    /* ccr_mask */
-};      
+};
 
-static const struct pcmcia_config_entry pcmcia_fujitsu_j182a_func0_cfe0 = {
-       0x31,                   /* cfe number */
-       PCMCIA_CFE_IO8 | PCMCIA_CFE_IO16 |
-       PCMCIA_CFE_IRQLEVEL | PCMCIA_CFE_POWERDOWN,
+static const struct pcmcia_config_entry pcmcia_fujitsu_j181_func0_cfe0 = {
+       0xc,                    /* cfe number */
+       PCMCIA_CFE_MWAIT_REQUIRED | PCMCIA_CFE_WP_ACTIVE | PCMCIA_CFE_IO8 |
+       PCMCIA_CFE_IO16 | PCMCIA_CFE_IRQLEVEL | PCMCIA_CFE_IRQPULSE,
        PCMCIA_IFTYPE_IO,
        1,                      /* num_iospace */
        10,                     /* iomask */
-       { { 0x20, 0x220 } },    /* iospace */
+       { { 0x20, 0x140 } },    /* iospace */
        0xffff,                 /* irqmask */
        0,                      /* num_memspace */
        { { 0 } },              /* memspace */
@@ -311,8 +311,9 @@
          &pcmcia_ndc_nd5100_func0, &pcmcia_ndc_nd5100_func0_cfe0 },
        { PCMCIA_VENDOR_EMTAC, PCMCIA_PRODUCT_EMTAC_WLAN, PCMCIA_CIS_INVALID,
          &pcmcia_emtac_a2424i_func0, &pcmcia_emtac_a2424i_func0_cfe0 },
-       { PCMCIA_VENDOR_FUJITSU, PCMCIA_PRODUCT_FUJITSU_ITCFJ182A, PCMCIA_CIS_INVALID,
-         &pcmcia_fujitsu_j182a_func0, &pcmcia_fujitsu_j182a_func0_cfe0 },
+       { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID,
+         PCMCIA_CIS_FUJITSU_FMV_J181,
+         &pcmcia_fujitsu_j181_func0, &pcmcia_fujitsu_j181_func0_cfe0 },
 };
        
 static int n_pcmcia_cis_quirks =



Home | Main Index | Thread Index | Old Index