From 4f0794ff9616bbb5989e007ae79bb5cad7c1f8ea Mon Sep 17 00:00:00 2001 From: "Bjoern A. Zeeb" Date: Mon, 5 May 2008 18:42:17 +0000 Subject: [PATCH] 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(-) diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c index b0a7412a0dc0..daac89354357 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 01778d7d097a..3a02ffdac586 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;