summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2008-12-01 09:13:00 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2008-12-01 09:13:00 +0000
commit58adcdbb77d4602189a3abb2f83c91ede1187d74 (patch)
tree5e37bc90f0f5788e732af9a6e2b6eafa9fcd77b9
parentb1627be29493e784c005f19e34632f06414a9cbf (diff)
Configure the clock sources for tx mac/offload engines, required
for newer revisions, makes the JMC261 work. Thanks to JMicron for supplying hardware to test against. ok brad@
-rw-r--r--sys/dev/pci/if_jme.c13
-rw-r--r--sys/dev/pci/if_jmereg.h12
-rw-r--r--sys/dev/pci/if_jmevar.h3
3 files changed, 25 insertions, 3 deletions
diff --git a/sys/dev/pci/if_jme.c b/sys/dev/pci/if_jme.c
index b2c0707d444..ac37a0ef7fd 100644
--- a/sys/dev/pci/if_jme.c
+++ b/sys/dev/pci/if_jme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_jme.c,v 1.13 2008/11/09 15:08:26 naddy Exp $ */
+/* $OpenBSD: if_jme.c,v 1.14 2008/12/01 09:12:59 jsg Exp $ */
/*-
* Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org>
* All rights reserved.
@@ -550,6 +550,8 @@ jme_attach(struct device *parent, struct device *self, void *aux)
}
}
+ sc->jme_revfm = (reg & CHIPMODE_REVFM_MASK) >> CHIPMODE_REVFM_SHIFT;
+
if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_JMICRON_JMC250 &&
PCI_REVISION(pa->pa_class) == JME_REV_JMC250_A2)
sc->jme_workaround |= JME_WA_CRCERRORS | JME_WA_PACKETLOSS;
@@ -1438,6 +1440,15 @@ jme_mac_config(struct jme_softc *sc)
default:
break;
}
+
+ if (sc->jme_revfm >= 2) {
+ /* set clock sources for tx mac and offload engine */
+ if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T)
+ ghc |= GHC_TCPCK_1000 | GHC_TXCK_1000;
+ else
+ ghc |= GHC_TCPCK_10_100 | GHC_TXCK_10_100;
+ }
+
CSR_WRITE_4(sc, JME_GHC, ghc);
CSR_WRITE_4(sc, JME_RXMAC, rxmac);
CSR_WRITE_4(sc, JME_TXMAC, txmac);
diff --git a/sys/dev/pci/if_jmereg.h b/sys/dev/pci/if_jmereg.h
index e059a76ae56..fbdd8563c9e 100644
--- a/sys/dev/pci/if_jmereg.h
+++ b/sys/dev/pci/if_jmereg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_jmereg.h,v 1.3 2008/11/07 22:41:17 brad Exp $ */
+/* $OpenBSD: if_jmereg.h,v 1.4 2008/12/01 09:12:59 jsg Exp $ */
/*-
* Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org>
* All rights reserved.
@@ -336,6 +336,14 @@
#define JME_GHC 0x0054
#define GHC_LOOPBACK 0x80000000
#define GHC_RESET 0x40000000
+/* Tx offload engine clock source */
+#define GHC_TCPCK_10_100 0x00800000
+#define GHC_TCPCK_1000 0x00400000
+#define GHC_TCPCK_MASK 0x00c00000
+/* Tx MAC clock source */
+#define GHC_TXCK_10_100 0x00200000
+#define GHC_TXCK_1000 0x00100000
+#define GHC_TXCK_MASK 0x00300000
#define GHC_FULL_DUPLEX 0x00000040
#define GHC_SPEED_UNKNOWN 0x00000000
#define GHC_SPEED_10 0x00000010
@@ -724,6 +732,8 @@
#define CHIPMODE_NOT_FPGA 0
#define CHIPMODE_REV_MASK 0x0000FF00
#define CHIPMODE_REV_SHIFT 8
+#define CHIPMODE_REVFM_MASK 0x00000F00
+#define CHIPMODE_REVFM_SHIFT 8
#define CHIPMODE_MODE_48P 0x0000000C
#define CHIPMODE_MODE_64P 0x00000004
#define CHIPMODE_MODE_128P_MAC 0x00000003
diff --git a/sys/dev/pci/if_jmevar.h b/sys/dev/pci/if_jmevar.h
index 19a70545aa3..3af8a79beec 100644
--- a/sys/dev/pci/if_jmevar.h
+++ b/sys/dev/pci/if_jmevar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_jmevar.h,v 1.3 2008/10/29 01:55:53 brad Exp $ */
+/* $OpenBSD: if_jmevar.h,v 1.4 2008/12/01 09:12:59 jsg Exp $ */
/*-
* Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org>
* All rights reserved.
@@ -175,6 +175,7 @@ struct jme_softc {
bus_dma_tag_t sc_dmat;
pci_chipset_tag_t jme_pct;
pcitag_t jme_pcitag;
+ uint8_t jme_revfm;
int jme_irq_rid;
struct resource *jme_irq_res;