diff --git a/sys/dev/alc/if_alc.c b/sys/dev/alc/if_alc.c index 255fea53acfa..eb906d60bcbe 100644 --- a/sys/dev/alc/if_alc.c +++ b/sys/dev/alc/if_alc.c @@ -1438,6 +1438,8 @@ alc_attach(device_t dev) case DEVICEID_ATHEROS_AR8151: case DEVICEID_ATHEROS_AR8151_V2: sc->alc_flags |= ALC_FLAG_APS; + if (CSR_READ_4(sc, ALC_MT_MAGIC) == MT_MAGIC) + sc->alc_flags |= ALC_FLAG_MT; /* FALLTHROUGH */ default: break; @@ -1977,6 +1979,8 @@ alc_dma_alloc(struct alc_softc *sc) int error, i; lowaddr = BUS_SPACE_MAXADDR; + if (sc->alc_flags & ALC_FLAG_MT) + lowaddr = BUS_SPACE_MAXSIZE_32BIT; again: /* Create parent DMA tag. */ error = bus_dma_tag_create( @@ -2219,7 +2223,7 @@ alc_dma_alloc(struct alc_softc *sc) error = bus_dma_tag_create( bus_get_dma_tag(sc->alc_dev), /* parent */ 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ + lowaddr, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ @@ -3339,6 +3343,11 @@ alc_intr(void *arg) sc = (struct alc_softc *)arg; + if (sc->alc_flags & ALC_FLAG_MT) { + taskqueue_enqueue(sc->alc_tq, &sc->alc_int_task); + return (FILTER_HANDLED); + } + status = CSR_READ_4(sc, ALC_INTR_STATUS); if ((status & ALC_INTRS) == 0) return (FILTER_STRAY); @@ -3416,7 +3425,10 @@ alc_int_task(void *arg, int pending) done: if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { /* Re-enable interrupts if we're running. */ - CSR_WRITE_4(sc, ALC_INTR_STATUS, 0x7FFFFFFF); + if (sc->alc_flags & ALC_FLAG_MT) + CSR_WRITE_4(sc, ALC_INTR_STATUS, 0); + else + CSR_WRITE_4(sc, ALC_INTR_STATUS, 0x7FFFFFFF); } ALC_UNLOCK(sc); } diff --git a/sys/dev/alc/if_alcreg.h b/sys/dev/alc/if_alcreg.h index 3b4ee133b01a..7668f0960d9f 100644 --- a/sys/dev/alc/if_alcreg.h +++ b/sys/dev/alc/if_alcreg.h @@ -1121,6 +1121,14 @@ #define MII_EXT_ANEG_NLP78 0x8027 #define ANEG_NLP78_120M_DEFAULT 0x8A05 +#define ALC_MT_MAGIC 0x1F00 +#define ALC_MT_MODE 0x1F04 +#define ALC_MT_SPEED 0x1F08 +#define ALC_MT_VERSION 0x1F0C + +#define MT_MAGIC 0xaabb1234 +#define MT_MODE_4Q BIT(0) + /* Statistics counters collected by the MAC. */ struct smb { /* Rx stats. */ diff --git a/sys/dev/alc/if_alcvar.h b/sys/dev/alc/if_alcvar.h index 8dea20196dae..926c80021858 100644 --- a/sys/dev/alc/if_alcvar.h +++ b/sys/dev/alc/if_alcvar.h @@ -239,6 +239,7 @@ struct alc_softc { #define ALC_FLAG_LINK_WAR 0x4000 #define ALC_FLAG_E2X00 0x8000 #define ALC_FLAG_LINK 0x10000 +#define ALC_FLAG_MT 0x20000 struct callout alc_tick_ch; struct alc_hw_stats alc_stats; @@ -284,6 +285,6 @@ do { \ #define ALC_TX_TIMEOUT 5 #define ALC_RESET_TIMEOUT 100 #define ALC_TIMEOUT 1000 -#define ALC_PHY_TIMEOUT 1000 +#define ALC_PHY_TIMEOUT 10000 #endif /* _IF_ALCVAR_H */