[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180110232045.GX27409@jhogan-linux.mipstec.com>
Date: Wed, 10 Jan 2018 23:20:45 +0000
From: James Hogan <james.hogan@...s.com>
To: Paul Cercueil <paul@...pouillou.net>
CC: Ralf Baechle <ralf@...ux-mips.org>,
Maarten ter Huurne <maarten@...ewalker.org>,
Paul Burton <paul.burton@...s.com>,
<linux-kernel@...r.kernel.org>, <linux-mips@...ux-mips.org>
Subject: Re: [PATCH v6 13/15] MIPS: JZ4770: Workaround for corrupted DMA
transfers
On Fri, Jan 05, 2018 at 07:25:11PM +0100, Paul Cercueil wrote:
> From: Maarten ter Huurne <maarten@...ewalker.org>
>
> 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.
>
> Signed-off-by: Maarten ter Huurne <maarten@...ewalker.org>
> ---
> arch/mips/jz4740/setup.c | 24 ++++++++++++++++++++++++
> arch/mips/kernel/setup.c | 8 ++++++++
> 2 files changed, 32 insertions(+)
>
> v2: No change
> v3: No change
> v4: No change
> v5: No change
> v6: No change
>
> diff --git a/arch/mips/jz4740/setup.c b/arch/mips/jz4740/setup.c
> index cd89536fbba1..18c57c4bf47e 100644
> --- a/arch/mips/jz4740/setup.c
> +++ b/arch/mips/jz4740/setup.c
> @@ -22,6 +22,7 @@
> #include <linux/of_fdt.h>
>
> #include <asm/bootinfo.h>
> +#include <asm/page.h>
> #include <asm/prom.h>
>
> #include <asm/mach-jz4740/base.h>
> @@ -103,3 +104,26 @@ void __init arch_init_irq(void)
> {
> irqchip_init();
> }
> +
> +/*
> + * 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;
> + }
> +}
> diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
> index 85bc601e9a0d..5a2c20145aee 100644
> --- a/arch/mips/kernel/setup.c
> +++ b/arch/mips/kernel/setup.c
> @@ -879,6 +879,14 @@ static void __init arch_mem_init(char **cmdline_p)
>
> parse_early_param();
>
> +#ifdef CONFIG_MACH_JZ4770
> + if (current_cpu_type() == CPU_JZRISC &&
> + mips_machtype == MACH_INGENIC_JZ4770) {
> + extern void __init jz4770_reserve_unsafe_for_dma(void);
> + jz4770_reserve_unsafe_for_dma();
> + }
> +#endif
Hmm, a little bit ugly. I'm guessing the plat_mem_setup() callback is
too early since mem= parameters won't have been taken into account yet
from parse_early_param().
Is /memreserve/ in FDT of any value here or is it all too late due to
old DTs?
Cheers
James
> +
> if (usermem) {
> pr_info("User-defined physical RAM map:\n");
> print_memory_map();
> --
> 2.11.0
>
>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists