Skip to content
Permalink
Browse files

MIPS: JZ4770: Workaround for corrupted DMA transfers

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 69106c17a401ed897a71b1cd6f5d60d7ea3a6c13
Showing with 29 additions and 0 deletions.
  1. +22 −0 arch/mips/jz4770/setup.c
  2. +7 −0 arch/mips/kernel/setup.c
@@ -40,6 +40,7 @@
#include <asm/reboot.h>
#include <asm/pgtable.h>
#include <asm/time.h>
#include <asm/page.h>

#include <asm/mach-jz4770/jz4770cpm.h>
#include <asm/mach-jz4770/jz4770dmac.h>
@@ -190,3 +191,24 @@ void __init plat_mem_setup(void)
#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;
}
}
@@ -640,6 +640,13 @@ static void __init arch_mem_init(char **cmdline_p)

parse_early_param();

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

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

0 comments on commit 69106c1

Please sign in to comment.
You can’t perform that action at this time.