summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2006-09-17 17:20:43 +0000
committerBrad Smith <brad@cvs.openbsd.org>2006-09-17 17:20:43 +0000
commit2ce66d6d69e93edee0f3720e1cebc8674476175e (patch)
treefd35203e0cd7edfc9c3c5312e10eb3ab2384854c /sys
parent10ec1deaf33dc7b3ab3488f54302f88f197eda34 (diff)
- correct the firmware synchronization in bge_reset(), this
eliminates firmware timeouts for the BCM5752 as the hw firmware was coming up too fast for the driver. - remove the redundant firmware check in bge_chipinit(). Tested by pedro la peu <pedro at am-gen dot org> on an IBM ThinksPpad Z61m with a BCM5752, as well as the 5700/5703/5704 and 5750. The initial diff for bge_reset() and other information from David Christensen <davidch at broadcom dot com>.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/if_bge.c40
-rw-r--r--sys/dev/pci/if_bgereg.h13
2 files changed, 20 insertions, 33 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c
index b911dee36b0..acc0aba03a7 100644
--- a/sys/dev/pci/if_bge.c
+++ b/sys/dev/pci/if_bge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bge.c,v 1.177 2006/09/17 16:45:22 brad Exp $ */
+/* $OpenBSD: if_bge.c,v 1.178 2006/09/17 17:20:42 brad Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -172,7 +172,7 @@ void bge_free_rx_ring_jumbo(struct bge_softc *);
void bge_free_tx_ring(struct bge_softc *);
int bge_init_tx_ring(struct bge_softc *);
-int bge_chipinit(struct bge_softc *);
+void bge_chipinit(struct bge_softc *);
int bge_blockinit(struct bge_softc *);
u_int32_t bge_readmem_ind(struct bge_softc *, int);
@@ -1071,7 +1071,7 @@ bge_setpromisc(struct bge_softc *sc)
* Do endian, PCI and DMA initialization. Also check the on-board ROM
* self-test results.
*/
-int
+void
bge_chipinit(struct bge_softc *sc)
{
struct pci_attach_args *pa = &(sc->bge_pa);
@@ -1082,18 +1082,6 @@ bge_chipinit(struct bge_softc *sc)
pci_conf_write(pa->pa_pc, pa->pa_tag, BGE_PCI_MISC_CTL,
BGE_INIT);
- /*
- * Check the 'ROM failed' bit on the RX CPU to see if
- * self-tests passed. Skip this check when there's no SEEPROM
- * fitted, since in that case it will always fail.
- */
- if (sc->bge_eeprom &&
- CSR_READ_4(sc, BGE_RXCPU_MODE) & BGE_RXCPUMODE_ROMFAIL) {
- printf("%s: RX CPU self-diagnostics failed!\n",
- sc->bge_dev.dv_xname);
- return (ENODEV);
- }
-
/* Clear the MAC control register */
CSR_WRITE_4(sc, BGE_MAC_MODE, 0);
@@ -1217,8 +1205,6 @@ bge_chipinit(struct bge_softc *sc)
/* Set the timer prescaler (always 66MHz) */
CSR_WRITE_4(sc, BGE_MISC_CFG, 65 << 1/*BGE_32BITTIME_66MHZ*/);
-
- return (0);
}
int
@@ -1765,10 +1751,7 @@ bge_attach(struct device *parent, struct device *self, void *aux)
DPRINTFN(5, ("bge_reset\n"));
bge_reset(sc);
- if (bge_chipinit(sc)) {
- printf(": chip initialization failed\n");
- goto fail_1;
- }
+ bge_chipinit(sc);
/*
* Get station address from the EEPROM.
@@ -2037,6 +2020,15 @@ bge_reset(struct bge_softc *sc)
}
}
+ if (BGE_IS_5705_OR_BEYOND(sc))
+ reset |= BGE_MISCCFG_KEEP_GPHY_POWER;
+
+ /*
+ * Write the magic number to the firmware mailbox at 0xb50
+ * so that the driver can synchronize with the firmware.
+ */
+ bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM, BGE_MAGIC_NUMBER);
+
/* Issue global reset */
bge_writereg_ind(sc, BGE_MISC_CFG, reset);
@@ -2073,12 +2065,6 @@ bge_reset(struct bge_softc *sc)
CSR_WRITE_4(sc, BGE_MARB_MODE, BGE_MARBMODE_ENABLE);
/*
- * Prevent PXE restart: write a magic number to the
- * general communications memory at 0xB50.
- */
- bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM, BGE_MAGIC_NUMBER);
-
- /*
* Poll the value location we just wrote until
* we see the 1's complement of the magic number.
* This indicates that the firmware initialization
diff --git a/sys/dev/pci/if_bgereg.h b/sys/dev/pci/if_bgereg.h
index 22b07b6bbbe..15e17829413 100644
--- a/sys/dev/pci/if_bgereg.h
+++ b/sys/dev/pci/if_bgereg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bgereg.h,v 1.57 2006/08/29 17:44:16 kettenis Exp $ */
+/* $OpenBSD: if_bgereg.h,v 1.58 2006/09/17 17:20:42 brad Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -1727,7 +1727,7 @@
/* Misc. config register */
#define BGE_MISCCFG_RESET_CORE_CLOCKS 0x00000001
#define BGE_MISCCFG_TIMER_PRESCALER 0x000000FE
-#define BGE_MISCCFG_GPHY_POWER_RESET 0x04000000
+#define BGE_MISCCFG_KEEP_GPHY_POWER 0x04000000
#define BGE_32BITTIME_66MHZ (0x41 << 1)
@@ -1812,10 +1812,11 @@
} while(0)
/*
- * This magic number is used to prevent PXE restart when we
- * issue a software reset. We write this magic number to the
- * firmware mailbox at 0xB50 in order to prevent the PXE boot
- * code from running.
+ * This magic number is written to the firmware mailbox at 0xb50
+ * before a software reset is issued. After the internal firmware
+ * has completed its initialization it will write the opposite of
+ * this value, ~BGE_MAGIC_NUMBER, to the same location, allowing the
+ * driver to synchronize with the firmware.
*/
#define BGE_MAGIC_NUMBER 0x4B657654