[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V4 4/5] petalogix-ml605: added spi controller with m
From: |
Peter A. G. Crosthwaite |
Subject: |
[Qemu-devel] [PATCH V4 4/5] petalogix-ml605: added spi controller with m25p80 |
Date: |
Mon, 4 Jun 2012 18:08:23 +1000 |
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 <address@hidden>
---
changed from v3:
set spi flashes as being fl06k
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 | 23 +++++++++++++++++++++++
3 files changed, 25 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..01af0da 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,25 @@ 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[4]);
+
+ spi = qdev_get_child_bus(dev, "spi");
+
+ for (i = 0; i < NUM_SPI_FLASHES; i++) {
+ dev = ssi_create_slave_no_init(spi, "m25p80", i);
+ qdev_prop_set_string(dev, "partname", (char *)"s25fl064k");
+ qdev_init_nofail(dev);
+ }
+ }
+
microblaze_load_kernel(env, ddr_base, ram_size, BINARY_DEVICE_TREE_FILE,
machine_cpu_reset);
--
1.7.3.2
- [Qemu-devel] [PATCH V4 0/5] Ehnahced SSI bus support + M25P80 SPI flash + Xilinx SPI controller, Peter A. G. Crosthwaite, 2012/06/04
- [Qemu-devel] [PATCH V4 1/5] SSI: Built in multiple device support, Peter A. G. Crosthwaite, 2012/06/04
- [Qemu-devel] [PATCH V4 2/5] m25p80: initial verion, Peter A. G. Crosthwaite, 2012/06/04
- [Qemu-devel] [PATCH V4 4/5] petalogix-ml605: added spi controller with m25p80,
Peter A. G. Crosthwaite <=
- [Qemu-devel] [PATCH V4 3/5] xilinx_spi: initial version, Peter A. G. Crosthwaite, 2012/06/04
- [Qemu-devel] [PATCH V4 5/5] stellaris: Updated spi bus implementation, Peter A. G. Crosthwaite, 2012/06/04
- Re: [Qemu-devel] [PATCH V4 0/5] Ehnahced SSI bus support + M25P80 SPI flash + Xilinx SPI controller, Paul Brook, 2012/06/04