[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/15] aspeed: Introduce a AspeedSoCClass 'boot_from_emmc' handler
From: |
Cédric Le Goater |
Subject: |
[PULL 05/15] aspeed: Introduce a AspeedSoCClass 'boot_from_emmc' handler |
Date: |
Sun, 21 Jul 2024 10:13:51 +0200 |
From: Cédric Le Goater <clg@kaod.org>
Report support on the AST2600 SoC if the boot-from-eMMC HW strapping
bit is set at the board level. AST2700 also has support but it is not
yet ready in QEMU and others SoCs do not have support, so return false
always for these.
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Tested-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/arm/aspeed_soc.h | 1 +
hw/arm/aspeed_ast2600.c | 8 ++++++++
hw/arm/aspeed_soc_common.c | 7 +++++++
3 files changed, 16 insertions(+)
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
index 849ba37f9524..624d489e0d63 100644
--- a/include/hw/arm/aspeed_soc.h
+++ b/include/hw/arm/aspeed_soc.h
@@ -164,6 +164,7 @@ struct AspeedSoCClass {
const hwaddr *memmap;
uint32_t num_cpus;
qemu_irq (*get_irq)(AspeedSoCState *s, int dev);
+ bool (*boot_from_emmc)(AspeedSoCState *s);
};
const char *aspeed_soc_cpu_type(AspeedSoCClass *sc);
diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c
index 31713de74a5f..be3eb70cdd77 100644
--- a/hw/arm/aspeed_ast2600.c
+++ b/hw/arm/aspeed_ast2600.c
@@ -646,6 +646,13 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev,
Error **errp)
}
}
+static bool aspeed_soc_ast2600_boot_from_emmc(AspeedSoCState *s)
+{
+ uint32_t hw_strap1 = object_property_get_uint(OBJECT(&s->scu),
+ "hw-strap1", &error_abort);
+ return !!(hw_strap1 & SCU_AST2600_HW_STRAP_BOOT_SRC_EMMC);
+}
+
static void aspeed_soc_ast2600_class_init(ObjectClass *oc, void *data)
{
static const char * const valid_cpu_types[] = {
@@ -673,6 +680,7 @@ static void aspeed_soc_ast2600_class_init(ObjectClass *oc,
void *data)
sc->memmap = aspeed_soc_ast2600_memmap;
sc->num_cpus = 2;
sc->get_irq = aspeed_soc_ast2600_get_irq;
+ sc->boot_from_emmc = aspeed_soc_ast2600_boot_from_emmc;
}
static const TypeInfo aspeed_soc_ast2600_types[] = {
diff --git a/hw/arm/aspeed_soc_common.c b/hw/arm/aspeed_soc_common.c
index 1e8f2558fdc2..05551461aea0 100644
--- a/hw/arm/aspeed_soc_common.c
+++ b/hw/arm/aspeed_soc_common.c
@@ -134,6 +134,11 @@ static void aspeed_soc_realize(DeviceState *dev, Error
**errp)
}
}
+static bool aspeed_soc_boot_from_emmc(AspeedSoCState *s)
+{
+ return false;
+}
+
static Property aspeed_soc_properties[] = {
DEFINE_PROP_LINK("dram", AspeedSoCState, dram_mr, TYPE_MEMORY_REGION,
MemoryRegion *),
@@ -145,9 +150,11 @@ static Property aspeed_soc_properties[] = {
static void aspeed_soc_class_init(ObjectClass *oc, void *data)
{
DeviceClass *dc = DEVICE_CLASS(oc);
+ AspeedSoCClass *sc = ASPEED_SOC_CLASS(oc);
dc->realize = aspeed_soc_realize;
device_class_set_props(dc, aspeed_soc_properties);
+ sc->boot_from_emmc = aspeed_soc_boot_from_emmc;
}
static const TypeInfo aspeed_soc_types[] = {
--
2.45.2
- [PULL 00/15] aspeed queue, Cédric Le Goater, 2024/07/21
- [PULL 02/15] aspeed: Change type of eMMC device, Cédric Le Goater, 2024/07/21
- [PULL 06/15] aspeed: Tune eMMC device properties to reflect HW strapping, Cédric Le Goater, 2024/07/21
- [PULL 03/15] aspeed: Load eMMC first boot area as a boot rom, Cédric Le Goater, 2024/07/21
- [PULL 01/15] aspeed/smc: Fix possible integer overflow, Cédric Le Goater, 2024/07/21
- [PULL 04/15] aspeed/scu: Add boot-from-eMMC HW strapping bit for AST2600 SoC, Cédric Le Goater, 2024/07/21
- [PULL 05/15] aspeed: Introduce a AspeedSoCClass 'boot_from_emmc' handler,
Cédric Le Goater <=
- [PULL 07/15] aspeed: Add boot-from-eMMC HW strapping bit to rainier-bmc machine, Cédric Le Goater, 2024/07/21
- [PULL 09/15] aspeed: Introduce a 'boot-emmc' machine option, Cédric Le Goater, 2024/07/21
- [PULL 08/15] aspeed: Introduce a 'hw_strap1' machine attribute, Cédric Le Goater, 2024/07/21
- [PULL 11/15] aspeed/adc: Add AST2700 support, Cédric Le Goater, 2024/07/21
- [PULL 10/15] tests/avocado/machine_aspeed.py: Add eMMC boot tests, Cédric Le Goater, 2024/07/21
- [PULL 12/15] aspeed/soc: support ADC for AST2700, Cédric Le Goater, 2024/07/21
- [PULL 15/15] aspeed: fix coding style, Cédric Le Goater, 2024/07/21
- [PULL 14/15] hw/i2c/aspeed: rename the I2C class pool attribute to share_pool, Cédric Le Goater, 2024/07/21
- [PULL 13/15] hw/i2c/aspeed: support to set the different memory size, Cédric Le Goater, 2024/07/21
- Re: [PULL 00/15] aspeed queue, Richard Henderson, 2024/07/22