> Date: Tue, 25 Feb 2014 06:05:02 +0900
> From: SASANO Takayoshi <[email protected]>
> 
> Hello,
> 
> I am trying OpenBSD-current/i386 on 86duino EduCake.
> It uses DM&P Vortex86EX SoC and its azalia fails to find ALC262 codec.
> 
> The diagnostic message says "RIRB is not running"
> (at azalia_get_response()), and I found Vortex86EX's azalia takes 2~4
> DELAY(1)s to start RIRB DMA engine.
> 
> (Vortex86EX's CORB DMA did not required any delay. It starts immediately.)
> 
> Here is the patch to add delay.

Thanks, here is a slightly reworked diff that does the wait in a way
that's more in line with other bits of azalia(4) that wait for a bit
in a register to go on or off.

Index: azalia.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/azalia.c,v
retrieving revision 1.209
diff -u -p -r1.209 azalia.c
--- azalia.c    30 Dec 2013 10:53:30 -0000      1.209
+++ azalia.c    25 Feb 2014 16:06:22 -0000
@@ -1110,7 +1110,7 @@ azalia_halt_rirb(azalia_t *az)
 int
 azalia_init_rirb(azalia_t *az, int resuming)
 {
-       int err;
+       int err, i;
        uint16_t rirbwp;
        uint8_t rirbctl;
 
@@ -1161,6 +1161,16 @@ azalia_init_rirb(azalia_t *az, int resum
        rirbctl = AZ_READ_1(az, RIRBCTL);
        AZ_WRITE_1(az, RIRBCTL, rirbctl |
            HDA_RIRBCTL_RIRBDMAEN | HDA_RIRBCTL_RINTCTL);
+       for (i = 5000; i >= 0; i--) {
+               DELAY(10);
+               rirbctl = AZ_READ_1(az, RIRBCTL);
+               if (rirbctl & HDA_RIRBCTL_RIRBDMAEN)
+                       break;
+       }
+       if (i <= 0) {
+               DPRINTF(("%s: RIRB is not running\n", XNAME(az)));
+               return(EBUSY);
+       }
 
        return (0);
 }

Reply via email to