[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 04/13] hw/arm/collie: Simplify flash creation using for() loop
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 04/13] hw/arm/collie: Simplify flash creation using for() loop |
Date: |
Mon, 9 Jan 2023 12:53:07 +0100 |
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/arm/collie.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/hw/arm/collie.c b/hw/arm/collie.c
index d59c376e60..9edff59370 100644
--- a/hw/arm/collie.c
+++ b/hw/arm/collie.c
@@ -40,7 +40,6 @@ static struct arm_boot_info collie_binfo = {
static void collie_init(MachineState *machine)
{
- DriveInfo *dinfo;
MachineClass *mc = MACHINE_GET_CLASS(machine);
CollieMachineState *cms = COLLIE_MACHINE(machine);
@@ -55,15 +54,13 @@ static void collie_init(MachineState *machine)
memory_region_add_subregion(get_system_memory(), SA_SDCS0, machine->ram);
- dinfo = drive_get(IF_PFLASH, 0, 0);
- pflash_cfi01_register(SA_CS0, "collie.fl1", FLASH_SIZE,
- dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
- FLASH_SECTOR_SIZE, 4, 0x00, 0x00, 0x00, 0x00, 0);
-
- dinfo = drive_get(IF_PFLASH, 0, 1);
- pflash_cfi01_register(SA_CS1, "collie.fl2", FLASH_SIZE,
- dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
- FLASH_SECTOR_SIZE, 4, 0x00, 0x00, 0x00, 0x00, 0);
+ for (unsigned i = 0; i < 2; i++) {
+ DriveInfo *dinfo = drive_get(IF_PFLASH, 0, i);
+ pflash_cfi01_register(i ? SA_CS1 : SA_CS0,
+ i ? "collie.fl2" : "collie.fl1", FLASH_SIZE,
+ dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
+ FLASH_SECTOR_SIZE, 4, 0x00, 0x00, 0x00, 0x00, 0);
+ }
sysbus_create_simple("scoop", 0x40800000, NULL);
--
2.38.1
- [PATCH 00/13] hw/arm: Cleanups before pflash refactor, Philippe Mathieu-Daudé, 2023/01/09
- [PATCH 01/13] hw/arm/pxa2xx: Simplify pxa255_init(), Philippe Mathieu-Daudé, 2023/01/09
- [PATCH 02/13] hw/arm/pxa2xx: Simplify pxa270_init(), Philippe Mathieu-Daudé, 2023/01/09
- [PATCH 03/13] hw/arm/collie: Use the IEC binary prefix definitions, Philippe Mathieu-Daudé, 2023/01/09
- [PATCH 04/13] hw/arm/collie: Simplify flash creation using for() loop,
Philippe Mathieu-Daudé <=
- [PATCH 06/13] hw/arm/gumstix: Use the IEC binary prefix definitions, Philippe Mathieu-Daudé, 2023/01/09
- [PATCH 05/13] hw/arm/gumstix: Improve documentation, Philippe Mathieu-Daudé, 2023/01/09
- [PATCH 07/13] hw/arm/mainstone: Use the IEC binary prefix definitions, Philippe Mathieu-Daudé, 2023/01/09
- [PATCH 08/13] hw/arm/musicpal: Use the IEC binary prefix definitions, Philippe Mathieu-Daudé, 2023/01/09
- [PATCH 09/13] hw/arm/omap_sx1: Remove unused 'total_ram' definitions, Philippe Mathieu-Daudé, 2023/01/09
- [PATCH 10/13] hw/arm/omap_sx1: Use the IEC binary prefix definitions, Philippe Mathieu-Daudé, 2023/01/09
- [PATCH 11/13] hw/arm/z2: Use the IEC binary prefix definitions, Philippe Mathieu-Daudé, 2023/01/09
- [PATCH 12/13] hw/arm/vexpress: Remove dead code in vexpress_common_init(), Philippe Mathieu-Daudé, 2023/01/09
- [PATCH 13/13] hw/arm: Remove unreachable code calling pflash_cfi01_register(), Philippe Mathieu-Daudé, 2023/01/09
- Re: [PATCH 00/13] hw/arm: Cleanups before pflash refactor, Richard Henderson, 2023/01/09