Skip to content

Commit

Permalink
MIPS: JZ4770: Workaround for corrupted DMA transfers
Browse files Browse the repository at this point in the history
We have seen MMC DMA transfers read corrupted data from SDRAM when
a burst interval ends at physical address 0x10000000. To avoid this
problem, we remove the final page of low memory from the memory map.
  • Loading branch information
mthuurne committed May 4, 2014
1 parent ee48ba8 commit 69106c1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
22 changes: 22 additions & 0 deletions arch/mips/jz4770/setup.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <asm/reboot.h> #include <asm/reboot.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/time.h> #include <asm/time.h>
#include <asm/page.h>


#include <asm/mach-jz4770/jz4770cpm.h> #include <asm/mach-jz4770/jz4770cpm.h>
#include <asm/mach-jz4770/jz4770dmac.h> #include <asm/mach-jz4770/jz4770dmac.h>
Expand Down Expand Up @@ -190,3 +191,24 @@ void __init plat_mem_setup(void)
#endif #endif
} }


/*
* We have seen MMC DMA transfers read corrupted data from SDRAM when a burst
* interval ends at physical address 0x10000000. To avoid this problem, we
* remove the final page of low memory from the memory map.
*/
void __init jz4770_reserve_unsafe_for_dma(void)
{
int i;
for (i = 0; i < boot_mem_map.nr_map; i++) {
struct boot_mem_map_entry *entry = boot_mem_map.map + i;

if (entry->type != BOOT_MEM_RAM)
continue;

if (entry->addr + entry->size != 0x10000000)
continue;

entry->size -= PAGE_SIZE;
break;
}
}
7 changes: 7 additions & 0 deletions arch/mips/kernel/setup.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -640,6 +640,13 @@ static void __init arch_mem_init(char **cmdline_p)


parse_early_param(); parse_early_param();


#ifdef CONFIG_MACH_JZ4770
{
extern void __init jz4770_reserve_unsafe_for_dma(void);
jz4770_reserve_unsafe_for_dma();
}
#endif

if (usermem) { if (usermem) {
pr_info("User-defined physical RAM map:\n"); pr_info("User-defined physical RAM map:\n");
print_memory_map(); print_memory_map();
Expand Down

0 comments on commit 69106c1

Please sign in to comment.