The SH7751 memory controller can access 7 external banks.
The 64MB of SDRAM is on bank #3. Introduce the EXT_CS_BASE()
macro and use it for SDRAM.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/sh4/r2d.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c
index 12232fabbdf..ecbc1ec2a98 100644
--- a/hw/sh4/r2d.c
+++ b/hw/sh4/r2d.c
@@ -45,10 +45,11 @@
#include "hw/block/flash.h"
#include "exec/tswap.h"
-#define FLASH_BASE 0x00000000
+#define EXT_CS_SIZE (64 * MiB)
+#define EXT_CS_BASE(cs_index) ((cs_index) * EXT_CS_SIZE)
+
#define FLASH_SIZE (16 * MiB)
-#define SDRAM_BASE 0x0c000000 /* Physical location of SDRAM: Area 3 */
#define SDRAM_SIZE 0x04000000
#define SM501_VRAM_SIZE 0x800000
@@ -256,7 +257,7 @@ static void r2d_init(MachineState *machine)
switch (machine->ram_size) {
case 64 * MiB:
- sdram_base = SDRAM_BASE;
+ sdram_base = EXT_CS_BASE(3); /* 64M @CS3 */
break;
default:
error_report("This machine can only use 64M of memory");
--
2.51.0