diff options
Diffstat (limited to 'firmware/target/arm/imx233')
-rw-r--r-- | firmware/target/arm/imx233/sdmmc-imx233.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/firmware/target/arm/imx233/sdmmc-imx233.c b/firmware/target/arm/imx233/sdmmc-imx233.c index e42842d3f7..f552246245 100644 --- a/firmware/target/arm/imx233/sdmmc-imx233.c +++ b/firmware/target/arm/imx233/sdmmc-imx233.c | |||
@@ -648,14 +648,15 @@ static int transfer_sectors(int drive, unsigned long start, int count, void *buf | |||
648 | * Read transfers: | 648 | * Read transfers: |
649 | * If the buffer is already aligned, transfer everything at once. | 649 | * If the buffer is already aligned, transfer everything at once. |
650 | * Otherwise, transfer all sectors but one to the sub-buffer starting | 650 | * Otherwise, transfer all sectors but one to the sub-buffer starting |
651 | * on the next cache ligned and then move the data. Then transfer the | 651 | * on the next cache line and then move the data. Then transfer the |
652 | * last sector to the aligned_buffer and then copy to the buffer. | 652 | * last sector to the aligned_buffer and then copy to the buffer. |
653 | * | 653 | * |
654 | * Write transfers: | 654 | * Write transfers: |
655 | * If the buffer is already aligned, transfer everything at once. | 655 | * If the buffer is already aligned, transfer everything at once. |
656 | * Otherwise, copy the first sector to the aligned_buffer and transfer. | 656 | * Otherwise, copy the first sector to the aligned_buffer and transfer. |
657 | * Then move all other sectors within the buffer to make it cache | 657 | * Then move all other sectors within the buffer to make it cache |
658 | * aligned and transfer it. | 658 | * aligned and transfer it. Then move data to pretend the buffer was |
659 | * never modified. | ||
659 | */ | 660 | */ |
660 | if(read) | 661 | if(read) |
661 | { | 662 | { |
@@ -689,6 +690,9 @@ static int transfer_sectors(int drive, unsigned long start, int count, void *buf | |||
689 | // move within the buffer and transfer | 690 | // move within the buffer and transfer |
690 | memmove(ptr, buf + 512, 512 * (count - 1)); | 691 | memmove(ptr, buf + 512, 512 * (count - 1)); |
691 | ret = __xfer_sectors(drive, start + 1, count - 1, ptr, read); | 692 | ret = __xfer_sectors(drive, start + 1, count - 1, ptr, read); |
693 | // move back | ||
694 | memmove(buf + 512, ptr, 512 * (count - 1)); | ||
695 | memcpy(buf, aligned_buffer[drive], 512); | ||
692 | } | 696 | } |
693 | } | 697 | } |
694 | else | 698 | else |