On interrupt handler, save the actual data read from mbox. The previous

macro wasn't needed and was being used with swapped arguments which always
give the same result (0) defeating the overflow check.

On initialization, do not use bcm_mbox_intr() to read the pending messages,
with the new semaphore based implementation this will lead to semaphore
being incremented on the channels that contain pending data and will make
the first read for that channel return stale data.

This fixes the hang that happens on boot while initializing the cpufreq on
Raspberry Pi.
This commit is contained in:
Luiz Otavio O Souza 2014-12-27 13:52:33 +00:00
parent e9faba9d70
commit 1432fa20f3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=276297

View File

@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$");
mtx_unlock(&(sc)->lock); \
} while(0)
#undef DEBUG
#ifdef DEBUG
#define dprintf(fmt, args...) printf(fmt, ##args)
#else
@ -116,7 +117,7 @@ bcm_mbox_intr(void *arg)
continue;
}
dprintf("bcm_mbox_intr: chan %d, data %08x\n", chan, data);
sc->msg[chan] = MBOX_MSG(data, 0xf);
sc->msg[chan] = msg;
sema_post(&sc->sema[chan]);
}
}
@ -174,7 +175,8 @@ bcm_mbox_attach(device_t dev)
}
/* Read all pending messages */
bcm_mbox_intr(sc);
while ((mbox_read_4(sc, REG_STATUS) & STATUS_EMPTY) == 0)
(void)mbox_read_4(sc, REG_READ);
mbox_write_4(sc, REG_CONFIG, CONFIG_DATA_IRQ);