bcm2835_peripherals.c (5cd436f95066be3eb87e8767fb1a95ebdd4a9dc8) bcm2835_peripherals.c (00cbd5bd74b1d9db3f39c45aea8eebeedb641051)
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 code is licensed under the GNU GPLv2 and later.

--- 8 unchanged lines hidden (view full) ---

17#include "sysemu/sysemu.h"
18
19/* Peripheral base address on the VC (GPU) system bus */
20#define BCM2835_VC_PERI_BASE 0x7e000000
21
22/* Capabilities for SD controller: no DMA, high-speed, default clocks etc. */
23#define BCM2835_SDHC_CAPAREG 0x52134b4
24
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 code is licensed under the GNU GPLv2 and later.

--- 8 unchanged lines hidden (view full) ---

17#include "sysemu/sysemu.h"
18
19/* Peripheral base address on the VC (GPU) system bus */
20#define BCM2835_VC_PERI_BASE 0x7e000000
21
22/* Capabilities for SD controller: no DMA, high-speed, default clocks etc. */
23#define BCM2835_SDHC_CAPAREG 0x52134b4
24
25static void create_unimp(BCM2835PeripheralState *ps,
26 UnimplementedDeviceState *uds,
27 const char *name, hwaddr ofs, hwaddr size)
28{
29 sysbus_init_child_obj(OBJECT(ps), name, uds,
30 sizeof(UnimplementedDeviceState),
31 TYPE_UNIMPLEMENTED_DEVICE);
32 qdev_prop_set_string(DEVICE(uds), "name", name);
33 qdev_prop_set_uint64(DEVICE(uds), "size", size);
34 object_property_set_bool(OBJECT(uds), true, "realized", &error_fatal);
35 memory_region_add_subregion_overlap(&ps->peri_mr, ofs,
36 sysbus_mmio_get_region(SYS_BUS_DEVICE(uds), 0), -1000);
37}
38
25static void bcm2835_peripherals_init(Object *obj)
26{
27 BCM2835PeripheralState *s = BCM2835_PERIPHERALS(obj);
28
29 /* Memory region for peripheral devices, which we export to our parent */
30 memory_region_init(&s->peri_mr, obj,"bcm2835-peripherals", 0x1000000);
31 object_property_add_child(obj, "peripheral-io", OBJECT(&s->peri_mr), NULL);
32 sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->peri_mr);

--- 285 unchanged lines hidden (view full) ---

318 sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->gpio), 0));
319
320 object_property_add_alias(OBJECT(s), "sd-bus", OBJECT(&s->gpio), "sd-bus",
321 &err);
322 if (err) {
323 error_propagate(errp, err);
324 return;
325 }
39static void bcm2835_peripherals_init(Object *obj)
40{
41 BCM2835PeripheralState *s = BCM2835_PERIPHERALS(obj);
42
43 /* Memory region for peripheral devices, which we export to our parent */
44 memory_region_init(&s->peri_mr, obj,"bcm2835-peripherals", 0x1000000);
45 object_property_add_child(obj, "peripheral-io", OBJECT(&s->peri_mr), NULL);
46 sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->peri_mr);

--- 285 unchanged lines hidden (view full) ---

332 sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->gpio), 0));
333
334 object_property_add_alias(OBJECT(s), "sd-bus", OBJECT(&s->gpio), "sd-bus",
335 &err);
336 if (err) {
337 error_propagate(errp, err);
338 return;
339 }
340
341 create_unimp(s, &s->armtmr, "bcm2835-sp804", ARMCTRL_TIMER0_1_OFFSET, 0x40);
342 create_unimp(s, &s->systmr, "bcm2835-systimer", ST_OFFSET, 0x20);
343 create_unimp(s, &s->cprman, "bcm2835-cprman", CPRMAN_OFFSET, 0x1000);
344 create_unimp(s, &s->a2w, "bcm2835-a2w", A2W_OFFSET, 0x1000);
345 create_unimp(s, &s->i2s, "bcm2835-i2s", I2S_OFFSET, 0x100);
346 create_unimp(s, &s->smi, "bcm2835-smi", SMI_OFFSET, 0x100);
347 create_unimp(s, &s->spi[0], "bcm2835-spi0", SPI0_OFFSET, 0x20);
348 create_unimp(s, &s->bscsl, "bcm2835-spis", BSC_SL_OFFSET, 0x100);
349 create_unimp(s, &s->i2c[0], "bcm2835-i2c0", BSC0_OFFSET, 0x20);
350 create_unimp(s, &s->i2c[1], "bcm2835-i2c1", BSC1_OFFSET, 0x20);
351 create_unimp(s, &s->i2c[2], "bcm2835-i2c2", BSC2_OFFSET, 0x20);
352 create_unimp(s, &s->otp, "bcm2835-otp", OTP_OFFSET, 0x80);
353 create_unimp(s, &s->dbus, "bcm2835-dbus", DBUS_OFFSET, 0x8000);
354 create_unimp(s, &s->ave0, "bcm2835-ave0", AVE0_OFFSET, 0x8000);
355 create_unimp(s, &s->dwc2, "dwc-usb2", USB_OTG_OFFSET, 0x1000);
356 create_unimp(s, &s->sdramc, "bcm2835-sdramc", SDRAMC_OFFSET, 0x100);
326}
327
328static void bcm2835_peripherals_class_init(ObjectClass *oc, void *data)
329{
330 DeviceClass *dc = DEVICE_CLASS(oc);
331
332 dc->realize = bcm2835_peripherals_realize;
333}

--- 15 unchanged lines hidden ---
357}
358
359static void bcm2835_peripherals_class_init(ObjectClass *oc, void *data)
360{
361 DeviceClass *dc = DEVICE_CLASS(oc);
362
363 dc->realize = bcm2835_peripherals_realize;
364}

--- 15 unchanged lines hidden ---