From: "Cédric Le Goater" <clg@kaod.org>
To: marcin.krzeminski@nokia.com, qemu-devel@nongnu.org
Cc: crosthwaitepeter@gmail.com, pawel.lenkow@itlen.com,
peter.maydell@linaro.org
Subject: Re: [Qemu-devel] [PATCH 7/9] m25p80: Introduce configuration registers.
Date: Thu, 16 Jun 2016 09:24:46 +0200 [thread overview]
Message-ID: <5762543E.9040006@kaod.org> (raw)
In-Reply-To: <1465998071-7355-8-git-send-email-marcin.krzeminski@nokia.com>
On 06/15/2016 03:41 PM, marcin.krzeminski@nokia.com wrote:
> From: Marcin Krzeminski <marcin.krzeminski@nokia.com>
>
> Configuration registers for Spansion and Macronix devices.
>
> Signed-off-by: Marcin Krzeminski <marcin.krzeminski@nokia.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
I don't think we can define a property array. can we ?
> ---
> hw/block/m25p80.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 47 insertions(+)
>
> diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
> index d1c4d46..21998db 100644
> --- a/hw/block/m25p80.c
> +++ b/hw/block/m25p80.c
> @@ -134,6 +134,14 @@ typedef struct FlashPartInfo {
> #define FSR_4BYTE_ADDR_MODE_ENABLED 0x1
> #define FSR_FLASH_READY (1 << 7)
>
> +/* Spansion configuration registers macros. */
> +#define SPANSION_QUAD_CFG_POS 0
> +#define SPANSION_QUAD_CFG_LEN 1
> +#define SPANSION_DUMMY_CLK_POS 0
> +#define SPANSION_DUMMY_CLK_LEN 4
> +#define SPANSION_ADDR_LEN_POS 7
> +#define SPANSION_ADDR_LEN_LEN 1
> +
> static const FlashPartInfo known_devices[] = {
> /* Atmel -- some are (confusingly) marketed as "DataFlash" */
> { INFO("at25fs010", 0x1f6601, 0, 32 << 10, 4, ER_4K) },
> @@ -369,8 +377,18 @@ typedef struct Flash {
> uint8_t cmd_in_progress;
> uint64_t cur_addr;
> uint32_t nonvolatile_cfg;
> + /* Configuration register for Macronix */
> uint32_t volatile_cfg;
> uint32_t enh_volatile_cfg;
> + /* Spansion cfg registers. */
> + uint8_t spansion_cr1nv;
> + uint8_t spansion_cr2nv;
> + uint8_t spansion_cr3nv;
> + uint8_t spansion_cr4nv;
> + uint8_t spansion_cr1v;
> + uint8_t spansion_cr2v;
> + uint8_t spansion_cr3v;
> + uint8_t spansion_cr4v;
> bool write_enable;
> bool four_bytes_address_mode;
> bool reset_enable;
> @@ -601,6 +619,9 @@ static void complete_collecting_data(Flash *s)
> break;
> case MAN_MACRONIX:
> s->quad_enable = extract32(s->data[0], 6, 1);
> + if (s->len > 1) {
> + s->four_bytes_address_mode = extract32(s->data[1], 5, 1);
> + }
> break;
> default:
> break;
> @@ -674,6 +695,23 @@ static void reset_memory(Flash *s)
> s->ear = s->size / MAX_3BYTES_SIZE - 1;
> }
> break;
> + case MAN_MACRONIX:
> + s->volatile_cfg = 0x7;
> + break;
> + case MAN_SPANSION:
> + s->spansion_cr1v = s->spansion_cr1nv;
> + s->spansion_cr2v = s->spansion_cr2nv;
> + s->spansion_cr3v = s->spansion_cr3nv;
> + s->spansion_cr4v = s->spansion_cr4nv;
> + s->quad_enable = extract32(s->spansion_cr1v,
> + SPANSION_QUAD_CFG_POS,
> + SPANSION_QUAD_CFG_LEN
> + );
> + s->four_bytes_address_mode = extract32(s->spansion_cr2v,
> + SPANSION_ADDR_LEN_POS,
> + SPANSION_ADDR_LEN_LEN
> + );
> + break;
> default:
> break;
> }
> @@ -1052,7 +1090,12 @@ static void m25p80_pre_save(void *opaque)
> }
>
> static Property m25p80_properties[] = {
> + /* This is default value for Micron flash */
> DEFINE_PROP_UINT32("nonvolatile-cfg", Flash, nonvolatile_cfg, 0x8FFF),
> + DEFINE_PROP_UINT8("spansion-cr1nv", Flash, spansion_cr1nv, 0x0),
> + DEFINE_PROP_UINT8("spansion-cr2nv", Flash, spansion_cr2nv, 0x8),
> + DEFINE_PROP_UINT8("spansion-cr3nv", Flash, spansion_cr3nv, 0x2),
> + DEFINE_PROP_UINT8("spansion-cr4nv", Flash, spansion_cr4nv, 0x10),
> DEFINE_PROP_END_OF_LIST(),
> };
>
> @@ -1077,6 +1120,10 @@ static const VMStateDescription vmstate_m25p80 = {
> VMSTATE_UINT32_V(volatile_cfg, Flash, 2),
> VMSTATE_UINT32_V(enh_volatile_cfg, Flash, 2),
> VMSTATE_BOOL_V(quad_enable, Flash, 3),
> + VMSTATE_UINT8_V(spansion_cr1nv, Flash, 3),
> + VMSTATE_UINT8_V(spansion_cr2nv, Flash, 3),
> + VMSTATE_UINT8_V(spansion_cr3nv, Flash, 3),
> + VMSTATE_UINT8_V(spansion_cr4nv, Flash, 3),
> VMSTATE_END_OF_LIST()
> }
> };
>
next prev parent reply other threads:[~2016-06-16 7:24 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-15 13:41 [Qemu-devel] [PATCH 0/9] m25p80: Add new 512Mbit and 1Gbit devices marcin.krzeminski
2016-06-15 13:41 ` [Qemu-devel] [PATCH 1/9] m25p80: Replace JEDEC ID masking with function marcin.krzeminski
2016-06-15 14:05 ` Cédric Le Goater
2016-06-15 17:09 ` [Qemu-devel] Odp.: " Krzeminski, Marcin (Nokia - PL/Wroclaw)
2016-06-15 13:41 ` [Qemu-devel] [PATCH 2/9] m25p80: Make a table for JEDEC ID marcin.krzeminski
2016-06-15 14:17 ` Cédric Le Goater
2016-06-15 13:41 ` [Qemu-devel] [PATCH 3/9] m25p80: Allow more than four banks marcin.krzeminski
2016-06-16 7:09 ` Cédric Le Goater
2016-06-15 13:41 ` [Qemu-devel] [PATCH 4/9] m25p80: Introduce COLLECTING_VAR_LEN_DATA state marcin.krzeminski
2016-06-16 7:13 ` Cédric Le Goater
2016-06-16 7:43 ` Krzeminski, Marcin (Nokia - PL/Wroclaw)
2016-06-16 8:13 ` Cédric Le Goater
2016-06-15 13:41 ` [Qemu-devel] [PATCH 5/9] m25p80: Add additional flash commands: marcin.krzeminski
2016-06-16 7:14 ` Cédric Le Goater
2016-06-15 13:41 ` [Qemu-devel] [PATCH 6/9] m25p80: Introduce quad and equad modes marcin.krzeminski
2016-06-15 14:25 ` Cédric Le Goater
2016-06-15 17:40 ` [Qemu-devel] Odp.: " Krzeminski, Marcin (Nokia - PL/Wroclaw)
2016-06-17 12:43 ` Cédric Le Goater
2016-06-15 13:41 ` [Qemu-devel] [PATCH 7/9] m25p80: Introduce configuration registers marcin.krzeminski
2016-06-16 7:24 ` Cédric Le Goater [this message]
2016-06-16 7:52 ` Krzeminski, Marcin (Nokia - PL/Wroclaw)
2016-06-16 8:05 ` Cédric Le Goater
2016-06-17 10:31 ` Krzeminski, Marcin (Nokia - PL/Wroclaw)
2016-06-15 13:41 ` [Qemu-devel] [PATCH 8/9] m25p80: Fast read commands family changes marcin.krzeminski
2016-06-16 7:19 ` Cédric Le Goater
2016-06-16 7:53 ` Krzeminski, Marcin (Nokia - PL/Wroclaw)
2016-06-15 13:41 ` [Qemu-devel] [PATCH 9/9] m25p80: New flash devices marcin.krzeminski
2016-06-16 7:20 ` Cédric Le Goater
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=5762543E.9040006@kaod.org \
--to=clg@kaod.org \
--cc=crosthwaitepeter@gmail.com \
--cc=marcin.krzeminski@nokia.com \
--cc=pawel.lenkow@itlen.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.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).