drivers: entropy: nrf5: add docs and a DSB in get_entropy_isr

Add a DSB before doing WFE in get_entropy_isr, to ensure
the memory transactions are complete.

Add a note clarifying a dependency for the existing solution
(dependency is satisfied by ARCH code but is good to state
clearly).

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit is contained in:
Ioannis Glaropoulos 2020-06-11 18:07:32 +02:00 committed by Carles Cufí
commit f1264b7e47

View file

@ -290,6 +290,15 @@ static int entropy_nrf5_get_entropy_isr(struct device *dev, uint8_t *buf, uint16
while (!nrf_rng_event_check(NRF_RNG,
NRF_RNG_EVENT_VALRDY)) {
/*
* To guarantee waking up from the event, the
* SEV-On-Pend feature must be enabled (enabled
* during ARCH initialization).
*
* DSB is recommended by spec before WFE (to
* guarantee completion of memory transactions)
*/
__DSB();
__WFE();
__SEV();
__WFE();