2018-12-16 22:25:22 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
/*
|
|
|
|
* JZ4780 common routines
|
|
|
|
*
|
|
|
|
* Copyright (c) 2013 Imagination Technologies
|
|
|
|
* Author: Paul Burton <paul.burton@imgtec.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
#include <common.h>
|
2019-11-14 19:57:39 +00:00
|
|
|
#include <cpu_func.h>
|
2019-12-28 17:45:07 +00:00
|
|
|
#include <hang.h>
|
2020-05-10 17:40:01 +00:00
|
|
|
#include <image.h>
|
2019-11-14 19:57:45 +00:00
|
|
|
#include <init.h>
|
2020-10-31 03:38:53 +00:00
|
|
|
#include <asm/global_data.h>
|
2018-12-16 22:25:22 +00:00
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/sections.h>
|
|
|
|
#include <mach/jz4780.h>
|
|
|
|
#include <mach/jz4780_dram.h>
|
|
|
|
#include <mmc.h>
|
|
|
|
#include <spl.h>
|
|
|
|
|
|
|
|
#ifdef CONFIG_SPL_BUILD
|
|
|
|
/* Pointer to the global data structure for SPL */
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
2021-05-20 11:23:52 +00:00
|
|
|
gd_t gdata __section(".bss");
|
2018-12-16 22:25:22 +00:00
|
|
|
|
|
|
|
void board_init_f(ulong dummy)
|
|
|
|
{
|
|
|
|
typedef void __noreturn (*image_entry_noargs_t)(void);
|
|
|
|
struct mmc *mmc;
|
|
|
|
unsigned long count;
|
2022-09-07 02:26:52 +00:00
|
|
|
struct legacy_img_hdr *header;
|
2018-12-16 22:25:22 +00:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* Set global data pointer */
|
|
|
|
gd = &gdata;
|
|
|
|
|
|
|
|
timer_init();
|
|
|
|
pll_init();
|
|
|
|
sdram_init();
|
|
|
|
enable_caches();
|
|
|
|
|
|
|
|
/* Clear the BSS */
|
|
|
|
memset(__bss_start, 0, (char *)&__bss_end - __bss_start);
|
|
|
|
|
|
|
|
gd->flags |= GD_FLG_SPL_INIT;
|
|
|
|
|
|
|
|
ret = mmc_initialize(NULL);
|
|
|
|
if (ret)
|
|
|
|
hang();
|
|
|
|
|
|
|
|
mmc = find_mmc_device(BOOT_DEVICE_MMC1);
|
|
|
|
if (ret)
|
|
|
|
hang();
|
|
|
|
|
|
|
|
ret = mmc_init(mmc);
|
|
|
|
if (ret)
|
|
|
|
hang();
|
|
|
|
|
2022-10-21 00:22:39 +00:00
|
|
|
header = (struct legacy_img_hdr *)(CONFIG_TEXT_BASE -
|
2022-09-07 02:26:52 +00:00
|
|
|
sizeof(struct legacy_img_hdr));
|
2018-12-16 22:25:22 +00:00
|
|
|
|
|
|
|
count = blk_dread(mmc_get_blk_desc(mmc),
|
|
|
|
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR,
|
|
|
|
0x800, header);
|
|
|
|
if (count == 0)
|
|
|
|
hang();
|
|
|
|
|
|
|
|
image_entry_noargs_t image_entry =
|
2022-10-21 00:22:39 +00:00
|
|
|
(image_entry_noargs_t)CONFIG_TEXT_BASE;
|
2018-12-16 22:25:22 +00:00
|
|
|
|
|
|
|
image_entry();
|
|
|
|
|
|
|
|
hang();
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_SPL_BUILD */
|
|
|
|
|
2022-09-09 15:32:40 +00:00
|
|
|
phys_size_t board_get_usable_ram_top(phys_size_t total_size)
|
2018-12-16 22:25:22 +00:00
|
|
|
{
|
|
|
|
return CONFIG_SYS_SDRAM_BASE + (256 * 1024 * 1024);
|
|
|
|
}
|
|
|
|
|
|
|
|
int print_cpuinfo(void)
|
|
|
|
{
|
|
|
|
printf("CPU: Ingenic JZ4780\n");
|
|
|
|
return 0;
|
|
|
|
}
|