From patchwork Tue Mar 20 14:57:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: walimis X-Patchwork-Id: 147881 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4BFC3B6F13 for ; Wed, 21 Mar 2012 10:58:56 +1100 (EST) Received: from localhost ([::1]:58552 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SA85v-0007bf-1B for incoming@patchwork.ozlabs.org; Tue, 20 Mar 2012 19:03:59 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50243) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SA0Vz-0005QA-Av for qemu-devel@nongnu.org; Tue, 20 Mar 2012 10:58:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SA0Vt-00053j-17 for qemu-devel@nongnu.org; Tue, 20 Mar 2012 10:58:22 -0400 Received: from mail-ob0-f173.google.com ([209.85.214.173]:50465) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SA0Vs-00053e-Pb for qemu-devel@nongnu.org; Tue, 20 Mar 2012 10:58:16 -0400 Received: by obbwd20 with SMTP id wd20so64707obb.4 for ; Tue, 20 Mar 2012 07:58:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=T5AocqTGWZ2SfKsRDNJQTy3CFT/mbO+/4KZnI/B4Ndc=; b=hJr/Z6+rRhm1Qq4JT3WRpjUPwZDCRKncPf+i1O5yLN/pzkT0U9cLjuLAnFFL6/i3Wa 4nmcpAPivNiAvt4fKJCBa2Q3ruAEwo6Q2d882n48RCQ3N3+xaSIJDko1x3RLut8wFYWD Rl58W6bThI3vUFpHMmmldfSKPLOcwGQ8hTvd8Dn0ewBsOsQwWGQ0lFhtS/63UTkfeYZM J1vlqpfLvwmcAFr9/bTs/FyA75V/lttHR9EnawCN4NMzjzsfj0+9CSx5deosfEAbb9fr 8HLoAVClJPDfTm9u3iUJQP402ipZ1l8iHNc8OTnW+sYIW+OOGOo60OAo4DkBtInDV3Xr qeSQ== Received: by 10.182.31.47 with SMTP id x15mr74944obh.76.1332255494732; Tue, 20 Mar 2012 07:58:14 -0700 (PDT) Received: from localhost ([61.148.56.138]) by mx.google.com with ESMTPS id ri4sm1562246obc.8.2012.03.20.07.58.10 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 20 Mar 2012 07:58:13 -0700 (PDT) From: Liming Wang To: Peter Maydell Date: Tue, 20 Mar 2012 22:57:03 +0800 Message-Id: <1332255423-21090-1-git-send-email-walimisdev@gmail.com> X-Mailer: git-send-email 1.7.0.4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.214.173 X-Mailman-Approved-At: Tue, 20 Mar 2012 19:02:54 -0400 Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] hw/vexpress.c: Add NOR flash model X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Vexpress motherboard has two 2x16 NOR flash, but pflash_cfi01 doesn't support interleaving, so here only models two 1x32 flash. Although it's not exactly modeled, it works fine for running linux. Signed-off-by: Liming Wang --- hw/vexpress.c | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) diff --git a/hw/vexpress.c b/hw/vexpress.c index b9aafec..921b01b 100644 --- a/hw/vexpress.c +++ b/hw/vexpress.c @@ -29,9 +29,13 @@ #include "sysemu.h" #include "boards.h" #include "exec-memory.h" +#include "flash.h" +#include "blockdev.h" #define VEXPRESS_BOARD_ID 0x8e0 +#define VEXPRESS_FLASH_SIZE 0x04000000 + static struct arm_boot_info vexpress_binfo; /* Address maps for peripherals: @@ -355,6 +359,9 @@ 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 = NULL; + uint32_t sector_len = 256 * 1024; + int i = 0; daughterboard->init(daughterboard, ram_size, cpu_model, pic, &proc_id); @@ -405,9 +412,17 @@ static void vexpress_common_init(const VEDBoardInfo *daughterboard, sysbus_create_simple("pl111", map[VE_CLCD], pic[14]); - /* VE_NORFLASH0: not modelled */ + for(i = 0; i < 2; i++) { + dinfo = drive_get(IF_PFLASH, 0, i); + if (dinfo) { + pflash_cfi01_register(((i == 0) ? map[VE_NORFLASH0] : map[VE_NORFLASH1]), NULL, + ((i == 0) ? "vexpress.flash0" : "vexpress:flash1"), + VEXPRESS_FLASH_SIZE, dinfo->bdrv, sector_len, + VEXPRESS_FLASH_SIZE / sector_len, 4, + 0, 0x89, 0x89, 0x19, 0); + } + } /* VE_NORFLASH0ALIAS: not modelled */ - /* VE_NORFLASH1: not modelled */ sram_size = 0x2000000; memory_region_init_ram(sram, "vexpress.sram", sram_size);