xref: /openbmc/qemu/include/hw/arm/allwinner-a10.h (revision 3ab8bf83)
1 #ifndef HW_ARM_ALLWINNER_A10_H
2 #define HW_ARM_ALLWINNER_A10_H
3 
4 #include "qemu/error-report.h"
5 #include "hw/char/serial.h"
6 #include "hw/arm/boot.h"
7 #include "hw/pci/pci_device.h"
8 #include "hw/timer/allwinner-a10-pit.h"
9 #include "hw/intc/allwinner-a10-pic.h"
10 #include "hw/net/allwinner_emac.h"
11 #include "hw/sd/allwinner-sdhost.h"
12 #include "hw/ide/ahci.h"
13 #include "hw/usb/hcd-ohci.h"
14 #include "hw/usb/hcd-ehci.h"
15 #include "hw/rtc/allwinner-rtc.h"
16 #include "hw/misc/allwinner-a10-ccm.h"
17 #include "hw/misc/allwinner-a10-dramc.h"
18 #include "hw/i2c/allwinner-i2c.h"
19 #include "sysemu/block-backend.h"
20 
21 #include "target/arm/cpu.h"
22 #include "qom/object.h"
23 
24 
25 #define AW_A10_SDRAM_BASE       0x40000000
26 
27 #define AW_A10_NUM_USB          2
28 
29 #define TYPE_AW_A10 "allwinner-a10"
30 OBJECT_DECLARE_SIMPLE_TYPE(AwA10State, AW_A10)
31 
32 struct AwA10State {
33     /*< private >*/
34     DeviceState parent_obj;
35     /*< public >*/
36 
37     ARMCPU cpu;
38     AwA10ClockCtlState ccm;
39     AwA10DramControllerState dramc;
40     AwA10PITState timer;
41     AwA10PICState intc;
42     AwEmacState emac;
43     AllwinnerAHCIState sata;
44     AwSdHostState mmc0;
45     AWI2CState i2c0;
46     AwRtcState rtc;
47     MemoryRegion sram_a;
48     EHCISysBusState ehci[AW_A10_NUM_USB];
49     OHCISysBusState ohci[AW_A10_NUM_USB];
50 };
51 
52 /**
53  * Emulate Boot ROM firmware setup functionality.
54  *
55  * A real Allwinner A10 SoC contains a Boot ROM
56  * which is the first code that runs right after
57  * the SoC is powered on. The Boot ROM is responsible
58  * for loading user code (e.g. a bootloader) from any
59  * of the supported external devices and writing the
60  * downloaded code to internal SRAM. After loading the SoC
61  * begins executing the code written to SRAM.
62  *
63  * This function emulates the Boot ROM by copying 32 KiB
64  * of data at offset 8 KiB from the given block device and writes it to
65  * the start of the first internal SRAM memory.
66  *
67  * @s: Allwinner A10 state object pointer
68  * @blk: Block backend device object pointer
69  */
70 void allwinner_a10_bootrom_setup(AwA10State *s, BlockBackend *blk);
71 
72 #endif
73