diff mbox series

[v1,8/8] aspeed: Support create flash devices via command line for AST1030

Message ID 20241029091729.3317512-9-jamin_lin@aspeedtech.com (mailing list archive)
State New
Headers show
Series Support RTC for AST2700 | expand

Commit Message

Jamin Lin Oct. 29, 2024, 9:17 a.m. UTC
Add a "if-statement" in aspeed_minibmc_machine_init function. If users add
"-nodefaults" in command line, the flash devices should be created by users
setting. Otherwise, the flash devices are created at machine init.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 hw/arm/aspeed.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

Comments

Cédric Le Goater Nov. 2, 2024, 3:02 p.m. UTC | #1
On 10/29/24 10:17, Jamin Lin wrote:
> Add a "if-statement" in aspeed_minibmc_machine_init function. If users add
> "-nodefaults" in command line, the flash devices should be created by users
> setting. Otherwise, the flash devices are created at machine init.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>



Reviewed-by: Cédric Le Goater <clg@redhat.com>

Thanks,

C.

> ---
>   hw/arm/aspeed.c | 22 ++++++++++++----------
>   1 file changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
> index 0468602d95..e161e6b1c5 100644
> --- a/hw/arm/aspeed.c
> +++ b/hw/arm/aspeed.c
> @@ -1602,18 +1602,20 @@ static void aspeed_minibmc_machine_init(MachineState *machine)
>       connect_serial_hds_to_uarts(bmc);
>       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);
> +    if (defaults_enabled()) {
> +        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[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));
> +        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);
diff mbox series

Patch

diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 0468602d95..e161e6b1c5 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -1602,18 +1602,20 @@  static void aspeed_minibmc_machine_init(MachineState *machine)
     connect_serial_hds_to_uarts(bmc);
     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);
+    if (defaults_enabled()) {
+        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[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));
+        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);