From e8c33242a59704aa01f83bdd6f3ba4b6978ff210 Mon Sep 17 00:00:00 2001 From: bz Date: Mon, 5 May 2008 18:42:17 +0000 Subject: Use a better approach to force the interrupt which should work for all cards/modes. In addition to the intr forcing added with rev. 1.205 adopt the other places to use the same logic. We need to exclude a few chips/revisions (5700, 5788) from using the enhanced version and fall back to the old way as that is the only method they support. Tested by: phk Suggested by: davidch, Broadcom (thanks a lot for the help!) MFC after: 16 days --- sys/dev/bge/if_bge.c | 27 +++++++++++++++++++++------ sys/dev/bge/if_bgereg.h | 4 ++++ 2 files changed, 25 insertions(+), 6 deletions(-) (limited to 'sys') diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c index b0a7412..daac893 100644 --- a/sys/dev/bge/if_bge.c +++ b/sys/dev/bge/if_bge.c @@ -2356,7 +2356,7 @@ bge_attach(device_t dev) { struct ifnet *ifp; struct bge_softc *sc; - uint32_t hwcfg = 0; + uint32_t hwcfg = 0, misccfg; u_char eaddr[ETHER_ADDR_LEN]; int error, reg, rid, trys; @@ -2446,6 +2446,16 @@ bge_attach(device_t dev) sc->bge_flags |= BGE_FLAG_BER_BUG; } + + /* + * We could possibly check for BCOM_DEVICEID_BCM5788 in bge_probe() + * but I do not know the DEVICEID for the 5788M. + */ + misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID; + if (misccfg == BGE_MISCCFG_BOARD_ID_5788 || + misccfg == BGE_MISCCFG_BOARD_ID_5788M) + sc->bge_flags |= BGE_FLAG_5788; + /* * Check if this is a PCI-X or PCI Express device. */ @@ -3410,7 +3420,11 @@ bge_tick(void *xsc) #endif { sc->bge_link_evt++; - BGE_SETBIT(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_INTR_SET); + if (sc->bge_asicrev == BGE_ASICREV_BCM5700 || + sc->bge_flags & BGE_FLAG_5788) + BGE_SETBIT(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_INTR_SET); + else + BGE_SETBIT(sc, BGE_HCC_MODE, BGE_HCCMODE_COAL_NOW); } } @@ -3950,10 +3964,11 @@ bge_ifmedia_upd_locked(struct ifnet *ifp) * need to do this here if BGE_FLAG_TBI is set but as * we poll for fiber anyway it should not harm. */ - BGE_SETBIT(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_INTR_SET); -#ifdef notyet - BGE_SETBIT(sc, BGE_HCC_MODE, BGE_HCCMODE_COAL_NOW); -#endif + if (sc->bge_asicrev == BGE_ASICREV_BCM5700 || + sc->bge_flags & BGE_FLAG_5788) + BGE_SETBIT(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_INTR_SET); + else + BGE_SETBIT(sc, BGE_HCC_MODE, BGE_HCCMODE_COAL_NOW); return (0); } diff --git a/sys/dev/bge/if_bgereg.h b/sys/dev/bge/if_bgereg.h index 01778d7..3a02ffd 100644 --- a/sys/dev/bge/if_bgereg.h +++ b/sys/dev/bge/if_bgereg.h @@ -1776,6 +1776,9 @@ /* Misc. config register */ #define BGE_MISCCFG_RESET_CORE_CLOCKS 0x00000001 #define BGE_MISCCFG_TIMER_PRESCALER 0x000000FE +#define BGE_MISCCFG_BOARD_ID 0x0001E000 +#define BGE_MISCCFG_BOARD_ID_5788 0x00010000 +#define BGE_MISCCFG_BOARD_ID_5788M 0x00018000 #define BGE_MISCCFG_EPHY_IDDQ 0x00200000 #define BGE_32BITTIME_66MHZ (0x41 << 1) @@ -2546,6 +2549,7 @@ struct bge_softc { #define BGE_FLAG_ADJUST_TRIM 0x04000000 #define BGE_FLAG_CRC_BUG 0x08000000 #define BGE_FLAG_NO_EEPROM 0x10000000 +#define BGE_FLAG_5788 0x20000000 uint32_t bge_chipid; uint8_t bge_asicrev; uint8_t bge_chiprev; -- cgit v1.1