andrzej-kaczmarek commented on a change in pull request #2392:
URL: https://github.com/apache/mynewt-core/pull/2392#discussion_r508342638



##########
File path: hw/drivers/crypto/crypto_da1469x/src/crypto_da1469x.c
##########
@@ -73,7 +74,10 @@ do_dma_key_tx(const void *key, uint16_t keylen)
     da1469x_otp_set_mode(OTPC_MODE_READ);
 
     /* securely DMA hardware key from secret storage to QSPI decrypt engine */
-    dma_regs->DMA_REQ_MUX_REG |= 0xf000;
+    OS_ENTER_CRITICAL(sr);
+    /* Use the secure channel #7 */
+    MCU_DMA_SET_MUX(7, MCU_DMA_PERIPH_NONE);

Review comment:
       we should not acquire once since DMA controller resides in PD_SYS which 
means you need to keep PD_SYS always enabled so M33 is not powered off during 
deep sleep. and this brings us to two issues here:
   - DMA should keep PD_SYS up once at least channel is acquired 
(https://github.com/apache/mynewt-core/pull/2394) as otherwise all DMA 
configuration is gone after deep sleep
   - crpyto driver should also acquire PD_SYS since it resited in the same 
power domain (similar to what e.g. GPADC driver does)
   
   all that also means existing code should always use acquire/release helper 
to reserve DMA channel and if we want to have PD_SYS disabled in deep sleep, 
any code that uses DMA and/or crypto driver would need to 
open/close/acquire/release/configure/whatever channel and/or dev only when 
needed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to