Files
opensbi/platform/kendryte/k210/platform.c
Atish Patra 88b173b33b Introduce hart disabled parameter in platform.
As of now, uboot doesn't have support for SMP.
Moreover, unleashed board has a E51 hart which
doesn't not support S mode.

We should only boot only 1 non-zero hart.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
2018-12-21 22:11:21 -08:00

110 lines
2.2 KiB
C

/*
* Copyright (c) 2018 Western Digital Corporation or its affiliates.
*
* Authors:
* Anup Patel <anup.patel@wdc.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <sbi/riscv_encoding.h>
#include <sbi/sbi_const.h>
#include <sbi/sbi_platform.h>
#include <sbi/sbi_console.h>
#include <plat/irqchip/plic.h>
#include <plat/sys/clint.h>
#include "platform.h"
#include "uarths.h"
#define K210_UART_BAUDRATE 115200
int k210_console_init(void)
{
uarths_init(K210_UART_BAUDRATE, UARTHS_STOP_1);
return 0;
}
void k210_console_putc(char c)
{
uarths_putc(c);
}
static char k210_console_getc(void)
{
return uarths_getc();
}
static int k210_cold_irqchip_init(void)
{
return plic_cold_irqchip_init(PLIC_BASE_ADDR, PLIC_NUM_SOURCES,
PLAT_HART_COUNT);
}
static int k210_warm_irqchip_init(u32 core_id)
{
return plic_warm_irqchip_init(core_id,
(2 * core_id),
(2 * core_id + 1));
}
static int k210_cold_ipi_init(void)
{
return clint_cold_ipi_init(CLINT_BASE_ADDR, PLAT_HART_COUNT);
}
static int k210_cold_timer_init(void)
{
return clint_cold_timer_init(CLINT_BASE_ADDR, PLAT_HART_COUNT);
}
static int k210_system_reboot(u32 type)
{
/* For now nothing to do. */
sbi_printf("System reboot\n");
return 0;
}
static int k210_system_shutdown(u32 type)
{
/* For now nothing to do. */
sbi_printf("System shutdown\n");
return 0;
}
struct sbi_platform platform = {
.name = STRINGIFY(PLAT_NAME),
.features = SBI_PLATFORM_HAS_MMIO_TIMER_VALUE,
.hart_count = PLAT_HART_COUNT,
.hart_stack_size = PLAT_HART_STACK_SIZE,
.disabled_hart_mask = 0,
.console_init = k210_console_init,
.console_putc = k210_console_putc,
.console_getc = k210_console_getc,
.cold_irqchip_init = k210_cold_irqchip_init,
.warm_irqchip_init = k210_warm_irqchip_init,
.cold_ipi_init = k210_cold_ipi_init,
.warm_ipi_init = clint_warm_ipi_init,
.ipi_inject = clint_ipi_inject,
.ipi_sync = clint_ipi_sync,
.ipi_clear = clint_ipi_clear,
.cold_timer_init = k210_cold_timer_init,
.timer_value = clint_timer_value,
.timer_event_stop = clint_timer_event_stop,
.timer_event_start = clint_timer_event_start,
.warm_timer_init = clint_warm_timer_init,
.cold_final_init = NULL,
.system_reboot = k210_system_reboot,
.system_shutdown = k210_system_shutdown
};