blob: e697f9b8baaf43baf7f2a69340c35eab1203795e [file] [log] [blame]
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (c) Aspeed Technology Inc.
*/
#include <asm/io.h>
#include <asm/arch/sli.h>
#include <dm.h>
#include <ram.h>
#include <spl.h>
DECLARE_GLOBAL_DATA_PTR;
int dram_init(void)
{
int ret;
struct udevice *dev;
struct ram_info ram;
ret = uclass_get_device(UCLASS_RAM, 0, &dev);
if (ret) {
printf("cannot get DRAM driver\n");
return ret;
}
ret = ram_get_info(dev, &ram);
if (ret) {
printf("cannot get DRAM information\n");
return ret;
}
gd->ram_size = ram.size;
return 0;
}
int spl_board_init_f(void)
{
sli_init();
dram_init();
return 0;
}
struct legacy_img_hdr *spl_get_load_buffer(ssize_t offset, size_t size)
{
return (struct legacy_img_hdr *)CONFIG_SYS_LOAD_ADDR;
}
void *board_spl_fit_buffer_addr(ulong fit_size, int sectors, int bl_len)
{
return (void *)spl_get_load_buffer(sectors, bl_len);
}
u32 spl_boot_device(void)
{
return BOOT_DEVICE_RAM;
}
int board_init(void)
{
struct udevice *dev;
int i = 0;
int ret;
/*
* Loop over all MISC uclass drivers to call the comphy code
* and init all CP110 devices enabled in the DT
*/
while (1) {
/* Call the comphy code via the MISC uclass driver */
ret = uclass_get_device(UCLASS_MISC, i++, &dev);
/* We're done, once no further CP110 device is found */
if (ret)
break;
}
return 0;
}
int board_late_init(void)
{
return 0;
}