xref: /openbmc/qemu/include/hw/arm/aspeed_soc.h (revision 4a09d0bb)
1 /*
2  * ASPEED SoC family
3  *
4  * Andrew Jeffery <andrew@aj.id.au>
5  *
6  * Copyright 2016 IBM Corp.
7  *
8  * This code is licensed under the GPL version 2 or later.  See
9  * the COPYING file in the top-level directory.
10  */
11 
12 #ifndef ASPEED_SOC_H
13 #define ASPEED_SOC_H
14 
15 #include "hw/arm/arm.h"
16 #include "hw/intc/aspeed_vic.h"
17 #include "hw/misc/aspeed_scu.h"
18 #include "hw/misc/aspeed_sdmc.h"
19 #include "hw/timer/aspeed_timer.h"
20 #include "hw/i2c/aspeed_i2c.h"
21 #include "hw/ssi/aspeed_smc.h"
22 #include "hw/watchdog/wdt_aspeed.h"
23 
24 #define ASPEED_SPIS_NUM  2
25 
26 typedef struct AspeedSoCState {
27     /*< private >*/
28     DeviceState parent;
29 
30     /*< public >*/
31     ARMCPU cpu;
32     MemoryRegion iomem;
33     MemoryRegion sram;
34     AspeedVICState vic;
35     AspeedTimerCtrlState timerctrl;
36     AspeedI2CState i2c;
37     AspeedSCUState scu;
38     AspeedSMCState fmc;
39     AspeedSMCState spi[ASPEED_SPIS_NUM];
40     AspeedSDMCState sdmc;
41     AspeedWDTState wdt;
42 } AspeedSoCState;
43 
44 #define TYPE_ASPEED_SOC "aspeed-soc"
45 #define ASPEED_SOC(obj) OBJECT_CHECK(AspeedSoCState, (obj), TYPE_ASPEED_SOC)
46 
47 typedef struct AspeedSoCInfo {
48     const char *name;
49     const char *cpu_model;
50     uint32_t silicon_rev;
51     hwaddr sdram_base;
52     uint64_t sram_size;
53     int spis_num;
54     const hwaddr *spi_bases;
55     const char *fmc_typename;
56     const char **spi_typename;
57 } AspeedSoCInfo;
58 
59 typedef struct AspeedSoCClass {
60     DeviceClass parent_class;
61     AspeedSoCInfo *info;
62 } AspeedSoCClass;
63 
64 #define ASPEED_SOC_CLASS(klass)                                         \
65     OBJECT_CLASS_CHECK(AspeedSoCClass, (klass), TYPE_ASPEED_SOC)
66 #define ASPEED_SOC_GET_CLASS(obj)                               \
67     OBJECT_GET_CLASS(AspeedSoCClass, (obj), TYPE_ASPEED_SOC)
68 
69 #endif /* ASPEED_SOC_H */
70