hw/arm/bcm2853_peripherals: Split out common part of peripherals

Pre-setup for BCM2838 introduction

Signed-off-by: Sergey Kambalin <sergey.kambalin@auriga.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20240226000259.2752893-3-sergey.kambalin@auriga.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Sergey Kambalin 2024-02-25 18:02:20 -06:00 committed by Peter Maydell
parent f932093ae1
commit 7d04d630ba
4 changed files with 154 additions and 100 deletions

View file

@ -35,10 +35,13 @@
#include "hw/misc/unimp.h"
#include "qom/object.h"
#define TYPE_BCM_SOC_PERIPHERALS_BASE "bcm-soc-peripherals-base"
OBJECT_DECLARE_TYPE(BCMSocPeripheralBaseState, BCMSocPeripheralBaseClass,
BCM_SOC_PERIPHERALS_BASE)
#define TYPE_BCM2835_PERIPHERALS "bcm2835-peripherals"
OBJECT_DECLARE_SIMPLE_TYPE(BCM2835PeripheralState, BCM2835_PERIPHERALS)
struct BCM2835PeripheralState {
struct BCMSocPeripheralBaseState {
/*< private >*/
SysBusDevice parent_obj;
/*< public >*/
@ -60,12 +63,9 @@ struct BCM2835PeripheralState {
OrIRQState orgated_dma_irq;
BCM2835ICState ic;
BCM2835PropertyState property;
BCM2835RngState rng;
BCM2835MboxState mboxes;
SDHCIState sdhci;
BCM2835SDHostState sdhost;
BCM2835GpioState gpio;
Bcm2835ThermalState thermal;
UnimplementedDeviceState i2s;
BCM2835SPIState spi[1];
UnimplementedDeviceState i2c[3];
@ -79,4 +79,25 @@ struct BCM2835PeripheralState {
UnimplementedDeviceState sdramc;
};
struct BCMSocPeripheralBaseClass {
/*< private >*/
SysBusDeviceClass parent_class;
/*< public >*/
uint64_t peri_size; /* Peripheral range size */
};
struct BCM2835PeripheralState {
/*< private >*/
BCMSocPeripheralBaseState parent_obj;
/*< public >*/
BCM2835RngState rng;
Bcm2835ThermalState thermal;
BCM2835GpioState gpio;
};
void create_unimp(BCMSocPeripheralBaseState *ps,
UnimplementedDeviceState *uds,
const char *name, hwaddr ofs, hwaddr size);
void bcm_soc_peripherals_common_realize(DeviceState *dev, Error **errp);
#endif /* BCM2835_PERIPHERALS_H */

View file

@ -64,6 +64,7 @@ struct BCM283XState {
BCM2835PeripheralState peripherals;
};
bool bcm283x_common_realize(DeviceState *dev, Error **errp);
bool bcm283x_common_realize(DeviceState *dev, BCMSocPeripheralBaseState *ps,
Error **errp);
#endif /* BCM2836_H */