aboutsummaryrefslogtreecommitdiff
path: root/include/hw/ssi
diff options
context:
space:
mode:
authorCédric Le Goater <clg@kaod.org>2016-07-04 13:06:38 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-07-04 13:15:22 +0100
commit924ed16386ac8e079a9798f7de3b0d933fc3132c (patch)
tree67f7b7ca7dae37be076f6840ec38d740dfe654dd /include/hw/ssi
parent7c1c69bca43c345481b778382e605e1d49a12d56 (diff)
downloadqemu-924ed16386ac8e079a9798f7de3b0d933fc3132c.zip
qemu-924ed16386ac8e079a9798f7de3b0d933fc3132c.tar.gz
qemu-924ed16386ac8e079a9798f7de3b0d933fc3132c.tar.bz2
ast2400: add SPI flash slaves
Each controller on the ast2400 has a memory range on which it maps its flash module slaves. Each slave is assigned a memory segment for its mapping that can be changed at bootime with the Segment Address Register. This is not supported in the current implementation so we are using the defaults provided by the specs. Each SPI flash slave can then be accessed in two modes: Command and User. When in User mode, accesses to the memory segment of the slaves are translated in SPI transfers. When in Command mode, the HW generates the SPI commands automatically and the memory segment is accessed as if doing a MMIO. Other SPI controllers call that mode linear addressing mode. For this purpose, we are adding below each crontoller an array of structs gathering for each SPI flash module, a segment rank, a MemoryRegion to handle the memory accesses and the associated SPI slave device, which should be a m25p80. Only the User mode is supported for now but we are preparing ground for the Command mode. The framework is sufficient to support Linux. Signed-off-by: Cédric Le Goater <clg@kaod.org> Message-id: 1467138270-32481-8-git-send-email-clg@kaod.org [PMM: Use g_new0() rather than g_malloc0()] Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include/hw/ssi')
-rw-r--r--include/hw/ssi/aspeed_smc.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/hw/ssi/aspeed_smc.h b/include/hw/ssi/aspeed_smc.h
index c4a4960..def3b45 100644
--- a/include/hw/ssi/aspeed_smc.h
+++ b/include/hw/ssi/aspeed_smc.h
@@ -27,6 +27,12 @@
#include "hw/ssi/ssi.h"
+typedef struct AspeedSegments {
+ hwaddr addr;
+ uint32_t size;
+} AspeedSegments;
+
+struct AspeedSMCState;
typedef struct AspeedSMCController {
const char *name;
uint8_t r_conf;
@@ -35,8 +41,20 @@ typedef struct AspeedSMCController {
uint8_t r_timings;
uint8_t conf_enable_w0;
uint8_t max_slaves;
+ const AspeedSegments *segments;
+ uint32_t mapping_window_size;
} AspeedSMCController;
+typedef struct AspeedSMCFlash {
+ const struct AspeedSMCState *controller;
+
+ uint8_t id;
+ uint32_t size;
+
+ MemoryRegion mmio;
+ DeviceState *flash;
+} AspeedSMCFlash;
+
#define TYPE_ASPEED_SMC "aspeed.smc"
#define ASPEED_SMC(obj) OBJECT_CHECK(AspeedSMCState, (obj), TYPE_ASPEED_SMC)
#define ASPEED_SMC_CLASS(klass) \
@@ -57,6 +75,7 @@ typedef struct AspeedSMCState {
const AspeedSMCController *ctrl;
MemoryRegion mmio;
+ MemoryRegion mmio_flash;
qemu_irq irq;
int irqline;
@@ -74,6 +93,8 @@ typedef struct AspeedSMCState {
uint8_t r_ctrl0;
uint8_t r_timings;
uint8_t conf_enable_w0;
+
+ AspeedSMCFlash *flashes;
} AspeedSMCState;
#endif /* ASPEED_SMC_H */