qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v9 11/14] hw/arm: Wire up BMC boot flash for npcm750-evb and


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v9 11/14] hw/arm: Wire up BMC boot flash for npcm750-evb and quanta-gsj
Date: Fri, 11 Sep 2020 14:46:27 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0


On 9/11/20 7:20 AM, Havard Skinnemoen via wrote:
> 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>
> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.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 b4c772d6b5..79e2e2744c 100644
> --- a/hw/arm/npcm7xx_boards.c
> +++ b/hw/arm/npcm7xx_boards.c
> @@ -20,6 +20,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"
> @@ -55,6 +56,22 @@ static void npcm7xx_load_bootrom(MachineState *machine, 
> 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);
> @@ -92,6 +109,7 @@ static void npcm750_evb_init(MachineState *machine)
>      qdev_realize(DEVICE(soc), NULL, &error_fatal);
>  
>      npcm7xx_load_bootrom(machine, soc);
> +    npcm7xx_connect_flash(&soc->fiu[0], 0, "w25q256", drive_get(IF_MTD, 0, 
> 0));

Nitpicking: add definition for '0' magic number
(consider as future cleanup).

>      npcm7xx_load_kernel(machine, soc);
>  }
>  
> @@ -104,6 +122,8 @@ static void quanta_gsj_init(MachineState *machine)
>      qdev_realize(DEVICE(soc), NULL, &error_fatal);
>  
>      npcm7xx_load_bootrom(machine, soc);
> +    npcm7xx_connect_flash(&soc->fiu[0], 0, "mx25l25635e",
> +                          drive_get(IF_MTD, 0, 0));

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

>      npcm7xx_load_kernel(machine, soc);
>  }
>  
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]