23
#include "qemu/osdep.h"
24
#include "qemu/bitops.h"
26
#include "qapi/error.h"
29
#include "hw/misc/mchp_pfsoc_sysreg.h"
32
#define MESSAGE_INT 0x118c
34
static uint64_t mchp_pfsoc_sysreg_read(void *opaque, hwaddr offset,
45
qemu_log_mask(LOG_UNIMP, "%s: unimplemented device read "
46
"(size %d, offset 0x%" HWADDR_PRIx ")\n",
47
__func__, size, offset);
54
static void mchp_pfsoc_sysreg_write(void *opaque, hwaddr offset,
55
uint64_t value, unsigned size)
57
MchpPfSoCSysregState *s = opaque;
60
qemu_irq_lower(s->irq);
63
qemu_log_mask(LOG_UNIMP, "%s: unimplemented device write "
64
"(size %d, value 0x%" PRIx64
65
", offset 0x%" HWADDR_PRIx ")\n",
66
__func__, size, value, offset);
70
static const MemoryRegionOps mchp_pfsoc_sysreg_ops = {
71
.read = mchp_pfsoc_sysreg_read,
72
.write = mchp_pfsoc_sysreg_write,
73
.endianness = DEVICE_LITTLE_ENDIAN,
76
static void mchp_pfsoc_sysreg_realize(DeviceState *dev, Error **errp)
78
MchpPfSoCSysregState *s = MCHP_PFSOC_SYSREG(dev);
80
memory_region_init_io(&s->sysreg, OBJECT(dev),
81
&mchp_pfsoc_sysreg_ops, s,
83
MCHP_PFSOC_SYSREG_REG_SIZE);
84
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->sysreg);
85
sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq);
88
static void mchp_pfsoc_sysreg_class_init(ObjectClass *klass, void *data)
90
DeviceClass *dc = DEVICE_CLASS(klass);
92
dc->desc = "Microchip PolarFire SoC SYSREG module";
93
dc->realize = mchp_pfsoc_sysreg_realize;
96
static const TypeInfo mchp_pfsoc_sysreg_info = {
97
.name = TYPE_MCHP_PFSOC_SYSREG,
98
.parent = TYPE_SYS_BUS_DEVICE,
99
.instance_size = sizeof(MchpPfSoCSysregState),
100
.class_init = mchp_pfsoc_sysreg_class_init,
103
static void mchp_pfsoc_sysreg_register_types(void)
105
type_register_static(&mchp_pfsoc_sysreg_info);
108
type_init(mchp_pfsoc_sysreg_register_types)