diff options
author | andrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-05-28 00:29:31 +0000 |
---|---|---|
committer | andrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-05-28 00:29:31 +0000 |
commit | d744b79c0f308f6b7720be89068e64a5d09789ec (patch) | |
tree | 9e2b1022175b6974c7c4ed3fda8fd21854e0780b /Omap35xxPkg | |
parent | 9e04898b6dc4e108291380f061f755fade1eaa60 (diff) | |
download | edk2-d744b79c0f308f6b7720be89068e64a5d09789ec.tar.gz edk2-d744b79c0f308f6b7720be89068e64a5d09789ec.tar.bz2 edk2-d744b79c0f308f6b7720be89068e64a5d09789ec.zip |
Add a little more code for SD Card DMA, but make sure it is turned off until it is debugged.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10546 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Omap35xxPkg')
-rw-r--r-- | Omap35xxPkg/MMCHSDxe/MMCHS.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/Omap35xxPkg/MMCHSDxe/MMCHS.c b/Omap35xxPkg/MMCHSDxe/MMCHS.c index 54e24d9825..ccfaf5c699 100644 --- a/Omap35xxPkg/MMCHSDxe/MMCHS.c +++ b/Omap35xxPkg/MMCHSDxe/MMCHS.c @@ -748,6 +748,8 @@ DmaBlocks ( EFI_PHYSICAL_ADDRESS BufferAddress; OMAP_DMA4 Dma4; DMA_MAP_OPERATION DmaOperation; + EFI_STATUS MmcStatus; + UINTN RetryCount = 0; CpuDeadLoop (); // Map passed in buffer for DMA xfer @@ -834,9 +836,42 @@ CpuDeadLoop (); return Status; } + //Check for the Transfer completion. + while (RetryCount < MAX_RETRY_COUNT) { + //Read Status + do { + MmcStatus = MmioRead32 (MMCHS_STAT); + } while (MmcStatus == 0); + + //Check if Transfer complete (TC) bit is set? + if (MmcStatus & TC) { + break; + } else { + DEBUG ((EFI_D_ERROR, "MmcStatus for TC: %x\n", MmcStatus)); + //Check if DEB, DCRC or DTO interrupt occured. + if ((MmcStatus & DEB) | (MmcStatus & DCRC) | (MmcStatus & DTO)) { + //There was an error during the data transfer. + + //Set SRD bit to 1 and wait until it return to 0x0. + MmioOr32 (MMCHS_SYSCTL, SRD); + while((MmioRead32 (MMCHS_SYSCTL) & SRD) != 0x0); + + DisableDmaChannel (2, DMA4_CSR_BLOCK, DMA4_CSR_ERR); + DmaUnmap (BufferMap); + return EFI_DEVICE_ERROR; + } + } + RetryCount++; + } + DisableDmaChannel (2, DMA4_CSR_BLOCK, DMA4_CSR_ERR); Status = DmaUnmap (BufferMap); + if (RetryCount == MAX_RETRY_COUNT) { + DEBUG ((EFI_D_ERROR, "TransferBlockData timed out.\n")); + return EFI_TIMEOUT; + } + return Status; } @@ -1121,7 +1156,8 @@ SdReadWrite ( goto DoneRestoreTPL; } - //BytesToBeTranferedThisPass = (BytesToBeTranferedThisPass >= MAX_MMCHS_TRANSFER_SIZE) ? MAX_MMCHS_TRANSFER_SIZE : BytesRemainingToBeTransfered; + // Turn OFF DMA path until it is debugged + // BytesToBeTranferedThisPass = (BytesToBeTranferedThisPass >= MAX_MMCHS_TRANSFER_SIZE) ? MAX_MMCHS_TRANSFER_SIZE : BytesRemainingToBeTransfered; BytesToBeTranferedThisPass = This->Media->BlockSize; BlockCount = BytesToBeTranferedThisPass/This->Media->BlockSize; |