From patchwork Fri Apr 20 02:12:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peter A. G. Crosthwaite" X-Patchwork-Id: 153910 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 39A54B7029 for ; Fri, 20 Apr 2012 12:15:56 +1000 (EST) Received: from localhost ([::1]:57284 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SL3Jd-0002tz-8y for incoming@patchwork.ozlabs.org; Thu, 19 Apr 2012 22:11:17 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SL3J3-0001HB-Qg for qemu-devel@nongnu.org; Thu, 19 Apr 2012 22:10:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SL3J1-0001tX-HJ for qemu-devel@nongnu.org; Thu, 19 Apr 2012 22:10:41 -0400 Received: from mail-iy0-f173.google.com ([209.85.210.173]:57562) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SL3J1-0001gY-CV for qemu-devel@nongnu.org; Thu, 19 Apr 2012 22:10:39 -0400 Received: by mail-iy0-f173.google.com with SMTP id j26so14807715iaf.4 for ; Thu, 19 Apr 2012 19:10:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :in-reply-to:references:x-gm-message-state; bh=+D5SDUITUOZkl3eTrCpRQF6NwvxIoBsyZZbV5LeBW0Q=; b=V1CB7rS7Nfi3LUpU08vrfqxyZa90KLWTAtnzk40Bvo0ZkSFpgEGdmGUHTwEPNuB3Kn dS4Ima4pf4hBj5OFNtuvWOgr81jKlsvReYRoDTZc26qRoF80yQ2WqdMrCVueGJ99/W8s P9Nq8nSLu1M9Vh9WqYpva0agNMqtmF0zD19nGe/LVhNxYa4M9u1evefasMoCcCted50c Ia+zxiPOi2nyp0TjvkEVbele4Ft3gyPZbfYVR76wM6wV9nh86Cb0g32cbJpLN5lq6txh E3VeqQC14Io5aleMO8rhwkdu8ecNDH2dxkWngFKbSQKXqQqCrKQYRDWHuZHmNL4s2Aj4 Ql8w== Received: by 10.50.153.198 with SMTP id vi6mr4335864igb.0.1334887838515; Thu, 19 Apr 2012 19:10:38 -0700 (PDT) Received: from localhost ([124.148.20.9]) by mx.google.com with ESMTPS id d5sm2338631iga.15.2012.04.19.19.10.33 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 19 Apr 2012 19:10:36 -0700 (PDT) From: "Peter A. G. Crosthwaite" To: qemu-devel@nongnu.org, paul@codesourcery.com, edgar.iglesias@gmail.com, peter.maydell@linaro.org, stefanha@gmail.com Date: Fri, 20 Apr 2012 12:12:22 +1000 Message-Id: <26e3c1e3655e67dfad1e8b145a5689cde5e3415e.1334886618.git.peter.crosthwaite@petalogix.com> X-Mailer: git-send-email 1.7.3.2 In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQnBGkSfQtbVwKYxYoAdct7bm+8ZS1nCFNb02Z2HRAZeUOA82p3lWgSLxDVvqzqOq5wQu+z3 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.210.173 Cc: peter.crosthwaite@petalogix.com, john.williams@petalogix.com Subject: [Qemu-devel] [PATCH v3 4/4] petalogix-ml605: added spi controller with m25p80 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 Added spi controller to the reference design, with a single cs line and a m25p80 style spi-flash connected Signed-off-by: Peter A. G. Crosthwaite --- changed from v2: changed spi -> ssi added two spi flashes to machine model instead of one default-configs/microblaze-softmmu.mak | 1 + default-configs/microblazeel-softmmu.mak | 1 + hw/petalogix_ml605_mmu.c | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+), 0 deletions(-) diff --git a/default-configs/microblaze-softmmu.mak b/default-configs/microblaze-softmmu.mak index 613edab..e9f2a29 100644 --- a/default-configs/microblaze-softmmu.mak +++ b/default-configs/microblaze-softmmu.mak @@ -3,3 +3,4 @@ CONFIG_PTIMER=y CONFIG_PFLASH_CFI01=y CONFIG_SERIAL=y +CONFIG_SSI=y diff --git a/default-configs/microblazeel-softmmu.mak b/default-configs/microblazeel-softmmu.mak index 4b40fb2..00c1a87 100644 --- a/default-configs/microblazeel-softmmu.mak +++ b/default-configs/microblazeel-softmmu.mak @@ -3,3 +3,4 @@ CONFIG_PTIMER=y CONFIG_PFLASH_CFI01=y CONFIG_SERIAL=y +CONFIG_SSI=y diff --git a/hw/petalogix_ml605_mmu.c b/hw/petalogix_ml605_mmu.c index 31a4348..454875f 100644 --- a/hw/petalogix_ml605_mmu.c +++ b/hw/petalogix_ml605_mmu.c @@ -36,6 +36,7 @@ #include "blockdev.h" #include "pc.h" #include "exec-memory.h" +#include "ssi.h" #include "microblaze_boot.h" #include "microblaze_pic_cpu.h" @@ -54,6 +55,8 @@ #define AXIENET_BASEADDR 0x82780000 #define AXIDMA_BASEADDR 0x84600000 +#define NUM_SPI_FLASHES 2 + static void machine_cpu_reset(CPUMBState *env) { env->pvr.regs[10] = 0x0e000000; /* virtex 6 */ @@ -75,6 +78,7 @@ petalogix_ml605_init(ram_addr_t ram_size, { MemoryRegion *address_space_mem = get_system_memory(); DeviceState *dev; + SysBusDevice *busdev; CPUMBState *env; DriveInfo *dinfo; int i; @@ -131,6 +135,23 @@ petalogix_ml605_init(ram_addr_t ram_size, irq[1], irq[0], 100 * 1000000); } + { + void *spi; + + dev = qdev_create(NULL, "xilinx,spi"); + qdev_prop_set_uint8(dev, "num-cs", NUM_SPI_FLASHES); + qdev_init_nofail(dev); + busdev = sysbus_from_qdev(dev); + sysbus_mmio_map(busdev, 0, 0x40a00000); + sysbus_connect_irq(busdev, 0, irq[6]); + + spi = qdev_get_child_bus(dev, "spi"); + + for (i = 0; i < NUM_SPI_FLASHES; i++) { + ssi_create_slave(spi, "m25p80", i); + } + } + microblaze_load_kernel(env, ddr_base, ram_size, BINARY_DEVICE_TREE_FILE, machine_cpu_reset);