On Fri, 8 Dec 2023 at 02:34, Sergey Kambalin <serg.o...@gmail.com> wrote: > > Signed-off-by: Sergey Kambalin <sergey.kamba...@auriga.com>
The commit message doesn't seem to match the changes here. > --- > hw/arm/bcm2838_peripherals.c | 14 +++++ > hw/arm/raspi4b.c | 1 - > hw/misc/bcm2838_rng200.c | 78 ++++++++++++++++------------ > include/hw/arm/bcm2838_peripherals.h | 2 + > include/hw/misc/bcm2838_rng200.h | 4 +- > 5 files changed, 63 insertions(+), 36 deletions(-) > > diff --git a/hw/arm/bcm2838_peripherals.c b/hw/arm/bcm2838_peripherals.c > index ee06214715..7c489c8e8a 100644 > --- a/hw/arm/bcm2838_peripherals.c > +++ b/hw/arm/bcm2838_peripherals.c > @@ -34,6 +34,9 @@ static void bcm2838_peripherals_init(Object *obj) > bc->peri_low_size); > sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->peri_low_mr); > > + /* Random Number Generator */ > + object_initialize_child(obj, "rng200", &s->rng200, TYPE_BCM2838_RNG200); > + > /* PCIe Host Bridge */ > object_initialize_child(obj, "pcie-host", &s->pcie_host, > TYPE_BCM2838_PCIE_HOST); > @@ -85,6 +88,17 @@ static void bcm2838_peripherals_realize(DeviceState *dev, > Error **errp) > BCM2838_VC_PERI_LOW_BASE, > &s->peri_low_mr_alias, 1); > > + /* Random Number Generator */ > + if (!sysbus_realize(SYS_BUS_DEVICE(&s->rng200), errp)) { > + return; > + } > + memory_region_add_subregion( > + &s_base->peri_mr, RNG_OFFSET, > + sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->rng200), 0)); > + sysbus_connect_irq(SYS_BUS_DEVICE(&s->rng200), 0, > + qdev_get_gpio_in_named(DEVICE(&s_base->ic), BCM2835_IC_GPU_IRQ, > + INTERRUPT_RNG)); > + > /* Extended Mass Media Controller 2 */ > object_property_set_uint(OBJECT(&s->emmc2), "sd-spec-version", 3, > &error_abort); > diff --git a/hw/arm/raspi4b.c b/hw/arm/raspi4b.c > index 2e8474e1c5..7b5385b8dd 100644 > --- a/hw/arm/raspi4b.c > +++ b/hw/arm/raspi4b.c > @@ -67,7 +67,6 @@ static void raspi4_modify_dtb(const struct arm_boot_info > *info, void *fdt) > > /* Temporarily disable following devices until they are implemented*/ > const char *to_be_removed_from_dt_as_wa[] = { > - "brcm,bcm2711-rng200", > "brcm,bcm2711-thermal", > "brcm,bcm2711-genet-v5", > }; These changes above here are all "add the rng200 device to the SoC". They shouldn't be in the same patch as changes below which seem to be adding/changing functionality in the device implementation. I think the changes below (other than the change to include/hw/arm/bcm2838_peripherals.h) should be in the previous patch(es). > diff --git a/hw/misc/bcm2838_rng200.c b/hw/misc/bcm2838_rng200.c > index f91ea0754c..1b334b94d5 100644 > --- a/hw/misc/bcm2838_rng200.c > +++ b/hw/misc/bcm2838_rng200.c > @@ -9,6 +9,7 @@ > > #include "qemu/osdep.h" > #include "qemu/log.h" > +#include "qom/object_interfaces.h" > #include "qapi/error.h" > #include "hw/qdev-properties.h" > #include "hw/misc/bcm2838_rng200.h" > @@ -64,10 +65,7 @@ static const VMStateDescription vmstate_bcm2838_rng200 = { > .version_id = 1, > .minimum_version_id = 1, > .fields = (VMStateField[]) { > - VMSTATE_UINT32(rbg_period, BCM2838Rng200State), > VMSTATE_UINT32(rng_fifo_cap, BCM2838Rng200State), > - VMSTATE_BOOL(use_timer, BCM2838Rng200State), > - > VMSTATE_ARRAY(regs, BCM2838Rng200State, N_BCM2838_RNG200_REGS, 0, > vmstate_info_uint32, uint32_t), > thanks -- PMM