All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: alex.bennee@linaro.org, lersek@redhat.com, kwolf@redhat.com,
	mreitz@redhat.com, qemu-block@nongnu.org, qemu-ppc@nongnu.org,
	philmd@redhat.com, balaton@eik.bme.hu,
	Magnus Damm <magnus.damm@gmail.com>
Subject: [Qemu-devel] [PATCH v4 09/15] r2d: Fix flash memory size, sector size, width, device ID
Date: Fri,  8 Mar 2019 10:46:04 +0100	[thread overview]
Message-ID: <20190308094610.21210-10-armbru@redhat.com> (raw)
In-Reply-To: <20190308094610.21210-1-armbru@redhat.com>

pflash_cfi02_register() takes a size in bytes, a block size in bytes
and a number of blocks.  r2d_init() passes FLASH_SIZE, 16 * KiB,
FLASH_SIZE >> 16.  Does not compute: size doesn't match block size *
number of blocks.  The latter happens to win: FLASH_SIZE / 4,
i.e. 8MiB.

The best information we have on the physical hardware lists a Cypress
S29PL127J60TFI130 128MiBit NOR flash addressable in words of 16 bits,
in sectors of 4 and 32 Kibiwords.  We don't model multiple sector
sizes.

Fix the flash size from 8 to 16MiB, and adjust the sector size from 16
to 64KiB.  Fix the width from 4 to 2.  While there, supply the real
device IDs 0x0001, 0x227e, 0x2220, 0x2200 instead of zeros.

Cc: Magnus Damm <magnus.damm@gmail.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/sh4/r2d.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c
index dcdb3728cb..cd23c60b86 100644
--- a/hw/sh4/r2d.c
+++ b/hw/sh4/r2d.c
@@ -44,7 +44,7 @@
 #include "exec/address-spaces.h"
 
 #define FLASH_BASE 0x00000000
-#define FLASH_SIZE 0x02000000
+#define FLASH_SIZE (16 * MiB)
 
 #define SDRAM_BASE 0x0c000000 /* Physical location of SDRAM: Area 3 */
 #define SDRAM_SIZE 0x04000000
@@ -288,12 +288,20 @@ static void r2d_init(MachineState *machine)
     sysbus_mmio_map(busdev, 1, 0x1400080c);
     mmio_ide_init_drives(dev, dinfo, NULL);
 
-    /* onboard flash memory */
+    /*
+     * Onboard flash memory
+     * According to the old board user document in Japanese (under
+     * NDA) what is referred to as FROM (Area0) is connected via a
+     * 32-bit bus and CS0 to CN8. The docs mention a Cypress
+     * S29PL127J60TFI130 chipsset.  Per the 'S29PL-J 002-00615
+     * Rev. *E' datasheet, it is a 128Mbit NOR parallel flash
+     * addressable in words of 16bit.
+     */
     dinfo = drive_get(IF_PFLASH, 0, 0);
     pflash_cfi02_register(0x0, NULL, "r2d.flash", FLASH_SIZE,
                           dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
-                          16 * KiB, FLASH_SIZE >> 16,
-                          1, 4, 0x0000, 0x0000, 0x0000, 0x0000,
+                          64 * KiB, FLASH_SIZE >> 16,
+                          1, 2, 0x0001, 0x227e, 0x2220, 0x2200,
                           0x555, 0x2aa, 0);
 
     /* NIC: rtl8139 on-board, and 2 slots. */
-- 
2.17.2

  parent reply	other threads:[~2019-03-08  9:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-08  9:45 [Qemu-devel] [PATCH v4 00/15] pflash: Fixes and cleanups Markus Armbruster
2019-03-08  9:45 ` [Qemu-devel] [PATCH v4 01/15] pflash: Rename pflash_t to PFlashCFI01, PFlashCFI02 Markus Armbruster
2019-03-08  9:45 ` [Qemu-devel] [PATCH v4 02/15] pflash_cfi01: Do not exit() on guest aborting "write to buffer" Markus Armbruster
2019-03-08  9:45 ` [Qemu-devel] [PATCH v4 03/15] pflash_cfi01: Log use of flawed " Markus Armbruster
2019-03-08  9:45 ` [Qemu-devel] [PATCH v4 04/15] pflash: Rename *CFI_PFLASH* to *PFLASH_CFI* Markus Armbruster
2019-03-08  9:46 ` [Qemu-devel] [PATCH v4 05/15] hw: Use PFLASH_CFI0{1, 2} and TYPE_PFLASH_CFI0{1, 2} Markus Armbruster
2019-03-08  9:46 ` [Qemu-devel] [PATCH v4 06/15] sam460ex: Don't size flash memory to match backing image Markus Armbruster
2019-03-08  9:46 ` [Qemu-devel] [PATCH v4 07/15] ppc405_boards: Delete stale, disabled DEBUG_BOARD_INIT code Markus Armbruster
2019-03-08 10:45   ` Alex Bennée
2019-03-08  9:46 ` [Qemu-devel] [PATCH v4 08/15] ppc405_boards: Don't size flash memory to match backing image Markus Armbruster
2019-03-08  9:46 ` Markus Armbruster [this message]
2019-03-08 13:01   ` [Qemu-devel] [PATCH v4 09/15] r2d: Fix flash memory size, sector size, width, device ID Philippe Mathieu-Daudé
2019-03-08  9:46 ` [Qemu-devel] [PATCH v4 10/15] mips_malta: Delete disabled, broken DEBUG_BOARD_INIT code Markus Armbruster
2019-03-08 10:47   ` Alex Bennée
2019-03-08 13:03   ` Philippe Mathieu-Daudé
2019-03-08  9:46 ` [Qemu-devel] [PATCH v4 11/15] hw/mips/malta: Remove fl_sectors variable Markus Armbruster
2019-03-08  9:46 ` [Qemu-devel] [PATCH v4 12/15] hw/mips/malta: Restrict 'bios_size' variable scope Markus Armbruster
2019-03-08  9:46 ` [Qemu-devel] [PATCH v4 13/15] mips_malta: Clean up definition of flash memory size somewhat Markus Armbruster
2019-03-08 12:32   ` Philippe Mathieu-Daudé
2019-03-08 13:04     ` Philippe Mathieu-Daudé
2019-03-08  9:46 ` [Qemu-devel] [PATCH v4 14/15] pflash: Clean up after commit 368a354f02b, part 1 Markus Armbruster
2019-03-08  9:46 ` [Qemu-devel] [PATCH v4 15/15] pflash: Clean up after commit 368a354f02b, part 2 Markus Armbruster

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=20190308094610.21210-10-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=balaton@eik.bme.hu \
    --cc=kwolf@redhat.com \
    --cc=lersek@redhat.com \
    --cc=magnus.damm@gmail.com \
    --cc=mreitz@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.