1 /* 2 * Raspberry Pi emulation (c) 2012 Gregory Estrade 3 * Upstreaming code cleanup [including bcm2835_*] (c) 2013 Jan Petrous 4 * 5 * Rasperry Pi 2 emulation and refactoring Copyright (c) 2015, Microsoft 6 * Written by Andrew Baumann 7 * 8 * This work is licensed under the terms of the GNU GPL, version 2 or later. 9 * See the COPYING file in the top-level directory. 10 */ 11 12 #ifndef BCM2835_PERIPHERALS_H 13 #define BCM2835_PERIPHERALS_H 14 15 #include "hw/sysbus.h" 16 #include "hw/char/pl011.h" 17 #include "hw/char/bcm2835_aux.h" 18 #include "hw/display/bcm2835_fb.h" 19 #include "hw/dma/bcm2835_dma.h" 20 #include "hw/or-irq.h" 21 #include "hw/intc/bcm2835_ic.h" 22 #include "hw/misc/bcm2835_property.h" 23 #include "hw/misc/bcm2835_rng.h" 24 #include "hw/misc/bcm2835_mbox.h" 25 #include "hw/misc/bcm2835_mphi.h" 26 #include "hw/misc/bcm2835_thermal.h" 27 #include "hw/misc/bcm2835_cprman.h" 28 #include "hw/misc/bcm2835_powermgt.h" 29 #include "hw/sd/sdhci.h" 30 #include "hw/sd/bcm2835_sdhost.h" 31 #include "hw/gpio/bcm2835_gpio.h" 32 #include "hw/timer/bcm2835_systmr.h" 33 #include "hw/usb/hcd-dwc2.h" 34 #include "hw/ssi/bcm2835_spi.h" 35 #include "hw/i2c/bcm2835_i2c.h" 36 #include "hw/misc/unimp.h" 37 #include "qom/object.h" 38 39 #define TYPE_BCM_SOC_PERIPHERALS_BASE "bcm-soc-peripherals-base" 40 OBJECT_DECLARE_TYPE(BCMSocPeripheralBaseState, BCMSocPeripheralBaseClass, 41 BCM_SOC_PERIPHERALS_BASE) 42 #define TYPE_BCM2835_PERIPHERALS "bcm2835-peripherals" 43 OBJECT_DECLARE_SIMPLE_TYPE(BCM2835PeripheralState, BCM2835_PERIPHERALS) 44 45 struct BCMSocPeripheralBaseState { 46 /*< private >*/ 47 SysBusDevice parent_obj; 48 /*< public >*/ 49 50 MemoryRegion peri_mr, peri_mr_alias, gpu_bus_mr, mbox_mr; 51 MemoryRegion ram_alias[4]; 52 qemu_irq irq, fiq; 53 54 BCM2835SystemTimerState systmr; 55 BCM2835MphiState mphi; 56 UnimplementedDeviceState txp; 57 UnimplementedDeviceState armtmr; 58 BCM2835PowerMgtState powermgt; 59 BCM2835CprmanState cprman; 60 PL011State uart0; 61 BCM2835AuxState aux; 62 BCM2835FBState fb; 63 BCM2835DMAState dma; 64 OrIRQState orgated_dma_irq; 65 BCM2835ICState ic; 66 BCM2835PropertyState property; 67 BCM2835MboxState mboxes; 68 SDHCIState sdhci; 69 BCM2835SDHostState sdhost; 70 UnimplementedDeviceState i2s; 71 BCM2835SPIState spi[1]; 72 BCM2835I2CState i2c[3]; 73 OrIRQState orgated_i2c_irq; 74 UnimplementedDeviceState otp; 75 UnimplementedDeviceState dbus; 76 UnimplementedDeviceState ave0; 77 UnimplementedDeviceState v3d; 78 UnimplementedDeviceState bscsl; 79 UnimplementedDeviceState smi; 80 DWC2State dwc2; 81 UnimplementedDeviceState sdramc; 82 }; 83 84 struct BCMSocPeripheralBaseClass { 85 /*< private >*/ 86 SysBusDeviceClass parent_class; 87 /*< public >*/ 88 uint64_t peri_size; /* Peripheral range size */ 89 }; 90 91 struct BCM2835PeripheralState { 92 /*< private >*/ 93 BCMSocPeripheralBaseState parent_obj; 94 /*< public >*/ 95 BCM2835RngState rng; 96 Bcm2835ThermalState thermal; 97 BCM2835GpioState gpio; 98 }; 99 100 void create_unimp(BCMSocPeripheralBaseState *ps, 101 UnimplementedDeviceState *uds, 102 const char *name, hwaddr ofs, hwaddr size); 103 void bcm_soc_peripherals_common_realize(DeviceState *dev, Error **errp); 104 105 #endif /* BCM2835_PERIPHERALS_H */ 106