Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Add support for the SiS 7016.



details:   https://anonhg.NetBSD.org/src/rev/4d3d72dfb910
branches:  trunk
changeset: 481472:4d3d72dfb910
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Jan 31 18:36:12 2000 +0000

description:
Add support for the SiS 7016.

diffstat:

 sys/dev/pci/if_sip.c    |  22 ++++++++++++++--------
 sys/dev/pci/if_sipreg.h |   8 +++++---
 2 files changed, 19 insertions(+), 11 deletions(-)

diffs (106 lines):

diff -r 850f6e1612b9 -r 4d3d72dfb910 sys/dev/pci/if_sip.c
--- a/sys/dev/pci/if_sip.c      Mon Jan 31 18:34:51 2000 +0000
+++ b/sys/dev/pci/if_sip.c      Mon Jan 31 18:36:12 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_sip.c,v 1.4 1999/11/12 18:14:19 thorpej Exp $       */
+/*     $NetBSD: if_sip.c,v 1.5 2000/01/31 18:36:12 thorpej Exp $       */
 
 /*-
  * Copyright (c) 1999 Network Computer, Inc.
@@ -30,8 +30,8 @@
  */
 
 /*
- * Device driver for the Silicon Integrated Systems SiS900 10/100 PCI
- * Ethernet controller.
+ * Device driver for the Silicon Integrated Systems SiS 900 and
+ * SiS 7016 10/100 PCI Ethernet controllers.
  *    
  * Written by Jason R. Thorpe for Network Computer, Inc.
  */
@@ -93,6 +93,8 @@
 } sip_products[] = {
        { PCI_VENDOR_SIS,       PCI_PRODUCT_SIS_900,
          "SiS 900 10/100 Ethernet" },
+       { PCI_VENDOR_SIS,       PCI_PRODUCT_SIS_7016,
+         "SiS 7016 10/100 Ethernet" },
 
        { 0,                    0,
          NULL },
@@ -170,6 +172,7 @@
        bus_dma_tag_t sc_dmat;          /* bus DMA tag */
        struct ethercom sc_ethercom;    /* ethernet common data */
        void *sc_sdhook;                /* shutdown hook */
+       pci_product_id_t sc_model;      /* which model are we? */
 
        void *sc_ih;                    /* interrupt cookie */
 
@@ -351,6 +354,8 @@
 
        printf(": %s\n", sip->sip_name);
 
+       sc->sc_model = PCI_PRODUCT(pa->pa_id);
+
        /*
         * Map the device.
         */
@@ -1868,11 +1873,12 @@
         * The SiS 900 has only an internal PHY on the MII.  Only allow
         * MII address 0.
         */
-       if (phy != 0)
+       if (sc->sc_model == PCI_PRODUCT_SIS_900 && phy != 0)
                return (0);
 
        bus_space_write_4(sc->sc_st, sc->sc_sh, SIP_ENPHY,
-           (reg << ENPHY_REGADDR_SHIFT) | ENPHY_RWCMD | ENPHY_ACCESS);
+           (phy << ENPHY_PHYADDR_SHIFT) | (reg << ENPHY_REGADDR_SHIFT) |
+           ENPHY_RWCMD | ENPHY_ACCESS);
        do {
                enphy = bus_space_read_4(sc->sc_st, sc->sc_sh, SIP_ENPHY);
        } while (enphy & ENPHY_ACCESS);
@@ -1896,12 +1902,12 @@
         * The SiS 900 has only an internal PHY on the MII.  Only allow
         * MII address 0.
         */
-       if (phy != 0)
+       if (sc->sc_model == PCI_PRODUCT_SIS_900 && phy != 0)
                return;
 
        bus_space_write_4(sc->sc_st, sc->sc_sh, SIP_ENPHY,
-           (val << ENPHY_DATA_SHIFT) | (reg << ENPHY_REGADDR_SHIFT) |
-           ENPHY_ACCESS);
+           (val << ENPHY_DATA_SHIFT) | (phy << ENPHY_PHYADDR_SHIFT) |
+           (reg << ENPHY_REGADDR_SHIFT) | ENPHY_ACCESS);
        do {
                enphy = bus_space_read_4(sc->sc_st, sc->sc_sh, SIP_ENPHY);
        } while (enphy & ENPHY_ACCESS);
diff -r 850f6e1612b9 -r 4d3d72dfb910 sys/dev/pci/if_sipreg.h
--- a/sys/dev/pci/if_sipreg.h   Mon Jan 31 18:34:51 2000 +0000
+++ b/sys/dev/pci/if_sipreg.h   Mon Jan 31 18:36:12 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_sipreg.h,v 1.1 1999/06/01 18:19:13 thorpej Exp $    */
+/*     $NetBSD: if_sipreg.h,v 1.2 2000/01/31 18:36:12 thorpej Exp $    */
 
 /*-
  * Copyright (c) 1999 Network Computer, Inc.
@@ -33,8 +33,8 @@
 #define        _DEV_PCI_IF_SIPREG_H_
 
 /*
- * Register description for the Silicon Integrated Systems SiS900
- * 10/100 PCI Ethernet controller.
+ * Register description for the Silicon Integrated Systems SiS 900
+ * and SiS 7016 10/100 PCI Ethernet controller.
  *
  * Written by Jason R. Thorpe for Network Computer, Inc.
  */
@@ -185,6 +185,8 @@
 #define        SIP_ENPHY       0x1c    /* enhanced PHY access register */
 #define        ENPHY_PHYDATA   0xffff0000      /* PHY data */
 #define        ENPHY_DATA_SHIFT 16
+#define        ENPHY_PHYADDR   0x0000f800      /* PHY number (7016 only) */
+#define        ENPHY_PHYADDR_SHIFT 11
 #define        ENPHY_REGADDR   0x000007c0      /* PHY register */
 #define        ENPHY_REGADDR_SHIFT 6
 #define        ENPHY_RWCMD     0x00000020      /* 1 == read, 0 == write */



Home | Main Index | Thread Index | Old Index