4 * Andrew Jeffery <andrew@aj.id.au>
6 * Copyright 2016 IBM Corp.
8 * This code is licensed under the GPL version 2 or later. See
9 * the COPYING file in the top-level directory.
15 #include "hw/cpu/a15mpcore.h"
16 #include "hw/arm/armv7m.h"
17 #include "hw/intc/aspeed_vic.h"
18 #include "hw/intc/aspeed_intc.h"
19 #include "hw/misc/aspeed_scu.h"
20 #include "hw/adc/aspeed_adc.h"
21 #include "hw/misc/aspeed_sdmc.h"
22 #include "hw/misc/aspeed_xdma.h"
23 #include "hw/timer/aspeed_timer.h"
24 #include "hw/rtc/aspeed_rtc.h"
25 #include "hw/i2c/aspeed_i2c.h"
26 #include "hw/misc/aspeed_i3c.h"
27 #include "hw/ssi/aspeed_smc.h"
28 #include "hw/misc/aspeed_hace.h"
29 #include "hw/misc/aspeed_sbc.h"
30 #include "hw/misc/aspeed_sli.h"
31 #include "hw/watchdog/wdt_aspeed.h"
32 #include "hw/net/ftgmac100.h"
33 #include "target/arm/cpu.h"
34 #include "hw/gpio/aspeed_gpio.h"
35 #include "hw/sd/aspeed_sdhci.h"
36 #include "hw/usb/hcd-ehci.h"
37 #include "qom/object.h"
38 #include "hw/misc/aspeed_lpc.h"
39 #include "hw/misc/unimp.h"
40 #include "hw/misc/aspeed_peci.h"
41 #include "hw/fsi/aspeed_apb2opb.h"
42 #include "hw/char/serial-mm.h"
43 #include "hw/intc/arm_gicv3.h"
45 #define ASPEED_SPIS_NUM 2
46 #define ASPEED_EHCIS_NUM 2
47 #define ASPEED_WDTS_NUM 8
48 #define ASPEED_CPUS_NUM 4
49 #define ASPEED_MACS_NUM 4
50 #define ASPEED_UARTS_NUM 13
51 #define ASPEED_JTAG_NUM 2
53 struct AspeedSoCState
{
57 MemoryRegion
*dram_mr
;
58 MemoryRegion dram_container
;
60 MemoryRegion spi_boot_container
;
61 MemoryRegion spi_boot
;
64 AspeedTimerCtrlState timerctrl
;
73 AspeedSMCState spi
[ASPEED_SPIS_NUM
];
74 EHCISysBusState ehci
[ASPEED_EHCIS_NUM
];
79 UnimplementedDeviceState sbc_unimplemented
;
81 AspeedWDTState wdt
[ASPEED_WDTS_NUM
];
82 FTGMAC100State ftgmac100
[ASPEED_MACS_NUM
];
83 AspeedMiiState mii
[ASPEED_MACS_NUM
];
85 AspeedGPIOState gpio_1_8v
;
86 AspeedSDHCIState sdhci
;
87 AspeedSDHCIState emmc
;
90 SerialMM uart
[ASPEED_UARTS_NUM
];
92 UnimplementedDeviceState iomem
;
93 UnimplementedDeviceState video
;
94 UnimplementedDeviceState emmc_boot_controller
;
95 UnimplementedDeviceState dpmcu
;
96 UnimplementedDeviceState pwm
;
97 UnimplementedDeviceState espi
;
98 UnimplementedDeviceState udc
;
99 UnimplementedDeviceState sgpiom
;
100 UnimplementedDeviceState jtag
[ASPEED_JTAG_NUM
];
101 AspeedAPB2OPBState fsi
[2];
104 #define TYPE_ASPEED_SOC "aspeed-soc"
105 OBJECT_DECLARE_TYPE(AspeedSoCState
, AspeedSoCClass
, ASPEED_SOC
)
107 struct Aspeed2400SoCState
{
108 AspeedSoCState parent
;
110 ARMCPU cpu
[ASPEED_CPUS_NUM
];
114 #define TYPE_ASPEED2400_SOC "aspeed2400-soc"
115 OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2400SoCState
, ASPEED2400_SOC
)
117 struct Aspeed2600SoCState
{
118 AspeedSoCState parent
;
120 A15MPPrivState a7mpcore
;
121 ARMCPU cpu
[ASPEED_CPUS_NUM
]; /* XXX belong to a7mpcore */
124 #define TYPE_ASPEED2600_SOC "aspeed2600-soc"
125 OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2600SoCState
, ASPEED2600_SOC
)
127 struct Aspeed27x0SoCState
{
128 AspeedSoCState parent
;
130 ARMCPU cpu
[ASPEED_CPUS_NUM
];
131 AspeedINTCState intc
;
133 MemoryRegion dram_empty
;
136 #define TYPE_ASPEED27X0_SOC "aspeed27x0-soc"
137 OBJECT_DECLARE_SIMPLE_TYPE(Aspeed27x0SoCState
, ASPEED27X0_SOC
)
139 struct Aspeed10x0SoCState
{
140 AspeedSoCState parent
;
145 #define TYPE_ASPEED10X0_SOC "aspeed10x0-soc"
146 OBJECT_DECLARE_SIMPLE_TYPE(Aspeed10x0SoCState
, ASPEED10X0_SOC
)
148 struct AspeedSoCClass
{
149 DeviceClass parent_class
;
152 /** valid_cpu_types: NULL terminated array of a single CPU type. */
153 const char * const *valid_cpu_types
;
154 uint32_t silicon_rev
;
156 uint64_t secsram_size
;
164 const hwaddr
*memmap
;
166 qemu_irq (*get_irq
)(AspeedSoCState
*s
, int dev
);
167 bool (*boot_from_emmc
)(AspeedSoCState
*s
);
170 const char *aspeed_soc_cpu_type(AspeedSoCClass
*sc
);
208 ASPEED_DEV_GPIO_1_8V
,
254 qemu_irq
aspeed_soc_get_irq(AspeedSoCState
*s
, int dev
);
255 bool aspeed_soc_uart_realize(AspeedSoCState
*s
, Error
**errp
);
256 void aspeed_soc_uart_set_chr(AspeedSoCState
*s
, int dev
, Chardev
*chr
);
257 bool aspeed_soc_dram_init(AspeedSoCState
*s
, Error
**errp
);
258 void aspeed_mmio_map(AspeedSoCState
*s
, SysBusDevice
*dev
, int n
, hwaddr addr
);
259 void aspeed_mmio_map_unimplemented(AspeedSoCState
*s
, SysBusDevice
*dev
,
260 const char *name
, hwaddr addr
,
262 void aspeed_board_init_flashes(AspeedSMCState
*s
, const char *flashtype
,
263 unsigned int count
, int unit0
);
265 static inline int aspeed_uart_index(int uart_dev
)
267 return uart_dev
- ASPEED_DEV_UART0
;
270 static inline int aspeed_uart_first(AspeedSoCClass
*sc
)
272 return aspeed_uart_index(sc
->uarts_base
);
275 static inline int aspeed_uart_last(AspeedSoCClass
*sc
)
277 return aspeed_uart_first(sc
) + sc
->uarts_num
- 1;
280 #endif /* ASPEED_SOC_H */