mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-30 13:31:52 -06:00
aspeed: Add an AST1030 eval board
The image should be supplied with ELF binary. $ qemu-system-arm -M ast1030-evb -kernel zephyr.elf -nographic Signed-off-by: Troy Lee <troy_lee@aspeedtech.com> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com> Signed-off-by: Steven Lee <steven_lee@aspeedtech.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> Message-Id: <20220401083850.15266-9-jamin_lin@aspeedtech.com> Signed-off-by: Cédric Le Goater <clg@kaod.org>
This commit is contained in:
parent
356b230ed1
commit
66c895b8af
1 changed files with 66 additions and 0 deletions
|
@ -24,6 +24,7 @@
|
||||||
#include "hw/loader.h"
|
#include "hw/loader.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
|
#include "hw/qdev-clock.h"
|
||||||
|
|
||||||
static struct arm_boot_info aspeed_board_binfo = {
|
static struct arm_boot_info aspeed_board_binfo = {
|
||||||
.board_id = -1, /* device-tree-only board */
|
.board_id = -1, /* device-tree-only board */
|
||||||
|
@ -1292,6 +1293,67 @@ static void aspeed_machine_bletchley_class_init(ObjectClass *oc, void *data)
|
||||||
aspeed_soc_num_cpus(amc->soc_name);
|
aspeed_soc_num_cpus(amc->soc_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define AST1030_INTERNAL_FLASH_SIZE (1024 * 1024)
|
||||||
|
/* Main SYSCLK frequency in Hz (200MHz) */
|
||||||
|
#define SYSCLK_FRQ 200000000ULL
|
||||||
|
|
||||||
|
static void aspeed_minibmc_machine_init(MachineState *machine)
|
||||||
|
{
|
||||||
|
AspeedMachineState *bmc = ASPEED_MACHINE(machine);
|
||||||
|
AspeedMachineClass *amc = ASPEED_MACHINE_GET_CLASS(machine);
|
||||||
|
Clock *sysclk;
|
||||||
|
|
||||||
|
sysclk = clock_new(OBJECT(machine), "SYSCLK");
|
||||||
|
clock_set_hz(sysclk, SYSCLK_FRQ);
|
||||||
|
|
||||||
|
object_initialize_child(OBJECT(machine), "soc", &bmc->soc, amc->soc_name);
|
||||||
|
qdev_connect_clock_in(DEVICE(&bmc->soc), "sysclk", sysclk);
|
||||||
|
|
||||||
|
qdev_prop_set_uint32(DEVICE(&bmc->soc), "uart-default",
|
||||||
|
amc->uart_default);
|
||||||
|
qdev_realize(DEVICE(&bmc->soc), NULL, &error_abort);
|
||||||
|
|
||||||
|
aspeed_board_init_flashes(&bmc->soc.fmc,
|
||||||
|
bmc->fmc_model ? bmc->fmc_model : amc->fmc_model,
|
||||||
|
amc->num_cs,
|
||||||
|
0);
|
||||||
|
|
||||||
|
aspeed_board_init_flashes(&bmc->soc.spi[0],
|
||||||
|
bmc->spi_model ? bmc->spi_model : amc->spi_model,
|
||||||
|
amc->num_cs, amc->num_cs);
|
||||||
|
|
||||||
|
aspeed_board_init_flashes(&bmc->soc.spi[1],
|
||||||
|
bmc->spi_model ? bmc->spi_model : amc->spi_model,
|
||||||
|
amc->num_cs, (amc->num_cs * 2));
|
||||||
|
|
||||||
|
if (amc->i2c_init) {
|
||||||
|
amc->i2c_init(bmc);
|
||||||
|
}
|
||||||
|
|
||||||
|
armv7m_load_kernel(ARM_CPU(first_cpu),
|
||||||
|
machine->kernel_filename,
|
||||||
|
AST1030_INTERNAL_FLASH_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void aspeed_minibmc_machine_ast1030_evb_class_init(ObjectClass *oc,
|
||||||
|
void *data)
|
||||||
|
{
|
||||||
|
MachineClass *mc = MACHINE_CLASS(oc);
|
||||||
|
AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
|
||||||
|
|
||||||
|
mc->desc = "Aspeed AST1030 MiniBMC (Cortex-M4)";
|
||||||
|
amc->soc_name = "ast1030-a1";
|
||||||
|
amc->hw_strap1 = 0;
|
||||||
|
amc->hw_strap2 = 0;
|
||||||
|
mc->init = aspeed_minibmc_machine_init;
|
||||||
|
mc->default_ram_size = 0;
|
||||||
|
mc->default_cpus = mc->min_cpus = mc->max_cpus = 1;
|
||||||
|
amc->fmc_model = "sst25vf032b";
|
||||||
|
amc->spi_model = "sst25vf032b";
|
||||||
|
amc->num_cs = 2;
|
||||||
|
amc->macs_mask = 0;
|
||||||
|
}
|
||||||
|
|
||||||
static const TypeInfo aspeed_machine_types[] = {
|
static const TypeInfo aspeed_machine_types[] = {
|
||||||
{
|
{
|
||||||
.name = MACHINE_TYPE_NAME("palmetto-bmc"),
|
.name = MACHINE_TYPE_NAME("palmetto-bmc"),
|
||||||
|
@ -1349,6 +1411,10 @@ static const TypeInfo aspeed_machine_types[] = {
|
||||||
.name = MACHINE_TYPE_NAME("bletchley-bmc"),
|
.name = MACHINE_TYPE_NAME("bletchley-bmc"),
|
||||||
.parent = TYPE_ASPEED_MACHINE,
|
.parent = TYPE_ASPEED_MACHINE,
|
||||||
.class_init = aspeed_machine_bletchley_class_init,
|
.class_init = aspeed_machine_bletchley_class_init,
|
||||||
|
}, {
|
||||||
|
.name = MACHINE_TYPE_NAME("ast1030-evb"),
|
||||||
|
.parent = TYPE_ASPEED_MACHINE,
|
||||||
|
.class_init = aspeed_minibmc_machine_ast1030_evb_class_init,
|
||||||
}, {
|
}, {
|
||||||
.name = TYPE_ASPEED_MACHINE,
|
.name = TYPE_ASPEED_MACHINE,
|
||||||
.parent = TYPE_MACHINE,
|
.parent = TYPE_MACHINE,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue