u-boot-brain/arch/mips/mach-mtmips/spl.c
Weijie Gao 7a4b6964b5 mips: mtmips: add SPL support
This patch adds SPL support for mtmips platform. The lowlevel architecture
is split into SPL and the rest parts are built into a memory loadable
u-boot image. Optional SPL_DM and OF_CONTROL are also supported.

The increment of size is very small (< 10 KiB) if SPL_DM and OF_CONTROL are
not enabled and the memory bootable u-boot (u-boot.img) is generated
automatically so there is not need to add a separate config for it.

A lzma compressed payload (u-boot-lzma.img) is also generated and it will
be combined with u-boot-spl.bin to form the unified ROM bootable binary
u-boot-mtmips.bin.

A spl loader is added to support uncompress the payload.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2020-04-27 20:30:12 +02:00

45 lines
887 B
C

// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2020 MediaTek Inc. All Rights Reserved.
*
* Author: Weijie Gao <weijie.gao@mediatek.com>
*/
#include <common.h>
#include <fdt.h>
#include <spl.h>
#include <asm/sections.h>
#include <linux/sizes.h>
#include <mach/serial.h>
void __noreturn board_init_f(ulong dummy)
{
spl_init();
#ifdef CONFIG_SPL_SERIAL_SUPPORT
/*
* mtmips_spl_serial_init() is useful if debug uart is enabled,
* or DM based serial is not enabled.
*/
mtmips_spl_serial_init();
preloader_console_init();
#endif
board_init_r(NULL, 0);
}
void board_boot_order(u32 *spl_boot_list)
{
spl_boot_list[0] = BOOT_DEVICE_NOR;
}
unsigned long spl_nor_get_uboot_base(void)
{
void *uboot_base = __image_copy_end;
if (fdt_magic(uboot_base) == FDT_MAGIC)
return (unsigned long)uboot_base + fdt_totalsize(uboot_base);
return (unsigned long)uboot_base;
}