From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Alistair Francis" <alistair@alistair23.me>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Laurent Vivier" <laurent@vivier.eu>,
qemu-arm@nongnu.org, qemu-ppc@nongnu.org,
"Antony Pavlov" <antonynpavlov@gmail.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"David Gibson" <david@gibson.dropbear.id.au>
Subject: [PATCH-for-6.1 04/10] hw/arm/digic: Open-code pflash_cfi02_register() call
Date: Fri, 26 Mar 2021 01:27:22 +0100 [thread overview]
Message-ID: <20210326002728.1069834-5-f4bug@amsat.org> (raw)
In-Reply-To: <20210326002728.1069834-1-f4bug@amsat.org>
To be able to manually map the flash region on the main memory
(in the next commit), first expand the pflash_cfi02_register
in place.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/arm/digic_boards.c | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c
index 6cdc1d83fca..fc4a671b2e1 100644
--- a/hw/arm/digic_boards.c
+++ b/hw/arm/digic_boards.c
@@ -31,6 +31,8 @@
#include "hw/boards.h"
#include "exec/address-spaces.h"
#include "qemu/error-report.h"
+#include "hw/qdev-properties.h"
+#include "hw/misc/aliased_region.h"
#include "hw/arm/digic.h"
#include "hw/block/flash.h"
#include "hw/loader.h"
@@ -120,12 +122,25 @@ static void digic4_add_k8p3215uqb_rom(DigicState *s, hwaddr addr,
#define FLASH_K8P3215UQB_SIZE (4 * 1024 * 1024)
#define FLASH_K8P3215UQB_SECTOR_SIZE (64 * 1024)
- pflash_cfi02_register(addr, "pflash", FLASH_K8P3215UQB_SIZE,
- NULL, FLASH_K8P3215UQB_SECTOR_SIZE,
- DIGIC4_ROM_MAX_SIZE / FLASH_K8P3215UQB_SIZE,
- 4,
- 0x00EC, 0x007E, 0x0003, 0x0001,
- 0x0555, 0x2aa, 0);
+ DeviceState *dev = qdev_new(TYPE_PFLASH_CFI02);
+
+ qdev_prop_set_uint32(dev, "num-blocks",
+ FLASH_K8P3215UQB_SIZE / FLASH_K8P3215UQB_SECTOR_SIZE);
+ qdev_prop_set_uint32(dev, "sector-length", FLASH_K8P3215UQB_SECTOR_SIZE);
+ qdev_prop_set_uint8(dev, "width", 4); /* 32-bit */
+ qdev_prop_set_uint8(dev, "mappings",
+ DIGIC4_ROM_MAX_SIZE / FLASH_K8P3215UQB_SIZE);
+ qdev_prop_set_uint8(dev, "big-endian", 0);
+ qdev_prop_set_uint16(dev, "id0", 0x00ec);
+ qdev_prop_set_uint16(dev, "id1", 0x007e);
+ qdev_prop_set_uint16(dev, "id2", 0x0003);
+ qdev_prop_set_uint16(dev, "id3", 0x0001);
+ qdev_prop_set_uint16(dev, "unlock-addr0", 0x0555);
+ qdev_prop_set_uint16(dev, "unlock-addr1", 0x2aa);
+ qdev_prop_set_string(dev, "name", "pflash");
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
+
+ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, addr);
digic_load_rom(s, addr, FLASH_K8P3215UQB_SIZE, filename);
}
--
2.26.2
next prev parent reply other threads:[~2021-03-26 0:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-26 0:27 [RFC PATCH-for-6.1 00/10] hw/misc: Add memory_region_add_subregion_aliased() helper Philippe Mathieu-Daudé
2021-03-26 0:27 ` [RFC PATCH-for-6.1 01/10] hw/misc: Add device to help managing aliased memory regions Philippe Mathieu-Daudé
2021-03-26 0:27 ` [PATCH-for-6.1 02/10] hw/arm/musicpal: Open-code pflash_cfi02_register() call Philippe Mathieu-Daudé
2021-03-26 0:27 ` [RFC PATCH-for-6.1 03/10] hw/arm/musicpal: Map flash using memory_region_add_subregion_aliased() Philippe Mathieu-Daudé
2021-03-26 22:49 ` Philippe Mathieu-Daudé
2021-03-26 0:27 ` Philippe Mathieu-Daudé [this message]
2021-03-26 0:27 ` [RFC PATCH-for-6.1 05/10] hw/arm/digic: " Philippe Mathieu-Daudé
2021-03-26 0:27 ` [PATCH-for-6.1 06/10] hw/block/pflash_cfi02: Remove pflash_setup_mappings() Philippe Mathieu-Daudé
2021-03-29 4:11 ` David Gibson
2021-03-26 0:27 ` [PATCH-for-6.1 07/10] hw/block/pflash_cfi02: Simplify pflash_cfi02_register() prototype Philippe Mathieu-Daudé
2021-03-29 4:12 ` David Gibson
2021-03-26 0:27 ` [RFC PATCH-for-6.1 08/10] hw/misc/aliased_region: Simplify aliased I/O regions Philippe Mathieu-Daudé
2021-03-26 0:27 ` [PATCH-for-6.1 09/10] hw/m68k/q800: Add MacIO container Philippe Mathieu-Daudé
2021-03-26 0:27 ` [RFC PATCH-for-6.1 10/10] hw/m68k/q800: Map MacIO using memory_region_add_subregion_aliased() Philippe Mathieu-Daudé
2021-03-26 12:58 ` [RFC PATCH-for-6.1 00/10] hw/misc: Add memory_region_add_subregion_aliased() helper Richard Henderson
2021-03-27 21:45 ` Mark Cave-Ayland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210326002728.1069834-5-f4bug@amsat.org \
--to=f4bug@amsat.org \
--cc=alistair@alistair23.me \
--cc=antonynpavlov@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=edgar.iglesias@gmail.com \
--cc=laurent@vivier.eu \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).