From patchwork Tue Apr 3 05:50:06 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: 150325 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 DEA2DB6FC3 for ; Tue, 3 Apr 2012 15:51:02 +1000 (EST) Received: from localhost ([::1]:43379 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SEwdv-0001rD-Lg for incoming@patchwork.ozlabs.org; Tue, 03 Apr 2012 01:50:59 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54401) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SEwdU-00013z-A6 for qemu-devel@nongnu.org; Tue, 03 Apr 2012 01:50:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SEwdR-0003GG-DV for qemu-devel@nongnu.org; Tue, 03 Apr 2012 01:50:31 -0400 Received: from mail-iy0-f173.google.com ([209.85.210.173]:60495) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SEwdR-0002xO-8v for qemu-devel@nongnu.org; Tue, 03 Apr 2012 01:50:29 -0400 Received: by mail-iy0-f173.google.com with SMTP id j26so6296886iaf.4 for ; Mon, 02 Apr 2012 22:50:27 -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=kj36yBCcZcyVBQwOhdS207YrgzcGZA8wMudccXjv53M=; b=kYsJ3ZOTju4J79YtsF9TiCcpJxYWMsMHBfAOp5uHFJz2Nzt3VUZcHJ+Yc0YNkQSPHv J42Rq4pyxf73ja6TtHeInj2XlMgJ3HJaWtBKcaOcsO3HT0GsmmgTeZUOJelHUyQmJYBk iBcNrsI9R5iRjepr3QbOHIJjpUnPOunHI+bbEKy6bkE3scD4sTOq8zNU3H5EDpvyRKFu +X7qA/138SzKpmlpAX4AB5ey1zJKbp0OZqcp+u8XdO9Qc1hrcxD/Ecuo8RCkPoXKs6ba fH1OVXbEPn9FWRVeI6SLkE3ZI7HwPs6ZTVohXskkr6RK3DDcMORM4Lb10dZZv5twIcM8 O1iw== Received: by 10.50.85.234 with SMTP id k10mr7711888igz.56.1333432227280; Mon, 02 Apr 2012 22:50:27 -0700 (PDT) Received: from localhost ([124.148.20.9]) by mx.google.com with ESMTPS id vr4sm28624049igb.1.2012.04.02.22.50.23 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 02 Apr 2012 22:50:26 -0700 (PDT) From: "Peter A. G. Crosthwaite" To: qemu-devel@nongnu.org, paul@codesourcery.com, edgar.iglesias@gmail.com, peter.maydell@linaro.org Date: Tue, 3 Apr 2012 15:50:06 +1000 Message-Id: <5e7da55aed79c522153fafda2e83181deaf871d2.1333431448.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: ALoCoQlWBkOAs6o4ZZQrg5AbnbRN69AKwKkyBv062MuWogaJ0Vow0J5nqgf6UeLNYgagph6ukkhF 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 v2 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 --- hw/petalogix_ml605_mmu.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/hw/petalogix_ml605_mmu.c b/hw/petalogix_ml605_mmu.c index 31a4348..58b90cc 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 "spi.h" #include "microblaze_boot.h" #include "microblaze_pic_cpu.h" @@ -75,6 +76,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 +133,23 @@ petalogix_ml605_init(ram_addr_t ram_size, irq[1], irq[0], 100 * 1000000); } + { + SPIBus *spi; + + dev = qdev_create(NULL, "xilinx,spi"); + qdev_prop_set_uint8(dev, "num-cs", 1); + qdev_init_nofail(dev); + busdev = sysbus_from_qdev(dev); + sysbus_mmio_map(busdev, 0, 0x40a00000); + sysbus_connect_irq(busdev, 0, irq[6]); + + spi = FROM_QBUS(SPIBus, qdev_get_child_bus(dev, "spi")); + + dev = qdev_create(NULL, "m25p80"); + qdev_init_nofail(dev); + spi_attach_slave(spi, SPI_SLAVE(dev), 0); + } + microblaze_load_kernel(env, ddr_base, ram_size, BINARY_DEVICE_TREE_FILE, machine_cpu_reset);