[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v7 11/13] hw/arm: Wire up BMC boot flash for npcm750-evb and quan
From: |
Havard Skinnemoen |
Subject: |
[PATCH v7 11/13] hw/arm: Wire up BMC boot flash for npcm750-evb and quanta-gsj |
Date: |
Tue, 11 Aug 2020 00:46:05 +0000 |
This allows these NPCM7xx-based boards to boot from a flash image, e.g.
one built with OpenBMC. For example like this:
IMAGE=${OPENBMC}/build/tmp/deploy/images/gsj/image-bmc
qemu-system-arm -machine quanta-gsj -nographic \
-drive file=${IMAGE},if=mtd,bus=0,unit=0,format=raw,snapshot=on
Reviewed-by: Tyrone Ting <kfting@nuvoton.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Tested-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Havard Skinnemoen <hskinnemoen@google.com>
---
hw/arm/npcm7xx_boards.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c
index 26ea97072b..bd0b822907 100644
--- a/hw/arm/npcm7xx_boards.c
+++ b/hw/arm/npcm7xx_boards.c
@@ -19,6 +19,7 @@
#include "hw/arm/npcm7xx.h"
#include "hw/core/cpu.h"
#include "hw/loader.h"
+#include "hw/qdev-properties.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "qemu/units.h"
@@ -50,6 +51,22 @@ static void npcm7xx_load_bootrom(NPCM7xxState *soc)
}
}
+static void npcm7xx_connect_flash(NPCM7xxFIUState *fiu, int cs_no,
+ const char *flash_type, DriveInfo *dinfo)
+{
+ DeviceState *flash;
+ qemu_irq flash_cs;
+
+ flash = qdev_new(flash_type);
+ if (dinfo) {
+ qdev_prop_set_drive(flash, "drive", blk_by_legacy_dinfo(dinfo));
+ }
+ qdev_realize_and_unref(flash, BUS(fiu->spi), &error_fatal);
+
+ flash_cs = qdev_get_gpio_in_named(flash, SSI_GPIO_CS, 0);
+ qdev_connect_gpio_out_named(DEVICE(fiu), "cs", cs_no, flash_cs);
+}
+
static void npcm7xx_connect_dram(NPCM7xxState *soc, MemoryRegion *dram)
{
memory_region_add_subregion(get_system_memory(), NPCM7XX_DRAM_BA, dram);
@@ -87,6 +104,7 @@ static void npcm750_evb_init(MachineState *machine)
qdev_realize(DEVICE(soc), NULL, &error_fatal);
npcm7xx_load_bootrom(soc);
+ npcm7xx_connect_flash(&soc->fiu[0], 0, "w25q256", drive_get(IF_MTD, 0, 0));
npcm7xx_load_kernel(machine, soc);
}
@@ -99,6 +117,8 @@ static void quanta_gsj_init(MachineState *machine)
qdev_realize(DEVICE(soc), NULL, &error_fatal);
npcm7xx_load_bootrom(soc);
+ npcm7xx_connect_flash(&soc->fiu[0], 0, "mx25l25635e",
+ drive_get(IF_MTD, 0, 0));
npcm7xx_load_kernel(machine, soc);
}
--
2.28.0.236.gb10cc79966-goog
- Re: [PATCH v7 02/13] hw/misc: Add NPCM7xx Clock Controller device model, (continued)
- [PATCH v7 01/13] hw/misc: Add NPCM7xx System Global Control Registers device model, Havard Skinnemoen, 2020/08/10
- [PATCH v7 03/13] hw/timer: Add NPCM7xx Timer device model, Havard Skinnemoen, 2020/08/10
- [PATCH v7 04/13] hw/arm: Add NPCM730 and NPCM750 SoC models, Havard Skinnemoen, 2020/08/10
- [PATCH v7 06/13] roms: Add virtual Boot ROM for NPCM7xx SoCs, Havard Skinnemoen, 2020/08/10
- [PATCH v7 07/13] hw/arm: Load -bios image as a boot ROM for npcm7xx, Havard Skinnemoen, 2020/08/10
- [PATCH v7 05/13] hw/arm: Add two NPCM7xx-based machines, Havard Skinnemoen, 2020/08/10
- [PATCH v7 08/13] hw/nvram: NPCM7xx OTP device model, Havard Skinnemoen, 2020/08/10
- [PATCH v7 09/13] hw/mem: Stubbed out NPCM7xx Memory Controller model, Havard Skinnemoen, 2020/08/10
- [PATCH v7 11/13] hw/arm: Wire up BMC boot flash for npcm750-evb and quanta-gsj,
Havard Skinnemoen <=
- [PATCH v7 10/13] hw/ssi: NPCM7xx Flash Interface Unit device model, Havard Skinnemoen, 2020/08/10
- [PATCH v7 12/13] docs/system: Add Nuvoton machine documentation, Havard Skinnemoen, 2020/08/10
- [PATCH v7 13/13] tests/acceptance: console boot tests for quanta-gsj, Havard Skinnemoen, 2020/08/10
- Re: [PATCH v7 13/13] tests/acceptance: console boot tests for quanta-gsj, Philippe Mathieu-Daudé, 2020/08/11
- Re: [PATCH v7 13/13] tests/acceptance: console boot tests for quanta-gsj, Havard Skinnemoen, 2020/08/11
- Re: [PATCH v7 13/13] tests/acceptance: console boot tests for quanta-gsj, Havard Skinnemoen, 2020/08/19
- Re: [PATCH v7 13/13] tests/acceptance: console boot tests for quanta-gsj, Philippe Mathieu-Daudé, 2020/08/20
- Re: [PATCH v7 13/13] tests/acceptance: console boot tests for quanta-gsj, Philippe Mathieu-Daudé, 2020/08/20
- Re: [PATCH v7 13/13] tests/acceptance: console boot tests for quanta-gsj, Havard Skinnemoen, 2020/08/20
- Re: [PATCH v7 13/13] tests/acceptance: console boot tests for quanta-gsj, Philippe Mathieu-Daudé, 2020/08/20