xref: /qemu/include/hw/arm/aspeed_soc.h (revision 5bfcbda7)
100442402SCédric Le Goater /*
2ff90606fSCédric Le Goater  * ASPEED SoC family
300442402SCédric Le Goater  *
400442402SCédric Le Goater  * Andrew Jeffery <andrew@aj.id.au>
500442402SCédric Le Goater  *
600442402SCédric Le Goater  * Copyright 2016 IBM Corp.
700442402SCédric Le Goater  *
800442402SCédric Le Goater  * This code is licensed under the GPL version 2 or later.  See
900442402SCédric Le Goater  * the COPYING file in the top-level directory.
1000442402SCédric Le Goater  */
1100442402SCédric Le Goater 
12ff90606fSCédric Le Goater #ifndef ASPEED_SOC_H
13ff90606fSCédric Le Goater #define ASPEED_SOC_H
1400442402SCédric Le Goater 
15f25c0ae1SCédric Le Goater #include "hw/cpu/a15mpcore.h"
16356b230eSSteven Lee #include "hw/arm/armv7m.h"
1700442402SCédric Le Goater #include "hw/intc/aspeed_vic.h"
1800442402SCédric Le Goater #include "hw/misc/aspeed_scu.h"
19199fd623SAndrew Jeffery #include "hw/adc/aspeed_adc.h"
2000442402SCédric Le Goater #include "hw/misc/aspeed_sdmc.h"
21118c82e7SEddie James #include "hw/misc/aspeed_xdma.h"
2200442402SCédric Le Goater #include "hw/timer/aspeed_timer.h"
23ea5dcf4eSPhilippe Mathieu-Daudé #include "hw/rtc/aspeed_rtc.h"
2400442402SCédric Le Goater #include "hw/i2c/aspeed_i2c.h"
253222165dSTroy Lee #include "hw/misc/aspeed_i3c.h"
2600442402SCédric Le Goater #include "hw/ssi/aspeed_smc.h"
27a3888d75SJoel Stanley #include "hw/misc/aspeed_hace.h"
28e1acf581SJoel Stanley #include "hw/misc/aspeed_sbc.h"
29013befe1SCédric Le Goater #include "hw/watchdog/wdt_aspeed.h"
30ea337c65SCédric Le Goater #include "hw/net/ftgmac100.h"
31ec150c7eSMarkus Armbruster #include "target/arm/cpu.h"
32fdcc7c06SRashmica Gupta #include "hw/gpio/aspeed_gpio.h"
332bea128cSEddie James #include "hw/sd/aspeed_sdhci.h"
34bfdd34f1SGuenter Roeck #include "hw/usb/hcd-ehci.h"
35db1015e9SEduardo Habkost #include "qom/object.h"
362ecf1726SCédric Le Goater #include "hw/misc/aspeed_lpc.h"
3700442402SCédric Le Goater 
38dbcabeebSCédric Le Goater #define ASPEED_SPIS_NUM  2
39bfdd34f1SGuenter Roeck #define ASPEED_EHCIS_NUM 2
406b2b2a70SJoel Stanley #define ASPEED_WDTS_NUM  4
41ece09beeSCédric Le Goater #define ASPEED_CPUS_NUM  2
42d300db02SJoel Stanley #define ASPEED_MACS_NUM  4
43dbcabeebSCédric Le Goater 
44db1015e9SEduardo Habkost struct AspeedSoCState {
4500442402SCédric Le Goater     /*< private >*/
4600442402SCédric Le Goater     DeviceState parent;
4700442402SCédric Le Goater 
4800442402SCédric Le Goater     /*< public >*/
49ece09beeSCédric Le Goater     ARMCPU cpu[ASPEED_CPUS_NUM];
50f25c0ae1SCédric Le Goater     A15MPPrivState     a7mpcore;
51356b230eSSteven Lee     ARMv7MState        armv7m;
524dd9d554SPeter Delevoryas     MemoryRegion *memory;
5395b56e17SCédric Le Goater     MemoryRegion *dram_mr;
54346160cbSCédric Le Goater     MemoryRegion dram_container;
5574af4eecSCédric Le Goater     MemoryRegion sram;
5600442402SCédric Le Goater     AspeedVICState vic;
5775fb4577SJoel Stanley     AspeedRtcState rtc;
5800442402SCédric Le Goater     AspeedTimerCtrlState timerctrl;
5900442402SCédric Le Goater     AspeedI2CState i2c;
603222165dSTroy Lee     AspeedI3CState i3c;
6100442402SCédric Le Goater     AspeedSCUState scu;
62a3888d75SJoel Stanley     AspeedHACEState hace;
63118c82e7SEddie James     AspeedXDMAState xdma;
64199fd623SAndrew Jeffery     AspeedADCState adc;
650e5803dfSCédric Le Goater     AspeedSMCState fmc;
66dbcabeebSCédric Le Goater     AspeedSMCState spi[ASPEED_SPIS_NUM];
67bfdd34f1SGuenter Roeck     EHCISysBusState ehci[ASPEED_EHCIS_NUM];
68e1acf581SJoel Stanley     AspeedSBCState sbc;
6900442402SCédric Le Goater     AspeedSDMCState sdmc;
70f986ee1dSJoel Stanley     AspeedWDTState wdt[ASPEED_WDTS_NUM];
7167340990SCédric Le Goater     FTGMAC100State ftgmac100[ASPEED_MACS_NUM];
72289251b0SCédric Le Goater     AspeedMiiState mii[ASPEED_MACS_NUM];
73fdcc7c06SRashmica Gupta     AspeedGPIOState gpio;
74f25c0ae1SCédric Le Goater     AspeedGPIOState gpio_1_8v;
752bea128cSEddie James     AspeedSDHCIState sdhci;
76a29e3e12SAndrew Jeffery     AspeedSDHCIState emmc;
772ecf1726SCédric Le Goater     AspeedLPCState lpc;
785d63d0c7SPeter Delevoryas     uint32_t uart_default;
79356b230eSSteven Lee     Clock *sysclk;
80db1015e9SEduardo Habkost };
8100442402SCédric Le Goater 
82ff90606fSCédric Le Goater #define TYPE_ASPEED_SOC "aspeed-soc"
83a489d195SEduardo Habkost OBJECT_DECLARE_TYPE(AspeedSoCState, AspeedSoCClass, ASPEED_SOC)
8400442402SCédric Le Goater 
85db1015e9SEduardo Habkost struct AspeedSoCClass {
8654ecafb7SCédric Le Goater     DeviceClass parent_class;
8754ecafb7SCédric Le Goater 
88b033271fSCédric Le Goater     const char *name;
89ba1ba5ccSIgor Mammedov     const char *cpu_type;
90b033271fSCédric Le Goater     uint32_t silicon_rev;
9174af4eecSCédric Le Goater     uint64_t sram_size;
92dbcabeebSCédric Le Goater     int spis_num;
93bfdd34f1SGuenter Roeck     int ehcis_num;
94f986ee1dSJoel Stanley     int wdts_num;
95d300db02SJoel Stanley     int macs_num;
96c5e1bdb9SPeter Delevoryas     int uarts_num;
97b456b113SCédric Le Goater     const int *irqmap;
98d783d1feSCédric Le Goater     const hwaddr *memmap;
99ece09beeSCédric Le Goater     uint32_t num_cpus;
100699db715SCédric Le Goater     qemu_irq (*get_irq)(AspeedSoCState *s, int dev);
101db1015e9SEduardo Habkost };
102b033271fSCédric Le Goater 
10300442402SCédric Le Goater 
104b456b113SCédric Le Goater enum {
105347df6f8SEduardo Habkost     ASPEED_DEV_IOMEM,
106347df6f8SEduardo Habkost     ASPEED_DEV_UART1,
107347df6f8SEduardo Habkost     ASPEED_DEV_UART2,
108347df6f8SEduardo Habkost     ASPEED_DEV_UART3,
109347df6f8SEduardo Habkost     ASPEED_DEV_UART4,
110347df6f8SEduardo Habkost     ASPEED_DEV_UART5,
111ab5e8605SPeter Delevoryas     ASPEED_DEV_UART6,
112ab5e8605SPeter Delevoryas     ASPEED_DEV_UART7,
113ab5e8605SPeter Delevoryas     ASPEED_DEV_UART8,
114ab5e8605SPeter Delevoryas     ASPEED_DEV_UART9,
115ab5e8605SPeter Delevoryas     ASPEED_DEV_UART10,
116ab5e8605SPeter Delevoryas     ASPEED_DEV_UART11,
117ab5e8605SPeter Delevoryas     ASPEED_DEV_UART12,
118ab5e8605SPeter Delevoryas     ASPEED_DEV_UART13,
119347df6f8SEduardo Habkost     ASPEED_DEV_VUART,
120347df6f8SEduardo Habkost     ASPEED_DEV_FMC,
121347df6f8SEduardo Habkost     ASPEED_DEV_SPI1,
122347df6f8SEduardo Habkost     ASPEED_DEV_SPI2,
123347df6f8SEduardo Habkost     ASPEED_DEV_EHCI1,
124347df6f8SEduardo Habkost     ASPEED_DEV_EHCI2,
125347df6f8SEduardo Habkost     ASPEED_DEV_VIC,
126347df6f8SEduardo Habkost     ASPEED_DEV_SDMC,
127347df6f8SEduardo Habkost     ASPEED_DEV_SCU,
128347df6f8SEduardo Habkost     ASPEED_DEV_ADC,
129e1acf581SJoel Stanley     ASPEED_DEV_SBC,
130fe31a2ecSJoel Stanley     ASPEED_DEV_EMMC_BC,
131347df6f8SEduardo Habkost     ASPEED_DEV_VIDEO,
132347df6f8SEduardo Habkost     ASPEED_DEV_SRAM,
133347df6f8SEduardo Habkost     ASPEED_DEV_SDHCI,
134347df6f8SEduardo Habkost     ASPEED_DEV_GPIO,
135347df6f8SEduardo Habkost     ASPEED_DEV_GPIO_1_8V,
136347df6f8SEduardo Habkost     ASPEED_DEV_RTC,
137347df6f8SEduardo Habkost     ASPEED_DEV_TIMER1,
138347df6f8SEduardo Habkost     ASPEED_DEV_TIMER2,
139347df6f8SEduardo Habkost     ASPEED_DEV_TIMER3,
140347df6f8SEduardo Habkost     ASPEED_DEV_TIMER4,
141347df6f8SEduardo Habkost     ASPEED_DEV_TIMER5,
142347df6f8SEduardo Habkost     ASPEED_DEV_TIMER6,
143347df6f8SEduardo Habkost     ASPEED_DEV_TIMER7,
144347df6f8SEduardo Habkost     ASPEED_DEV_TIMER8,
145347df6f8SEduardo Habkost     ASPEED_DEV_WDT,
146347df6f8SEduardo Habkost     ASPEED_DEV_PWM,
147347df6f8SEduardo Habkost     ASPEED_DEV_LPC,
148347df6f8SEduardo Habkost     ASPEED_DEV_IBT,
149347df6f8SEduardo Habkost     ASPEED_DEV_I2C,
150347df6f8SEduardo Habkost     ASPEED_DEV_ETH1,
151347df6f8SEduardo Habkost     ASPEED_DEV_ETH2,
152347df6f8SEduardo Habkost     ASPEED_DEV_ETH3,
153347df6f8SEduardo Habkost     ASPEED_DEV_ETH4,
154347df6f8SEduardo Habkost     ASPEED_DEV_MII1,
155347df6f8SEduardo Habkost     ASPEED_DEV_MII2,
156347df6f8SEduardo Habkost     ASPEED_DEV_MII3,
157347df6f8SEduardo Habkost     ASPEED_DEV_MII4,
158347df6f8SEduardo Habkost     ASPEED_DEV_SDRAM,
159347df6f8SEduardo Habkost     ASPEED_DEV_XDMA,
160347df6f8SEduardo Habkost     ASPEED_DEV_EMMC,
161c59f781eSAndrew Jeffery     ASPEED_DEV_KCS,
162a3888d75SJoel Stanley     ASPEED_DEV_HACE,
163d9e9cd59STroy Lee     ASPEED_DEV_DPMCU,
164d9e9cd59STroy Lee     ASPEED_DEV_DP,
1653222165dSTroy Lee     ASPEED_DEV_I3C,
166b456b113SCédric Le Goater };
167b456b113SCédric Le Goater 
168699db715SCédric Le Goater qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int dev);
169470253b6SPeter Delevoryas void aspeed_soc_uart_init(AspeedSoCState *s);
170346160cbSCédric Le Goater bool aspeed_soc_dram_init(AspeedSoCState *s, Error **errp);
171*5bfcbda7SPeter Delevoryas void aspeed_mmio_map(AspeedSoCState *s, SysBusDevice *dev, int n, hwaddr addr);
172699db715SCédric Le Goater 
173ff90606fSCédric Le Goater #endif /* ASPEED_SOC_H */
174