1dcf1d8cdSSergey Kambalin /*
2dcf1d8cdSSergey Kambalin  * BCM2838 peripherals emulation
3dcf1d8cdSSergey Kambalin  *
4dcf1d8cdSSergey Kambalin  * Copyright (C) 2022 Ovchinnikov Vitalii <vitalii.ovchinnikov@auriga.com>
5dcf1d8cdSSergey Kambalin  *
6dcf1d8cdSSergey Kambalin  * SPDX-License-Identifier: GPL-2.0-or-later
7dcf1d8cdSSergey Kambalin  */
8dcf1d8cdSSergey Kambalin 
9dcf1d8cdSSergey Kambalin #ifndef BCM2838_PERIPHERALS_H
10dcf1d8cdSSergey Kambalin #define BCM2838_PERIPHERALS_H
11dcf1d8cdSSergey Kambalin 
12dcf1d8cdSSergey Kambalin #include "hw/arm/bcm2835_peripherals.h"
1313673756SSergey Kambalin #include "hw/sd/sdhci.h"
1413673756SSergey Kambalin #include "hw/gpio/bcm2838_gpio.h"
15dcf1d8cdSSergey Kambalin 
1696b22ee5SSergey Kambalin /* SPI */
1796b22ee5SSergey Kambalin #define GIC_SPI_INTERRUPT_MBOX         33
1896b22ee5SSergey Kambalin #define GIC_SPI_INTERRUPT_MPHI         40
1996b22ee5SSergey Kambalin #define GIC_SPI_INTERRUPT_DWC2         73
2096b22ee5SSergey Kambalin #define GIC_SPI_INTERRUPT_DMA_0        80
2196b22ee5SSergey Kambalin #define GIC_SPI_INTERRUPT_DMA_6        86
2296b22ee5SSergey Kambalin #define GIC_SPI_INTERRUPT_DMA_7_8      87
2396b22ee5SSergey Kambalin #define GIC_SPI_INTERRUPT_DMA_9_10     88
2496b22ee5SSergey Kambalin #define GIC_SPI_INTERRUPT_AUX_UART1    93
2596b22ee5SSergey Kambalin #define GIC_SPI_INTERRUPT_SDHOST       120
2696b22ee5SSergey Kambalin #define GIC_SPI_INTERRUPT_UART0        121
2796b22ee5SSergey Kambalin #define GIC_SPI_INTERRUPT_RNG200       125
2896b22ee5SSergey Kambalin #define GIC_SPI_INTERRUPT_EMMC_EMMC2   126
2996b22ee5SSergey Kambalin #define GIC_SPI_INTERRUPT_PCI_INT_A    143
3096b22ee5SSergey Kambalin #define GIC_SPI_INTERRUPT_GENET_A      157
3196b22ee5SSergey Kambalin #define GIC_SPI_INTERRUPT_GENET_B      158
3296b22ee5SSergey Kambalin 
3396b22ee5SSergey Kambalin 
3496b22ee5SSergey Kambalin /* GPU (legacy) DMA interrupts */
3596b22ee5SSergey Kambalin #define GPU_INTERRUPT_DMA0      16
3696b22ee5SSergey Kambalin #define GPU_INTERRUPT_DMA1      17
3796b22ee5SSergey Kambalin #define GPU_INTERRUPT_DMA2      18
3896b22ee5SSergey Kambalin #define GPU_INTERRUPT_DMA3      19
3996b22ee5SSergey Kambalin #define GPU_INTERRUPT_DMA4      20
4096b22ee5SSergey Kambalin #define GPU_INTERRUPT_DMA5      21
4196b22ee5SSergey Kambalin #define GPU_INTERRUPT_DMA6      22
4296b22ee5SSergey Kambalin #define GPU_INTERRUPT_DMA7_8    23
4396b22ee5SSergey Kambalin #define GPU_INTERRUPT_DMA9_10   24
4496b22ee5SSergey Kambalin #define GPU_INTERRUPT_DMA11     25
4596b22ee5SSergey Kambalin #define GPU_INTERRUPT_DMA12     26
4696b22ee5SSergey Kambalin #define GPU_INTERRUPT_DMA13     27
4796b22ee5SSergey Kambalin #define GPU_INTERRUPT_DMA14     28
4896b22ee5SSergey Kambalin #define GPU_INTERRUPT_DMA15     31
49dcf1d8cdSSergey Kambalin 
5013673756SSergey Kambalin #define BCM2838_MPHI_OFFSET     0xb200
5113673756SSergey Kambalin #define BCM2838_MPHI_SIZE       0x200
5213673756SSergey Kambalin 
53dcf1d8cdSSergey Kambalin #define TYPE_BCM2838_PERIPHERALS "bcm2838-peripherals"
54dcf1d8cdSSergey Kambalin OBJECT_DECLARE_TYPE(BCM2838PeripheralState, BCM2838PeripheralClass,
55dcf1d8cdSSergey Kambalin                     BCM2838_PERIPHERALS)
56dcf1d8cdSSergey Kambalin 
57dcf1d8cdSSergey Kambalin struct BCM2838PeripheralState {
58dcf1d8cdSSergey Kambalin     /*< private >*/
59dcf1d8cdSSergey Kambalin     BCMSocPeripheralBaseState parent_obj;
60dcf1d8cdSSergey Kambalin 
61dcf1d8cdSSergey Kambalin     /*< public >*/
62dcf1d8cdSSergey Kambalin     MemoryRegion peri_low_mr;
63dcf1d8cdSSergey Kambalin     MemoryRegion peri_low_mr_alias;
64dcf1d8cdSSergey Kambalin     MemoryRegion mphi_mr_alias;
6596b22ee5SSergey Kambalin 
6613673756SSergey Kambalin     SDHCIState emmc2;
6713673756SSergey Kambalin     BCM2838GpioState gpio;
6813673756SSergey Kambalin 
6996b22ee5SSergey Kambalin     OrIRQState mmc_irq_orgate;
7096b22ee5SSergey Kambalin     OrIRQState dma_7_8_irq_orgate;
7196b22ee5SSergey Kambalin     OrIRQState dma_9_10_irq_orgate;
72bd41b275SSergey Kambalin 
73bd41b275SSergey Kambalin     UnimplementedDeviceState asb;
74*d8a57715SSergey Kambalin     UnimplementedDeviceState clkisp;
75dcf1d8cdSSergey Kambalin };
76dcf1d8cdSSergey Kambalin 
77dcf1d8cdSSergey Kambalin struct BCM2838PeripheralClass {
78dcf1d8cdSSergey Kambalin     /*< private >*/
79dcf1d8cdSSergey Kambalin     BCMSocPeripheralBaseClass parent_class;
80dcf1d8cdSSergey Kambalin     /*< public >*/
81dcf1d8cdSSergey Kambalin     uint64_t peri_low_size; /* Peripheral lower range size */
82dcf1d8cdSSergey Kambalin };
83dcf1d8cdSSergey Kambalin 
84dcf1d8cdSSergey Kambalin #endif /* BCM2838_PERIPHERALS_H */
85