diff options
| author | jmcneill <jmcneill@NetBSD.org> | 2017-11-24 00:30:29 +0000 |
|---|---|---|
| committer | jmcneill <jmcneill@NetBSD.org> | 2017-11-24 00:30:29 +0000 |
| commit | 3935fef168425b651ea82e0f4708814c0ceede73 (patch) | |
| tree | 900d0a88303c1c31c9e5466f0dcb57cbbaf4d7f1 /sys/dev/hdaudio | |
| parent | 4a0cebaa2d8e05c273dbfc3dbf6f277654ce6fa9 (diff) | |
Enter link reset even if GCTL says we are already in reset state. Fixes
hdaudio codec detection under VirtualBox on a "cold" boot.
XXX pullup
Diffstat (limited to 'sys/dev/hdaudio')
| -rw-r--r-- | sys/dev/hdaudio/hdaudio.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/sys/dev/hdaudio/hdaudio.c b/sys/dev/hdaudio/hdaudio.c index cf29554487a..6811fe427e2 100644 --- a/sys/dev/hdaudio/hdaudio.c +++ b/sys/dev/hdaudio/hdaudio.c @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudio.c,v 1.5 2017/06/04 23:34:55 pgoyette Exp $ */ +/* $NetBSD: hdaudio.c,v 1.6 2017/11/24 00:30:29 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk> @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.5 2017/06/04 23:34:55 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.6 2017/11/24 00:30:29 jmcneill Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -612,21 +612,21 @@ hdaudio_reset(struct hdaudio_softc *sc) hda_write1(sc, HDAUDIO_MMIO_RIRBSTS, hda_read1(sc, HDAUDIO_MMIO_RIRBSTS)); - /* If the controller isn't in reset state, initiate the transition */ + /* Put the controller into reset state */ gctl = hda_read4(sc, HDAUDIO_MMIO_GCTL); - if (gctl & HDAUDIO_GCTL_CRST) { - gctl &= ~HDAUDIO_GCTL_CRST; - hda_write4(sc, HDAUDIO_MMIO_GCTL, gctl); - do { - hda_delay(10); - gctl = hda_read4(sc, HDAUDIO_MMIO_GCTL); - } while (--retry > 0 && (gctl & HDAUDIO_GCTL_CRST) != 0); - if (retry == 0) { - hda_error(sc, "timeout entering reset state\n"); - return ETIME; - } + gctl &= ~HDAUDIO_GCTL_CRST; + hda_write4(sc, HDAUDIO_MMIO_GCTL, gctl); + do { + hda_delay(10); + gctl = hda_read4(sc, HDAUDIO_MMIO_GCTL); + } while (--retry > 0 && (gctl & HDAUDIO_GCTL_CRST) != 0); + if (retry == 0) { + hda_error(sc, "timeout entering reset state\n"); + return ETIME; } + hda_delay(1000); + /* Now the controller is in reset state, so bring it out */ retry = HDAUDIO_RESET_TIMEOUT; hda_write4(sc, HDAUDIO_MMIO_GCTL, gctl | HDAUDIO_GCTL_CRST); @@ -639,6 +639,8 @@ hdaudio_reset(struct hdaudio_softc *sc) return ETIME; } + hda_delay(2000); + /* Accept unsolicited responses */ hda_write4(sc, HDAUDIO_MMIO_GCTL, gctl | HDAUDIO_GCTL_UNSOL_EN); |
