Patchwork [1/2] vexpress: Add NOR0 Flash support

login
register
mail settings
Submitter 402jagan@gmail.com
Date July 18, 2012, 7:03 p.m.
Message ID <1342638220-3600-2-git-send-email-402jagan@gmail.com>
Download mbox | patch
Permalink /patch/171812/
State New
Headers show

Comments

402jagan@gmail.com - July 18, 2012, 7:03 p.m.
From: Jagan <402jagan@gmail.com>

This patch adds support for NOR0 flash (Bank #1) on
vexpress-a9 platform. It is 64MB CFI01 compliant flash.

Tested on stable u-boot version through Linux.

Signed-off-by: Jagan <402jagan@gmail.com>
---
 hw/vexpress.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
Peter Maydell - July 20, 2012, 2:41 p.m.
On 18 July 2012 20:03,  <402jagan@gmail.com> wrote:
> From: Jagan <402jagan@gmail.com>
>
> This patch adds support for NOR0 flash (Bank #1) on
> vexpress-a9 platform. It is 64MB CFI01 compliant flash.
>
> Tested on stable u-boot version through Linux.

You might want to look at a previous attempt at this by
Liming Wang: http://patchwork.ozlabs.org/patch/147905/
and at the review comments I made on that patch.

> Signed-off-by: Jagan <402jagan@gmail.com>

The name in your Signed-off-by: line has to be your full
real name, not a pseudonym or abbreviation. (I appreciate
that some people's full real name really is only a single
name, but since that's the less common case I thought I
should mention this requirement.)

-- PMM
402jagan@gmail.com - July 20, 2012, 3:03 p.m.
Was flash support on express is already there, I haven't seen this
on mainline (master)
that is the reason I worked this.

Should I send the patches again with changing full name at  Signed-off-by

Regards,
Jagan.

On Fri, Jul 20, 2012 at 8:11 PM, Peter Maydell <peter.maydell@linaro.org>wrote:

> On 18 July 2012 20:03,  <402jagan@gmail.com> wrote:
> > From: Jagan <402jagan@gmail.com>
> >
> > This patch adds support for NOR0 flash (Bank #1) on
> > vexpress-a9 platform. It is 64MB CFI01 compliant flash.
> >
> > Tested on stable u-boot version through Linux.
>
> You might want to look at a previous attempt at this by
> Liming Wang: http://patchwork.ozlabs.org/patch/147905/
> and at the review comments I made on that patch.
>
> > Signed-off-by: Jagan <402jagan@gmail.com>
>
> The name in your Signed-off-by: line has to be your full
> real name, not a pseudonym or abbreviation. (I appreciate
> that some people's full real name really is only a single
> name, but since that's the less common case I thought I
> should mention this requirement.)
>
> -- PMM
>

Patch

diff --git a/hw/vexpress.c b/hw/vexpress.c
index 8072c5a..2e889a8 100644
--- a/hw/vexpress.c
+++ b/hw/vexpress.c
@@ -29,6 +29,11 @@ 
 #include "sysemu.h"
 #include "boards.h"
 #include "exec-memory.h"
+#include "blockdev.h"
+#include "flash.h"
+
+#define VEXPRESS_FLASH_SIZE (64 * 1024 * 1024)
+#define VEXPRESS_FLASH_SECT_SIZE (256 * 1024)
 
 #define VEXPRESS_BOARD_ID 0x8e0
 
@@ -355,6 +360,7 @@  static void vexpress_common_init(const VEDBoardInfo *daughterboard,
     MemoryRegion *vram = g_new(MemoryRegion, 1);
     MemoryRegion *sram = g_new(MemoryRegion, 1);
     const target_phys_addr_t *map = daughterboard->motherboard_map;
+    DriveInfo *dinfo;
 
     daughterboard->init(daughterboard, ram_size, cpu_model, pic, &proc_id);
 
@@ -405,7 +411,16 @@  static void vexpress_common_init(const VEDBoardInfo *daughterboard,
 
     sysbus_create_simple("pl111", map[VE_CLCD], pic[14]);
 
-    /* VE_NORFLASH0: not modelled */
+    /* VE_NORFLASH0: */
+    dinfo = drive_get(IF_PFLASH, 0, 0);
+    if (!pflash_cfi01_register(map[VE_NORFLASH0], NULL, "vexpress.flash0",
+        VEXPRESS_FLASH_SIZE, dinfo ? dinfo->bdrv : NULL,
+        VEXPRESS_FLASH_SECT_SIZE,
+        VEXPRESS_FLASH_SIZE / VEXPRESS_FLASH_SECT_SIZE,
+        4, 0x0089, 0x0018, 0x0000, 0x0, 0)) {
+        fprintf(stderr, "qemu: Error registering flash0 memory.\n");
+    }
+
     /* VE_NORFLASH0ALIAS: not modelled */
     /* VE_NORFLASH1: not modelled */