From patchwork Wed Oct 10 00:46:42 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: 190531 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 751AB2C0089 for ; Wed, 10 Oct 2012 12:36:52 +1100 (EST) Received: from localhost ([::1]:40079 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLkT6-00055E-R8 for incoming@patchwork.ozlabs.org; Tue, 09 Oct 2012 20:48:12 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53328) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLkSP-0003zg-8g for qemu-devel@nongnu.org; Tue, 09 Oct 2012 20:47:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TLkSO-0001CM-4g for qemu-devel@nongnu.org; Tue, 09 Oct 2012 20:47:29 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:52076) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLkSN-00013H-UU for qemu-devel@nongnu.org; Tue, 09 Oct 2012 20:47:28 -0400 Received: by mail-pb0-f45.google.com with SMTP id rp2so68889pbb.4 for ; Tue, 09 Oct 2012 17:47:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=VWCuedb3WuC6RbyaCW7Q+I3gBsZT6d4Yl83tMUzMkvM=; b=L6Wuh0MofIA+fZO68+EtcwVLHTdqWMGiF3uZzrL00mtk8/nViogvWnUZPnK6qzPJE+ 1MF3HYe0RpWTQjAyrtSlJ42wf2snjzLE2erS+w7dguNqwoqmX9BfASRif7M4yHMT9uhu 6Yw+NgkpdCgapeUctEglzrtx9oQpVKQoap3divPyIXb+9lzRtbmabwHkYxCYhcqacPwO eYG7jHUl/f9h1rxEjeyegOoOrSLTEizTL6Coi7icUhzTiVi4yoPu+5sETErgDBTBypV9 E3T5zRXfNqzUqw7K6fGnHPpbrQu7fV52bglf5gw0aJ8ApUDQt2yZnbPg/li9d5oHoInD nq0Q== Received: by 10.68.138.163 with SMTP id qr3mr68495108pbb.161.1349830047532; Tue, 09 Oct 2012 17:47:27 -0700 (PDT) Received: from localhost ([124.148.20.9]) by mx.google.com with ESMTPS id nu8sm98403pbc.45.2012.10.09.17.47.25 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 09 Oct 2012 17:47:26 -0700 (PDT) From: Peter Crosthwaite To: edgar.iglesias@gmail.com, qemu-devel@nongnu.org Date: Wed, 10 Oct 2012 10:46:42 +1000 Message-Id: <1349830006-12124-10-git-send-email-peter.crosthwaite@xilinx.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1349830006-12124-1-git-send-email-peter.crosthwaite@xilinx.com> References: <1349830006-12124-1-git-send-email-peter.crosthwaite@xilinx.com> X-Gm-Message-State: ALoCoQloXWixXxUdl+K2nAoD6qZApgbGHulEQ/zF1/rZs+MZvfzsWIUrGEJrUt1c87jEJezfHTAW X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Subject: [Qemu-devel] [PATCH 09/13] petalogix-ml605: added SPI controller with n25q128 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 From: Peter A. G. Crosthwaite Added SPI controller to the reference design, with two n25q128 spi-flashes connected. Signed-off-by: Peter A. G. Crosthwaite Acked-by: Peter Maydell --- hw/petalogix_ml605_mmu.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/hw/petalogix_ml605_mmu.c b/hw/petalogix_ml605_mmu.c index dced648..b9bfbed 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" @@ -47,6 +48,8 @@ #define BINARY_DEVICE_TREE_FILE "petalogix-ml605.dtb" +#define NUM_SPI_FLASHES 4 + #define MEMORY_BASEADDR 0x50000000 #define FLASH_BASEADDR 0x86000000 #define INTC_BASEADDR 0x81800000 @@ -79,6 +82,7 @@ petalogix_ml605_init(ram_addr_t ram_size, MemoryRegion *address_space_mem = get_system_memory(); DeviceState *dev, *dma, *eth0; MicroBlazeCPU *cpu; + SysBusDevice *busdev; CPUMBState *env; DriveInfo *dinfo; int i; @@ -139,6 +143,29 @@ petalogix_ml605_init(ram_addr_t ram_size, xilinx_axiethernetdma_init(dma, STREAM_SLAVE(eth0), 0x84600000, irq[1], irq[0], 100 * 1000000); + { + SSIBus *spi; + + dev = qdev_create(NULL, "xlnx.xps-spi"); + qdev_prop_set_uint8(dev, "num-ss-bits", NUM_SPI_FLASHES); + qdev_init_nofail(dev); + busdev = sysbus_from_qdev(dev); + sysbus_mmio_map(busdev, 0, 0x40a00000); + sysbus_connect_irq(busdev, 0, irq[4]); + + spi = (SSIBus *)qdev_get_child_bus(dev, "spi"); + + for (i = 0; i < NUM_SPI_FLASHES; i++) { + qemu_irq cs_line; + + dev = ssi_create_slave_no_init(spi, "m25p80"); + qdev_prop_set_string(dev, "partname", "n25q128"); + qdev_init_nofail(dev); + cs_line = qdev_get_gpio_in(dev, 0); + sysbus_connect_irq(busdev, i+1, cs_line); + } + } + microblaze_load_kernel(cpu, ddr_base, ram_size, BINARY_DEVICE_TREE_FILE, machine_cpu_reset);