Blame SOURCES/kvm-r2d-Fix-flash-memory-size-sector-size-width-device-I.patch

7711c0
From e164d03a365ec6457a09acefdda7e6fe50e068af Mon Sep 17 00:00:00 2001
7711c0
From: Markus Armbruster <armbru@redhat.com>
7711c0
Date: Fri, 17 May 2019 06:51:00 +0200
7711c0
Subject: [PATCH 33/53] r2d: Fix flash memory size, sector size, width, device
7711c0
 ID
7711c0
MIME-Version: 1.0
7711c0
Content-Type: text/plain; charset=UTF-8
7711c0
Content-Transfer-Encoding: 8bit
7711c0
7711c0
RH-Author: Markus Armbruster <armbru@redhat.com>
7711c0
Message-id: <20190517065120.12028-12-armbru@redhat.com>
7711c0
Patchwork-id: 87987
7711c0
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH v3 11/31] r2d: Fix flash memory size, sector size, width, device ID
7711c0
Bugzilla: 1624009
7711c0
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7711c0
RH-Acked-by: Thomas Huth <thuth@redhat.com>
7711c0
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
7711c0
pflash_cfi02_register() takes a size in bytes, a block size in bytes
7711c0
and a number of blocks.  r2d_init() passes FLASH_SIZE, 16 * KiB,
7711c0
FLASH_SIZE >> 16.  Does not compute: size doesn't match block size *
7711c0
number of blocks.  The latter happens to win: FLASH_SIZE / 4,
7711c0
i.e. 8MiB.
7711c0
7711c0
The best information we have on the physical hardware lists a Cypress
7711c0
S29PL127J60TFI130 128MiBit NOR flash addressable in words of 16 bits,
7711c0
in sectors of 4 and 32 Kibiwords.  We don't model multiple sector
7711c0
sizes.
7711c0
7711c0
Fix the flash size from 8 to 16MiB, and adjust the sector size from 16
7711c0
to 64KiB.  Fix the width from 4 to 2.  While there, supply the real
7711c0
device IDs 0x0001, 0x227e, 0x2220, 0x2200 instead of zeros.
7711c0
7711c0
Cc: Magnus Damm <magnus.damm@gmail.com>
7711c0
Signed-off-by: Markus Armbruster <armbru@redhat.com>
7711c0
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7711c0
Message-Id: <20190308094610.21210-10-armbru@redhat.com>
7711c0
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7711c0
(cherry picked from commit 8468713412b1eb0d24d605bf97d159a9b01d4b02)
7711c0
[Trivial conflict in hw/sh4/r2d.c due to lack of commit ab3dd749241]
7711c0
7711c0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
---
7711c0
 hw/sh4/r2d.c | 16 ++++++++++++----
7711c0
 1 file changed, 12 insertions(+), 4 deletions(-)
7711c0
7711c0
diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c
7711c0
index 458ed83..befb582 100644
7711c0
--- a/hw/sh4/r2d.c
7711c0
+++ b/hw/sh4/r2d.c
7711c0
@@ -44,7 +44,7 @@
7711c0
 #include "exec/address-spaces.h"
7711c0
 
7711c0
 #define FLASH_BASE 0x00000000
7711c0
-#define FLASH_SIZE 0x02000000
7711c0
+#define FLASH_SIZE (16 * MiB)
7711c0
 
7711c0
 #define SDRAM_BASE 0x0c000000 /* Physical location of SDRAM: Area 3 */
7711c0
 #define SDRAM_SIZE 0x04000000
7711c0
@@ -288,12 +288,20 @@ static void r2d_init(MachineState *machine)
7711c0
     sysbus_mmio_map(busdev, 1, 0x1400080c);
7711c0
     mmio_ide_init_drives(dev, dinfo, NULL);
7711c0
 
7711c0
-    /* onboard flash memory */
7711c0
+    /*
7711c0
+     * Onboard flash memory
7711c0
+     * According to the old board user document in Japanese (under
7711c0
+     * NDA) what is referred to as FROM (Area0) is connected via a
7711c0
+     * 32-bit bus and CS0 to CN8. The docs mention a Cypress
7711c0
+     * S29PL127J60TFI130 chipsset.  Per the 'S29PL-J 002-00615
7711c0
+     * Rev. *E' datasheet, it is a 128Mbit NOR parallel flash
7711c0
+     * addressable in words of 16bit.
7711c0
+     */
7711c0
     dinfo = drive_get(IF_PFLASH, 0, 0);
7711c0
     pflash_cfi02_register(0x0, NULL, "r2d.flash", FLASH_SIZE,
7711c0
                           dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
7711c0
-                          (16 * 1024), FLASH_SIZE >> 16,
7711c0
-                          1, 4, 0x0000, 0x0000, 0x0000, 0x0000,
7711c0
+                          64 * KiB, FLASH_SIZE >> 16,
7711c0
+                          1, 2, 0x0001, 0x227e, 0x2220, 0x2200,
7711c0
                           0x555, 0x2aa, 0);
7711c0
 
7711c0
     /* NIC: rtl8139 on-board, and 2 slots. */
7711c0
-- 
7711c0
1.8.3.1
7711c0