mirror of https://github.com/xemu-project/xemu.git
aspeed/smc: set the number of flash modules for the FMC controller
Add a new configuration field at the board level and propagate the value using the "num-cs" property of the FMC controller model. Signed-off-by: Cédric Le Goater <clg@kaod.org> Message-id: 1480434248-27138-14-git-send-email-clg@kaod.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
0584d3c33f
commit
26d5df9578
|
@ -36,6 +36,7 @@ typedef struct AspeedBoardConfig {
|
||||||
uint32_t hw_strap1;
|
uint32_t hw_strap1;
|
||||||
const char *fmc_model;
|
const char *fmc_model;
|
||||||
const char *spi_model;
|
const char *spi_model;
|
||||||
|
uint32_t num_cs;
|
||||||
} AspeedBoardConfig;
|
} AspeedBoardConfig;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -85,18 +86,21 @@ static const AspeedBoardConfig aspeed_boards[] = {
|
||||||
.hw_strap1 = PALMETTO_BMC_HW_STRAP1,
|
.hw_strap1 = PALMETTO_BMC_HW_STRAP1,
|
||||||
.fmc_model = "n25q256a",
|
.fmc_model = "n25q256a",
|
||||||
.spi_model = "mx25l25635e",
|
.spi_model = "mx25l25635e",
|
||||||
|
.num_cs = 1,
|
||||||
},
|
},
|
||||||
[AST2500_EVB] = {
|
[AST2500_EVB] = {
|
||||||
.soc_name = "ast2500-a1",
|
.soc_name = "ast2500-a1",
|
||||||
.hw_strap1 = AST2500_EVB_HW_STRAP1,
|
.hw_strap1 = AST2500_EVB_HW_STRAP1,
|
||||||
.fmc_model = "n25q256a",
|
.fmc_model = "n25q256a",
|
||||||
.spi_model = "mx25l25635e",
|
.spi_model = "mx25l25635e",
|
||||||
|
.num_cs = 1,
|
||||||
},
|
},
|
||||||
[ROMULUS_BMC] = {
|
[ROMULUS_BMC] = {
|
||||||
.soc_name = "ast2500-a1",
|
.soc_name = "ast2500-a1",
|
||||||
.hw_strap1 = ROMULUS_BMC_HW_STRAP1,
|
.hw_strap1 = ROMULUS_BMC_HW_STRAP1,
|
||||||
.fmc_model = "n25q256a",
|
.fmc_model = "n25q256a",
|
||||||
.spi_model = "mx66l1g45g",
|
.spi_model = "mx66l1g45g",
|
||||||
|
.num_cs = 2,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -143,6 +147,8 @@ static void aspeed_board_init(MachineState *machine,
|
||||||
&error_abort);
|
&error_abort);
|
||||||
object_property_set_int(OBJECT(&bmc->soc), cfg->hw_strap1, "hw-strap1",
|
object_property_set_int(OBJECT(&bmc->soc), cfg->hw_strap1, "hw-strap1",
|
||||||
&error_abort);
|
&error_abort);
|
||||||
|
object_property_set_int(OBJECT(&bmc->soc), cfg->num_cs, "num-cs",
|
||||||
|
&error_abort);
|
||||||
object_property_set_bool(OBJECT(&bmc->soc), true, "realized",
|
object_property_set_bool(OBJECT(&bmc->soc), true, "realized",
|
||||||
&error_abort);
|
&error_abort);
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,8 @@ static void aspeed_soc_init(Object *obj)
|
||||||
object_initialize(&s->fmc, sizeof(s->fmc), sc->info->fmc_typename);
|
object_initialize(&s->fmc, sizeof(s->fmc), sc->info->fmc_typename);
|
||||||
object_property_add_child(obj, "fmc", OBJECT(&s->fmc), NULL);
|
object_property_add_child(obj, "fmc", OBJECT(&s->fmc), NULL);
|
||||||
qdev_set_parent_bus(DEVICE(&s->fmc), sysbus_get_default());
|
qdev_set_parent_bus(DEVICE(&s->fmc), sysbus_get_default());
|
||||||
|
object_property_add_alias(obj, "num-cs", OBJECT(&s->fmc), "num-cs",
|
||||||
|
&error_abort);
|
||||||
|
|
||||||
for (i = 0; i < sc->info->spis_num; i++) {
|
for (i = 0; i < sc->info->spis_num; i++) {
|
||||||
object_initialize(&s->spi[i], sizeof(s->spi[i]),
|
object_initialize(&s->spi[i], sizeof(s->spi[i]),
|
||||||
|
@ -250,10 +252,8 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
|
||||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c), 0,
|
sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c), 0,
|
||||||
qdev_get_gpio_in(DEVICE(&s->vic), 12));
|
qdev_get_gpio_in(DEVICE(&s->vic), 12));
|
||||||
|
|
||||||
/* FMC */
|
/* FMC, The number of CS is set at the board level */
|
||||||
object_property_set_int(OBJECT(&s->fmc), 1, "num-cs", &err);
|
object_property_set_bool(OBJECT(&s->fmc), true, "realized", &err);
|
||||||
object_property_set_bool(OBJECT(&s->fmc), true, "realized", &local_err);
|
|
||||||
error_propagate(&err, local_err);
|
|
||||||
if (err) {
|
if (err) {
|
||||||
error_propagate(errp, err);
|
error_propagate(errp, err);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue