u-boot-brain/arch/mips/mach-mtmips/cpu.c
Weijie Gao 02cd449f0b mips: mtmips: rewrite lowlevel codes of mt7628
This patch rewrites the mtmips architecture with the following changes:

1. Move MT7628 soc parts into a subfolder.
2. Lock parts of D-Cache as temporary stack.
3. Reimplement DDR initialization in C language.
4. Reimplement DDR calibration in a clear logic.
5. Add full support for auto size detection for DDR1 and DDR2.
6. Use accurate CPU clock depending on the input xtal frequency for timer
   and delay functions.

Note:

print_cpuinfo() has incompatible parts with MT7620 so it's moved into
mt7628 subfolder.

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2020-04-27 20:29:33 +02:00

47 lines
995 B
C

// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2018 Stefan Roese <sr@denx.de>
*/
#include <common.h>
#include <malloc.h>
#include <linux/io.h>
#include <linux/sizes.h>
DECLARE_GLOBAL_DATA_PTR;
int dram_init(void)
{
#ifdef CONFIG_SKIP_LOWLEVEL_INIT
gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE, SZ_256M);
#endif
return 0;
}
int last_stage_init(void)
{
void *src, *dst;
src = malloc(SZ_64K);
dst = malloc(SZ_64K);
if (!src || !dst) {
printf("Can't allocate buffer for cache cleanup copy!\n");
return 0;
}
/*
* It has been noticed, that sometimes the d-cache is not in a
* "clean-state" when U-Boot is running on MT7688. This was
* detected when using the ethernet driver (which uses d-cache)
* and a TFTP command does not complete. Copying an area of 64KiB
* in DDR at a very late bootup time in U-Boot, directly before
* calling into the prompt, seems to fix this issue.
*/
memcpy(dst, src, SZ_64K);
free(src);
free(dst);
return 0;
}