From: Roy Franz <roy.franz@linaro.org>
To: qemu-devel@nongnu.org, peter.maydell@linaro.org,
kwolf@redhat.com, stefanha@redhat.com
Cc: Roy Franz <roy.franz@linaro.org>, patches@linaro.org
Subject: [Qemu-devel] [PATCH V5 2/7] Add device-width property to pflash_cfi01
Date: Thu, 5 Dec 2013 13:35:54 -0800 [thread overview]
Message-ID: <1386279359-32286-3-git-send-email-roy.franz@linaro.org> (raw)
In-Reply-To: <1386279359-32286-1-git-send-email-roy.franz@linaro.org>
The width of the devices that make up the flash interface
is required to mask certain commands, in particular the
write length for buffered writes. This length will be presented
to each device on the interface by the program writing the flash,
and the flash emulation code needs to be able to determine
the length of the write as recieved by each flash device.
The device-width defaults to the bank width which should
maintain existing behavior for platforms that don't need
this change.
This change is required to support buffered writes on the
vexpress platform that has a 32 bit flash interface with 2
16 bit devices on it.
Signed-off-by: Roy Franz <roy.franz@linaro.org>
---
hw/block/pflash_cfi01.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
index a0d7a16..a458ad6 100644
--- a/hw/block/pflash_cfi01.c
+++ b/hw/block/pflash_cfi01.c
@@ -40,6 +40,7 @@
#include "hw/block/flash.h"
#include "block/block.h"
#include "qemu/timer.h"
+#include "qemu/bitops.h"
#include "exec/address-spaces.h"
#include "qemu/host-utils.h"
#include "hw/sysbus.h"
@@ -72,6 +73,7 @@ struct pflash_t {
uint32_t nb_blocs;
uint64_t sector_len;
uint8_t bank_width;
+ uint8_t device_width; /* If 0, device width not specified. */
uint8_t be;
uint8_t wcycle; /* if 0, the flash is read normally */
int ro;
@@ -379,6 +381,14 @@ static void pflash_write(pflash_t *pfl, hwaddr offset,
break;
case 0xe8:
+ /* Mask writeblock size based on device width, or bank width if
+ * device width not specified.
+ */
+ if (pfl->device_width) {
+ value = extract32(value, 0, pfl->device_width * 8);
+ } else {
+ value = extract32(value, 0, pfl->bank_width * 8);
+ }
DPRINTF("%s: block write of %x bytes\n", __func__, value);
pfl->counter = value;
pfl->wcycle++;
@@ -708,6 +718,7 @@ static Property pflash_cfi01_properties[] = {
DEFINE_PROP_UINT32("num-blocks", struct pflash_t, nb_blocs, 0),
DEFINE_PROP_UINT64("sector-length", struct pflash_t, sector_len, 0),
DEFINE_PROP_UINT8("width", struct pflash_t, bank_width, 0),
+ DEFINE_PROP_UINT8("device-width", struct pflash_t, device_width, 0),
DEFINE_PROP_UINT8("big-endian", struct pflash_t, be, 0),
DEFINE_PROP_UINT16("id0", struct pflash_t, ident0, 0),
DEFINE_PROP_UINT16("id1", struct pflash_t, ident1, 0),
--
1.7.10.4
next prev parent reply other threads:[~2013-12-05 21:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-05 21:35 [Qemu-devel] [PATCH V5 0/7] block, arm: Fix buffered flash writes on VExpress Roy Franz
2013-12-05 21:35 ` [Qemu-devel] [PATCH V5 1/7] rename pflash_t member width to bank_width Roy Franz
2013-12-05 21:35 ` Roy Franz [this message]
2013-12-12 17:31 ` [Qemu-devel] [PATCH V5 2/7] Add device-width property to pflash_cfi01 Peter Maydell
2013-12-05 21:35 ` [Qemu-devel] [PATCH V5 3/7] return status for each NOR flash device Roy Franz
2013-12-12 17:31 ` Peter Maydell
2013-12-05 21:35 ` [Qemu-devel] [PATCH V5 4/7] Set proper device-width for vexpress flash Roy Franz
2013-12-12 17:32 ` Peter Maydell
2013-12-05 21:35 ` [Qemu-devel] [PATCH V5 5/7] Add max device width parameter for NOR devices Roy Franz
2013-12-12 17:26 ` Peter Maydell
2013-12-12 17:37 ` Peter Maydell
2013-12-12 20:08 ` Roy Franz
2013-12-05 21:35 ` [Qemu-devel] [PATCH V5 6/7] Fix CFI query responses for NOR flash Roy Franz
2013-12-12 17:33 ` Peter Maydell
2013-12-05 21:35 ` [Qemu-devel] [PATCH V5 7/7] Fix NOR flash device ID reading Roy Franz
2013-12-12 17:35 ` Peter Maydell
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=1386279359-32286-3-git-send-email-roy.franz@linaro.org \
--to=roy.franz@linaro.org \
--cc=kwolf@redhat.com \
--cc=patches@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).