diff --git a/core/embed/trezorhal/stm32f4/sdcard.c b/core/embed/trezorhal/stm32f4/sdcard.c index 75d46a9a81..443737abe6 100644 --- a/core/embed/trezorhal/stm32f4/sdcard.c +++ b/core/embed/trezorhal/stm32f4/sdcard.c @@ -298,9 +298,6 @@ secbool sdcard_read_blocks(uint32_t *dest, uint32_t block_num, HAL_StatusTypeDef err = HAL_OK; - // we must disable USB irqs to prevent MSC contention with SD card - uint32_t basepri = raise_irq_pri(IRQ_PRI_OTG_FS); - sd_dma.Instance = DMA2_Stream3; sd_dma.State = HAL_DMA_STATE_RESET; sd_dma.Init.Channel = DMA_CHANNEL_4; @@ -340,8 +337,6 @@ secbool sdcard_read_blocks(uint32_t *dest, uint32_t block_num, HAL_DMA_DeInit(&sd_dma); sd_handle.hdmarx = NULL; - restore_irq_pri(basepri); - return sectrue * (err == HAL_OK); } @@ -359,9 +354,6 @@ secbool sdcard_write_blocks(const uint32_t *src, uint32_t block_num, HAL_StatusTypeDef err = HAL_OK; - // we must disable USB irqs to prevent MSC contention with SD card - uint32_t basepri = raise_irq_pri(IRQ_PRI_OTG_FS); - sd_dma.Instance = DMA2_Stream3; sd_dma.State = HAL_DMA_STATE_RESET; sd_dma.Init.Channel = DMA_CHANNEL_4; @@ -401,7 +393,5 @@ secbool sdcard_write_blocks(const uint32_t *src, uint32_t block_num, HAL_DMA_DeInit(&sd_dma); sd_handle.hdmatx = NULL; - restore_irq_pri(basepri); - return sectrue * (err == HAL_OK); } diff --git a/core/embed/trezorhal/stm32u5/sdcard.c b/core/embed/trezorhal/stm32u5/sdcard.c index 1f8d22c57e..c54e7ebaf1 100644 --- a/core/embed/trezorhal/stm32u5/sdcard.c +++ b/core/embed/trezorhal/stm32u5/sdcard.c @@ -301,16 +301,12 @@ secbool sdcard_read_blocks(uint32_t *dest, uint32_t block_num, HAL_StatusTypeDef err = HAL_OK; - // we must disable USB irqs to prevent MSC contention with SD card - uint32_t basepri = raise_irq_pri(IRQ_PRI_OTG_FS); - sdcard_reset_periph(); err = HAL_SD_ReadBlocks_DMA(&sd_handle, (uint8_t *)dest, block_num, num_blocks); if (err == HAL_OK) { err = sdcard_wait_finished(&sd_handle, 5000); } - restore_irq_pri(basepri); return sectrue * (err == HAL_OK); } @@ -329,9 +325,6 @@ secbool sdcard_write_blocks(const uint32_t *src, uint32_t block_num, HAL_StatusTypeDef err = HAL_OK; - // we must disable USB irqs to prevent MSC contention with SD card - uint32_t basepri = raise_irq_pri(IRQ_PRI_OTG_FS); - sdcard_reset_periph(); err = HAL_SD_WriteBlocks_DMA(&sd_handle, (uint8_t *)src, block_num, num_blocks); @@ -339,7 +332,5 @@ secbool sdcard_write_blocks(const uint32_t *src, uint32_t block_num, err = sdcard_wait_finished(&sd_handle, 5000); } - restore_irq_pri(basepri); - return sectrue * (err == HAL_OK); }