2018-06-14 23:38:32 +05:30
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
/*
|
2020-04-19 19:28:25 +05:30
|
|
|
* Actions Semi Owl SoCs platform support.
|
2018-06-14 23:38:32 +05:30
|
|
|
*
|
|
|
|
* Copyright (C) 2018 Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
|
|
|
*/
|
|
|
|
|
2019-12-28 10:45:01 -07:00
|
|
|
#include <cpu_func.h>
|
2020-05-10 11:40:02 -06:00
|
|
|
#include <init.h>
|
2020-05-10 11:39:56 -06:00
|
|
|
#include <asm/cache.h>
|
2020-10-30 21:38:53 -06:00
|
|
|
#include <asm/global_data.h>
|
2018-06-14 23:38:32 +05:30
|
|
|
#include <linux/arm-smccc.h>
|
|
|
|
#include <linux/psci.h>
|
|
|
|
#include <common.h>
|
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/mach-types.h>
|
|
|
|
#include <asm/psci.h>
|
|
|
|
|
2020-05-09 13:45:07 +05:30
|
|
|
#define DMM_INTERLEAVE_PER_CH_CFG 0xe0290028
|
|
|
|
|
2018-06-14 23:38:32 +05:30
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2020-05-09 13:45:07 +05:30
|
|
|
unsigned int owl_get_ddrcap(void)
|
|
|
|
{
|
|
|
|
unsigned int val, cap;
|
|
|
|
|
|
|
|
/* ddr capacity register initialized by ddr driver
|
|
|
|
* in early bootloader
|
|
|
|
*/
|
|
|
|
#if defined(CONFIG_MACH_S700)
|
|
|
|
val = (readl(DMM_INTERLEAVE_PER_CH_CFG) >> 8) & 0x7;
|
|
|
|
cap = (val + 1) * 256;
|
|
|
|
#elif defined(CONFIG_MACH_S900)
|
|
|
|
val = (readl(DMM_INTERLEAVE_PER_CH_CFG) >> 8) & 0xf;
|
|
|
|
cap = 64 * (1 << val);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return cap;
|
|
|
|
}
|
|
|
|
|
2018-06-14 23:38:32 +05:30
|
|
|
/*
|
|
|
|
* dram_init - sets uboots idea of sdram size
|
|
|
|
*/
|
|
|
|
int dram_init(void)
|
|
|
|
{
|
2020-05-09 13:45:07 +05:30
|
|
|
gd->ram_size = owl_get_ddrcap() * 1024 * 1024;
|
2018-06-14 23:38:32 +05:30
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This is called after dram_init() so use get_ram_size result */
|
|
|
|
int dram_init_banksize(void)
|
|
|
|
{
|
|
|
|
gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
|
|
|
|
gd->bd->bi_dram[0].size = gd->ram_size;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void show_psci_version(void)
|
|
|
|
{
|
|
|
|
struct arm_smccc_res res;
|
|
|
|
|
|
|
|
arm_smccc_smc(ARM_PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0, 0, 0, 0, 0, &res);
|
|
|
|
|
|
|
|
printf("PSCI: v%ld.%ld\n",
|
2020-04-19 19:28:25 +05:30
|
|
|
PSCI_VERSION_MAJOR(res.a0),
|
2018-06-14 23:38:32 +05:30
|
|
|
PSCI_VERSION_MINOR(res.a0));
|
|
|
|
}
|
|
|
|
|
|
|
|
int board_init(void)
|
|
|
|
{
|
|
|
|
show_psci_version();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-12-15 16:47:52 +01:00
|
|
|
void reset_cpu(void)
|
2018-06-14 23:38:32 +05:30
|
|
|
{
|
|
|
|
psci_system_reset();
|
|
|
|
}
|