[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 19/29] wire in the dwc-hsotg (dwc2) USB host controller emulation
From: |
Peter Maydell |
Subject: |
[PULL 19/29] wire in the dwc-hsotg (dwc2) USB host controller emulation |
Date: |
Fri, 5 Jun 2020 17:49:57 +0100 |
From: Paul Zimmerman <pauldzim@gmail.com>
Wire the dwc-hsotg (dwc2) emulation into Qemu
Signed-off-by: Paul Zimmerman <pauldzim@gmail.com>
Reviewed-by: Philippe Mathieu-Daude <f4bug@amsat.org>
Message-id: 20200520235349.21215-7-pauldzim@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
include/hw/arm/bcm2835_peripherals.h | 3 ++-
hw/arm/bcm2835_peripherals.c | 21 ++++++++++++++++++++-
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/include/hw/arm/bcm2835_peripherals.h
b/include/hw/arm/bcm2835_peripherals.h
index 7a7a8f61414..48a0ad16335 100644
--- a/include/hw/arm/bcm2835_peripherals.h
+++ b/include/hw/arm/bcm2835_peripherals.h
@@ -27,6 +27,7 @@
#include "hw/sd/bcm2835_sdhost.h"
#include "hw/gpio/bcm2835_gpio.h"
#include "hw/timer/bcm2835_systmr.h"
+#include "hw/usb/hcd-dwc2.h"
#include "hw/misc/unimp.h"
#define TYPE_BCM2835_PERIPHERALS "bcm2835-peripherals"
@@ -67,7 +68,7 @@ typedef struct BCM2835PeripheralState {
UnimplementedDeviceState ave0;
UnimplementedDeviceState bscsl;
UnimplementedDeviceState smi;
- UnimplementedDeviceState dwc2;
+ DWC2State dwc2;
UnimplementedDeviceState sdramc;
} BCM2835PeripheralState;
diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c
index b3e0495040d..cca5b5ad04f 100644
--- a/hw/arm/bcm2835_peripherals.c
+++ b/hw/arm/bcm2835_peripherals.c
@@ -129,6 +129,13 @@ static void bcm2835_peripherals_init(Object *obj)
/* Mphi */
sysbus_init_child_obj(obj, "mphi", &s->mphi, sizeof(s->mphi),
TYPE_BCM2835_MPHI);
+
+ /* DWC2 */
+ sysbus_init_child_obj(obj, "dwc2", &s->dwc2, sizeof(s->dwc2),
+ TYPE_DWC2_USB);
+
+ object_property_add_const_link(OBJECT(&s->dwc2), "dma-mr",
+ OBJECT(&s->gpu_bus_mr));
}
static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp)
@@ -377,6 +384,19 @@ static void bcm2835_peripherals_realize(DeviceState *dev,
Error **errp)
qdev_get_gpio_in_named(DEVICE(&s->ic), BCM2835_IC_GPU_IRQ,
INTERRUPT_HOSTPORT));
+ /* DWC2 */
+ object_property_set_bool(OBJECT(&s->dwc2), true, "realized", &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
+
+ memory_region_add_subregion(&s->peri_mr, USB_OTG_OFFSET,
+ sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->dwc2), 0));
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->dwc2), 0,
+ qdev_get_gpio_in_named(DEVICE(&s->ic), BCM2835_IC_GPU_IRQ,
+ INTERRUPT_USB));
+
create_unimp(s, &s->armtmr, "bcm2835-sp804", ARMCTRL_TIMER0_1_OFFSET,
0x40);
create_unimp(s, &s->cprman, "bcm2835-cprman", CPRMAN_OFFSET, 0x1000);
create_unimp(s, &s->a2w, "bcm2835-a2w", A2W_OFFSET, 0x1000);
@@ -390,7 +410,6 @@ static void bcm2835_peripherals_realize(DeviceState *dev,
Error **errp)
create_unimp(s, &s->otp, "bcm2835-otp", OTP_OFFSET, 0x80);
create_unimp(s, &s->dbus, "bcm2835-dbus", DBUS_OFFSET, 0x8000);
create_unimp(s, &s->ave0, "bcm2835-ave0", AVE0_OFFSET, 0x8000);
- create_unimp(s, &s->dwc2, "dwc-usb2", USB_OTG_OFFSET, 0x1000);
create_unimp(s, &s->sdramc, "bcm2835-sdramc", SDRAMC_OFFSET, 0x100);
}
--
2.20.1
- [PULL 11/29] hw/adc/stm32f2xx_adc: Correct memory region size and access size, (continued)
- [PULL 11/29] hw/adc/stm32f2xx_adc: Correct memory region size and access size, Peter Maydell, 2020/06/05
- [PULL 13/29] docs/system: Document Aspeed boards, Peter Maydell, 2020/06/05
- [PULL 12/29] tests/acceptance: Add a boot test for the xlnx-versal-virt machine, Peter Maydell, 2020/06/05
- [PULL 10/29] target/arm: Split helper_crypto_sm3tt, Peter Maydell, 2020/06/05
- [PULL 14/29] raspi: add BCM2835 SOC MPHI emulation, Peter Maydell, 2020/06/05
- [PULL 16/29] dwc-hsotg (dwc2) USB host controller state definitions, Peter Maydell, 2020/06/05
- [PULL 15/29] dwc-hsotg (dwc2) USB host controller register definitions, Peter Maydell, 2020/06/05
- [PULL 18/29] usb: add short-packet handling to usb-storage driver, Peter Maydell, 2020/06/05
- [PULL 20/29] raspi2 acceptance test: add test for dwc-hsotg (dwc2) USB host, Peter Maydell, 2020/06/05
- [PULL 17/29] dwc-hsotg (dwc2) USB host controller emulation, Peter Maydell, 2020/06/05
- [PULL 19/29] wire in the dwc-hsotg (dwc2) USB host controller emulation,
Peter Maydell <=
- [PULL 21/29] target/arm: Convert Neon VSHL and VSLI 2-reg-shift insn to decodetree, Peter Maydell, 2020/06/05
- [PULL 23/29] target/arm: Convert Neon VSRA, VSRI, VRSHR, VRSRA 2-reg-shift insns to decodetree, Peter Maydell, 2020/06/05
- [PULL 24/29] target/arm: Convert VQSHLU, VQSHL 2-reg-shift insns to decodetree, Peter Maydell, 2020/06/05
- [PULL 25/29] target/arm: Convert Neon narrowing shifts with op==8 to decodetree, Peter Maydell, 2020/06/05
- [PULL 22/29] target/arm: Convert Neon VSHR 2-reg-shift insns to decodetree, Peter Maydell, 2020/06/05
- [PULL 26/29] target/arm: Convert Neon narrowing shifts with op==9 to decodetree, Peter Maydell, 2020/06/05
- [PULL 27/29] target/arm: Convert Neon VSHLL, VMOVL to decodetree, Peter Maydell, 2020/06/05
- [PULL 28/29] target/arm: Convert VCVT fixed-point ops to decodetree, Peter Maydell, 2020/06/05
- [PULL 29/29] target/arm: Convert Neon one-register-and-immediate insns to decodetree, Peter Maydell, 2020/06/05
- Re: [PULL 00/29] target-arm queue, no-reply, 2020/06/05