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 <peter.crosthwa...@petalogix.com> --- 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..b2359a8 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); } + { + spi_bus *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(spi_bus, 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); -- 1.7.3.2