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/cpu/a15mpcore.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/misc/aspeed_xdma.h" 20 #include "hw/timer/aspeed_timer.h" 21 #include "hw/rtc/aspeed_rtc.h" 22 #include "hw/i2c/aspeed_i2c.h" 23 #include "hw/ssi/aspeed_smc.h" 24 #include "hw/watchdog/wdt_aspeed.h" 25 #include "hw/net/ftgmac100.h" 26 #include "target/arm/cpu.h" 27 #include "hw/gpio/aspeed_gpio.h" 28 #include "hw/sd/aspeed_sdhci.h" 29 30 #define ASPEED_SPIS_NUM 2 31 #define ASPEED_WDTS_NUM 4 32 #define ASPEED_CPUS_NUM 2 33 #define ASPEED_MACS_NUM 4 34 35 typedef struct AspeedSoCState { 36 /*< private >*/ 37 DeviceState parent; 38 39 /*< public >*/ 40 ARMCPU cpu[ASPEED_CPUS_NUM]; 41 uint32_t num_cpus; 42 A15MPPrivState a7mpcore; 43 MemoryRegion *dram_mr; 44 MemoryRegion sram; 45 AspeedVICState vic; 46 AspeedRtcState rtc; 47 AspeedTimerCtrlState timerctrl; 48 AspeedI2CState i2c; 49 AspeedSCUState scu; 50 AspeedXDMAState xdma; 51 AspeedSMCState fmc; 52 AspeedSMCState spi[ASPEED_SPIS_NUM]; 53 AspeedSDMCState sdmc; 54 AspeedWDTState wdt[ASPEED_WDTS_NUM]; 55 FTGMAC100State ftgmac100[ASPEED_MACS_NUM]; 56 AspeedMiiState mii[ASPEED_MACS_NUM]; 57 AspeedGPIOState gpio; 58 AspeedGPIOState gpio_1_8v; 59 AspeedSDHCIState sdhci; 60 AspeedSDHCIState emmc; 61 } AspeedSoCState; 62 63 #define TYPE_ASPEED_SOC "aspeed-soc" 64 #define ASPEED_SOC(obj) OBJECT_CHECK(AspeedSoCState, (obj), TYPE_ASPEED_SOC) 65 66 typedef struct AspeedSoCClass { 67 DeviceClass parent_class; 68 69 const char *name; 70 const char *cpu_type; 71 uint32_t silicon_rev; 72 uint64_t sram_size; 73 int spis_num; 74 int wdts_num; 75 int macs_num; 76 const int *irqmap; 77 const hwaddr *memmap; 78 uint32_t num_cpus; 79 } AspeedSoCClass; 80 81 #define ASPEED_SOC_CLASS(klass) \ 82 OBJECT_CLASS_CHECK(AspeedSoCClass, (klass), TYPE_ASPEED_SOC) 83 #define ASPEED_SOC_GET_CLASS(obj) \ 84 OBJECT_GET_CLASS(AspeedSoCClass, (obj), TYPE_ASPEED_SOC) 85 86 enum { 87 ASPEED_IOMEM, 88 ASPEED_UART1, 89 ASPEED_UART2, 90 ASPEED_UART3, 91 ASPEED_UART4, 92 ASPEED_UART5, 93 ASPEED_VUART, 94 ASPEED_FMC, 95 ASPEED_SPI1, 96 ASPEED_SPI2, 97 ASPEED_VIC, 98 ASPEED_SDMC, 99 ASPEED_SCU, 100 ASPEED_ADC, 101 ASPEED_VIDEO, 102 ASPEED_SRAM, 103 ASPEED_SDHCI, 104 ASPEED_GPIO, 105 ASPEED_GPIO_1_8V, 106 ASPEED_RTC, 107 ASPEED_TIMER1, 108 ASPEED_TIMER2, 109 ASPEED_TIMER3, 110 ASPEED_TIMER4, 111 ASPEED_TIMER5, 112 ASPEED_TIMER6, 113 ASPEED_TIMER7, 114 ASPEED_TIMER8, 115 ASPEED_WDT, 116 ASPEED_PWM, 117 ASPEED_LPC, 118 ASPEED_IBT, 119 ASPEED_I2C, 120 ASPEED_ETH1, 121 ASPEED_ETH2, 122 ASPEED_ETH3, 123 ASPEED_ETH4, 124 ASPEED_MII1, 125 ASPEED_MII2, 126 ASPEED_MII3, 127 ASPEED_MII4, 128 ASPEED_SDRAM, 129 ASPEED_XDMA, 130 ASPEED_EMMC, 131 }; 132 133 #endif /* ASPEED_SOC_H */ 134