summaryrefslogtreecommitdiff
path: root/firmware/target/arm/imx31/ata-imx31.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/imx31/ata-imx31.c')
-rw-r--r--firmware/target/arm/imx31/ata-imx31.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/firmware/target/arm/imx31/ata-imx31.c b/firmware/target/arm/imx31/ata-imx31.c
index d539282e70..8a40c924ff 100644
--- a/firmware/target/arm/imx31/ata-imx31.c
+++ b/firmware/target/arm/imx31/ata-imx31.c
@@ -246,7 +246,7 @@ static const struct ata_udma_timings
246 246
247/** Threading **/ 247/** Threading **/
248/* Signal to tell thread when DMA is done */ 248/* Signal to tell thread when DMA is done */
249static struct wakeup ata_dma_wakeup; 249static struct semaphore ata_dma_complete;
250 250
251/** SDMA **/ 251/** SDMA **/
252/* Array of buffer descriptors for large transfers and alignnment */ 252/* Array of buffer descriptors for large transfers and alignnment */
@@ -445,7 +445,7 @@ static void ata_dma_callback(void)
445 ATA_INTERRUPT_CLEAR = ATA_INTERRUPT_PENDING; 445 ATA_INTERRUPT_CLEAR = ATA_INTERRUPT_PENDING;
446 446
447 ata_set_intrq(false); /* Return INTRQ to MCU */ 447 ata_set_intrq(false); /* Return INTRQ to MCU */
448 wakeup_signal(&ata_dma_wakeup); /* Signal waiting thread */ 448 semaphore_release(&ata_dma_complete); /* Signal waiting thread */
449} 449}
450 450
451bool ata_dma_setup(void *addr, unsigned long bytes, bool write) 451bool ata_dma_setup(void *addr, unsigned long bytes, bool write)
@@ -580,7 +580,8 @@ bool ata_dma_finish(void)
580 { 580 {
581 int oldirq; 581 int oldirq;
582 582
583 if (LIKELY(wakeup_wait(&ata_dma_wakeup, HZ/2) == OBJ_WAIT_SUCCEEDED)) 583 if (LIKELY(semaphore_wait(&ata_dma_complete, HZ/2)
584 == OBJ_WAIT_SUCCEEDED))
584 break; 585 break;
585 586
586 ata_keep_active(); 587 ata_keep_active();
@@ -594,7 +595,8 @@ bool ata_dma_finish(void)
594 sdma_channel_stop(channel); /* Stop DMA */ 595 sdma_channel_stop(channel); /* Stop DMA */
595 restore_irq(oldirq); 596 restore_irq(oldirq);
596 597
597 if (wakeup_wait(&ata_dma_wakeup, TIMEOUT_NOBLOCK) == OBJ_WAIT_SUCCEEDED) 598 if (semaphore_wait(&ata_dma_complete, TIMEOUT_NOBLOCK)
599 == OBJ_WAIT_SUCCEEDED)
598 break; /* DMA really did finish after timeout */ 600 break; /* DMA really did finish after timeout */
599 601
600 sdma_channel_reset(channel); /* Reset everything + clear error */ 602 sdma_channel_reset(channel); /* Reset everything + clear error */
@@ -716,7 +718,7 @@ void ata_device_init(void)
716 ata_dma_selected = ATA_DMA_PIO; 718 ata_dma_selected = ATA_DMA_PIO;
717 719
718 /* Called for first time at startup */ 720 /* Called for first time at startup */
719 wakeup_init(&ata_dma_wakeup); 721 semaphore_init(&ata_dma_complete, 1, 0);
720 722
721 if (!sdma_channel_init(ATA_DMA_CH_NUM_RD, &ata_cd_rd, ata_bda) || 723 if (!sdma_channel_init(ATA_DMA_CH_NUM_RD, &ata_cd_rd, ata_bda) ||
722 !sdma_channel_init(ATA_DMA_CH_NUM_WR, &ata_cd_wr, ata_bda)) 724 !sdma_channel_init(ATA_DMA_CH_NUM_WR, &ata_cd_wr, ata_bda))