diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2010-06-23 04:34:23 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-06-23 04:34:23 +0000 |
commit | 28bcc17ddef4cfad2d1a669869f2f81f0724acb9 (patch) | |
tree | 702fdc524fd56a4d1dac650047e3660671e7dae2 /firmware/target/arm/as3525/sd-as3525.c | |
parent | 2494afccc4d1e0dbd085c5b7ed5518815281b422 (diff) | |
download | rockbox-28bcc17ddef4cfad2d1a669869f2f81f0724acb9.tar.gz rockbox-28bcc17ddef4cfad2d1a669869f2f81f0724acb9.zip |
revert r27044 (which was a revert of r26953 & r26954)
The bug was in playback.c and was fixed in previous commit
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27074 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/as3525/sd-as3525.c')
-rw-r--r-- | firmware/target/arm/as3525/sd-as3525.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/firmware/target/arm/as3525/sd-as3525.c b/firmware/target/arm/as3525/sd-as3525.c index 7e61fa509f..423181ab7a 100644 --- a/firmware/target/arm/as3525/sd-as3525.c +++ b/firmware/target/arm/as3525/sd-as3525.c | |||
@@ -686,6 +686,7 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start, | |||
686 | #endif | 686 | #endif |
687 | int ret = 0; | 687 | int ret = 0; |
688 | unsigned loops = 0; | 688 | unsigned loops = 0; |
689 | bool aligned = !((uintptr_t)buf & (CACHEALIGN_SIZE - 1)); | ||
689 | 690 | ||
690 | mutex_lock(&sd_mtx); | 691 | mutex_lock(&sd_mtx); |
691 | sd_enable(true); | 692 | sd_enable(true); |
@@ -717,6 +718,14 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start, | |||
717 | 718 | ||
718 | dma_retain(); | 719 | dma_retain(); |
719 | 720 | ||
721 | if(aligned) | ||
722 | { | ||
723 | if(write) | ||
724 | clean_dcache_range(buf, count * SECTOR_SIZE); | ||
725 | else | ||
726 | dump_dcache_range(buf, count * SECTOR_SIZE); | ||
727 | } | ||
728 | |||
720 | while(count) | 729 | while(count) |
721 | { | 730 | { |
722 | /* 128 * 512 = 2^16, and doesn't fit in the 16 bits of DATA_LENGTH | 731 | /* 128 * 512 = 2^16, and doesn't fit in the 16 bits of DATA_LENGTH |
@@ -758,12 +767,19 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start, | |||
758 | if(!(card_info[drive].ocr & (1<<30))) /* not SDHC */ | 767 | if(!(card_info[drive].ocr & (1<<30))) /* not SDHC */ |
759 | bank_start *= SD_BLOCK_SIZE; | 768 | bank_start *= SD_BLOCK_SIZE; |
760 | 769 | ||
761 | dma_buf = aligned_buffer; | 770 | if(aligned) |
762 | if(transfer > UNALIGNED_NUM_SECTORS) | 771 | { |
763 | transfer = UNALIGNED_NUM_SECTORS; | 772 | dma_buf = AS3525_PHYSICAL_ADDR(buf); |
773 | } | ||
774 | else | ||
775 | { | ||
776 | dma_buf = aligned_buffer; | ||
777 | if(transfer > UNALIGNED_NUM_SECTORS) | ||
778 | transfer = UNALIGNED_NUM_SECTORS; | ||
764 | 779 | ||
765 | if(write) | 780 | if(write) |
766 | memcpy(uncached_buffer, buf, transfer * SD_BLOCK_SIZE); | 781 | memcpy(uncached_buffer, buf, transfer * SD_BLOCK_SIZE); |
782 | } | ||
767 | 783 | ||
768 | ret = sd_wait_for_tran_state(drive); | 784 | ret = sd_wait_for_tran_state(drive); |
769 | if (ret < 0) | 785 | if (ret < 0) |
@@ -822,7 +838,7 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start, | |||
822 | 838 | ||
823 | if(!transfer_error[drive]) | 839 | if(!transfer_error[drive]) |
824 | { | 840 | { |
825 | if(!write) | 841 | if(!write && !aligned) |
826 | memcpy(buf, uncached_buffer, transfer * SD_BLOCK_SIZE); | 842 | memcpy(buf, uncached_buffer, transfer * SD_BLOCK_SIZE); |
827 | buf += transfer * SD_BLOCK_SIZE; | 843 | buf += transfer * SD_BLOCK_SIZE; |
828 | start += transfer; | 844 | start += transfer; |