Re: [PATCH 22/26] hw/usb/usb-hcd: Use OHCI type definitions

2020-07-05 Thread Niek Linnenbank
On Sat, Jul 4, 2020, 16:50 Philippe Mathieu-Daudé  wrote:

> Various machine/board/soc models create OHCI device instances
> with the generic QDEV API, and don't need to access USB internals.
>
> Simplify header inclusions by moving the QOM type names into a
> simple header, with no need to include other "hw/usb" headers.
>
> Suggested-by: BALATON Zoltan 
> Signed-off-by: Philippe Mathieu-Daudé 
>
Reviewed-by: Niek Linnenbank 

---
>  hw/usb/hcd-ohci.h|  2 +-
>  include/hw/usb/usb-hcd.h | 16 
>  hw/arm/allwinner-a10.c   |  2 +-
>  hw/arm/allwinner-h3.c|  9 +
>  hw/arm/pxa2xx.c  |  3 ++-
>  hw/arm/realview.c|  3 ++-
>  hw/arm/versatilepb.c |  3 ++-
>  hw/display/sm501.c   |  3 ++-
>  hw/ppc/mac_newworld.c|  3 ++-
>  hw/ppc/mac_oldworld.c|  3 ++-
>  hw/ppc/sam460ex.c|  3 ++-
>  hw/ppc/spapr.c   |  3 ++-
>  hw/usb/hcd-ohci-pci.c|  2 +-
>  13 files changed, 40 insertions(+), 15 deletions(-)
>  create mode 100644 include/hw/usb/usb-hcd.h
>
> diff --git a/hw/usb/hcd-ohci.h b/hw/usb/hcd-ohci.h
> index 771927ea17..6949cf0dab 100644
> --- a/hw/usb/hcd-ohci.h
> +++ b/hw/usb/hcd-ohci.h
> @@ -21,6 +21,7 @@
>  #ifndef HCD_OHCI_H
>  #define HCD_OHCI_H
>
> +#include "hw/usb/usb-hcd.h"
>  #include "sysemu/dma.h"
>  #include "usb-internal.h"
>
> @@ -91,7 +92,6 @@ typedef struct OHCIState {
>  void (*ohci_die)(struct OHCIState *ohci);
>  } OHCIState;
>
> -#define TYPE_SYSBUS_OHCI "sysbus-ohci"
>  #define SYSBUS_OHCI(obj) OBJECT_CHECK(OHCISysBusState, (obj),
> TYPE_SYSBUS_OHCI)
>
>  typedef struct {
> diff --git a/include/hw/usb/usb-hcd.h b/include/hw/usb/usb-hcd.h
> new file mode 100644
> index 00..21fdfaf22d
> --- /dev/null
> +++ b/include/hw/usb/usb-hcd.h
> @@ -0,0 +1,16 @@
> +/*
> + * QEMU USB HCD types
> + *
> + * Copyright (c) 2020  Philippe Mathieu-Daudé 
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#ifndef HW_USB_HCD_TYPES_H
> +#define HW_USB_HCD_TYPES_H
> +
> +/* OHCI */
> +#define TYPE_SYSBUS_OHCI"sysbus-ohci"
> +#define TYPE_PCI_OHCI   "pci-ohci"
> +
> +#endif
> diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
> index 52e0d83760..53c24ff602 100644
> --- a/hw/arm/allwinner-a10.c
> +++ b/hw/arm/allwinner-a10.c
> @@ -25,7 +25,7 @@
>  #include "hw/misc/unimp.h"
>  #include "sysemu/sysemu.h"
>  #include "hw/boards.h"
> -#include "hw/usb/hcd-ohci.h"
> +#include "hw/usb/usb-hcd.h"
>
>  #define AW_A10_MMC0_BASE0x01c0f000
>  #define AW_A10_PIC_REG_BASE 0x01c20400
> diff --git a/hw/arm/allwinner-h3.c b/hw/arm/allwinner-h3.c
> index 8e09468e86..d1d90ffa79 100644
> --- a/hw/arm/allwinner-h3.c
> +++ b/hw/arm/allwinner-h3.c
> @@ -28,6 +28,7 @@
>  #include "hw/sysbus.h"
>  #include "hw/char/serial.h"
>  #include "hw/misc/unimp.h"
> +#include "hw/usb/usb-hcd.h"
>  #include "hw/usb/hcd-ehci.h"
>  #include "hw/loader.h"
>  #include "sysemu/sysemu.h"
> @@ -381,16 +382,16 @@ static void allwinner_h3_realize(DeviceState *dev,
> Error **errp)
>   qdev_get_gpio_in(DEVICE(>gic),
>AW_H3_GIC_SPI_EHCI3));
>
> -sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_OHCI0],
> +sysbus_create_simple(TYPE_SYSBUS_OHCI, s->memmap[AW_H3_OHCI0],
>   qdev_get_gpio_in(DEVICE(>gic),
>AW_H3_GIC_SPI_OHCI0));
> -sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_OHCI1],
> +sysbus_create_simple(TYPE_SYSBUS_OHCI, s->memmap[AW_H3_OHCI1],
>   qdev_get_gpio_in(DEVICE(>gic),
>AW_H3_GIC_SPI_OHCI1));
> -sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_OHCI2],
> +sysbus_create_simple(TYPE_SYSBUS_OHCI, s->memmap[AW_H3_OHCI2],
>   qdev_get_gpio_in(DEVICE(>gic),
>AW_H3_GIC_SPI_OHCI2));
> -sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_OHCI3],
> +sysbus_create_simple(TYPE_SYSBUS_OHCI, s->memmap[AW_H3_OHCI3],
>   qdev_get_gpio_in(DEVICE(>gic),
>AW_H3_GIC_SPI_OHCI3));
>
> diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
> index f104a33463..27196170f5 100644
> --- a/hw/arm/pxa2xx.c
> +++ b/hw/arm/pxa2xx.c
> @@ -18,6 +18,7 @@
>  #include "hw/arm/pxa.h"
>  #include "sysemu/sysemu.h"
>  #include "hw/char/serial.h"
> +#include "hw/usb/usb-hcd.h"
>  #include "hw/i2c/i2c.h"
>  #include "hw/irq.h"
>  #include "hw/qdev-properties.h"
> @@ -2196,7 +2197,7 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space,
>  s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi");
>  }
>
> -sysbus_create_simple("sysbus-ohci", 0x4c00,
> +sysbus_create_simple(TYPE_SYSBUS_OHCI, 0x4c00,
>   qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1));
>
>  s->pcmcia[0] = pxa2xx_pcmcia_init(address_space, 0x2000);
> 

Re: [PATCH 22/26] hw/usb/usb-hcd: Use OHCI type definitions

2020-07-04 Thread Philippe Mathieu-Daudé
On 7/4/20 7:13 PM, BALATON Zoltan wrote:
> On Sat, 4 Jul 2020, Philippe Mathieu-Daudé wrote:
>> Various machine/board/soc models create OHCI device instances
>> with the generic QDEV API, and don't need to access USB internals.
>>
>> Simplify header inclusions by moving the QOM type names into a
>> simple header, with no need to include other "hw/usb" headers.
>>
>> Suggested-by: BALATON Zoltan 
>> Signed-off-by: Philippe Mathieu-Daudé 
>> ---
>> hw/usb/hcd-ohci.h    |  2 +-
>> include/hw/usb/usb-hcd.h | 16 
> 
> I wonder if we need a new header for this or these could just go in the
> new public hw/usb/usb.h as machines creating a HCD may also add devices
> (like keyboard/mouse) so probably will need both headers anyway so
> splitting it up may not worth it but I don't really mind, either way.

Hmm the rationale for this choice is: SoC might only instanciate USB HCI
via sysbus/qdev API, without any use of "hw/usb/usb.h". This is the
machine / board that instanciate USB devices and plug them to the HCI on
the SoC.

I can reword better the description.

> 
> For sm501 and sam460ex parts:
> 
> Reviewed-by: BALATON Zoltan 
> 
> Regards,
> BALATON Zoltan
> 
>> hw/arm/allwinner-a10.c   |  2 +-
>> hw/arm/allwinner-h3.c    |  9 +
>> hw/arm/pxa2xx.c  |  3 ++-
>> hw/arm/realview.c    |  3 ++-
>> hw/arm/versatilepb.c |  3 ++-
>> hw/display/sm501.c   |  3 ++-
>> hw/ppc/mac_newworld.c    |  3 ++-
>> hw/ppc/mac_oldworld.c    |  3 ++-
>> hw/ppc/sam460ex.c    |  3 ++-
>> hw/ppc/spapr.c   |  3 ++-
>> hw/usb/hcd-ohci-pci.c    |  2 +-
>> 13 files changed, 40 insertions(+), 15 deletions(-)
>> create mode 100644 include/hw/usb/usb-hcd.h
>>
>> diff --git a/hw/usb/hcd-ohci.h b/hw/usb/hcd-ohci.h
>> index 771927ea17..6949cf0dab 100644
>> --- a/hw/usb/hcd-ohci.h
>> +++ b/hw/usb/hcd-ohci.h
>> @@ -21,6 +21,7 @@
>> #ifndef HCD_OHCI_H
>> #define HCD_OHCI_H
>>
>> +#include "hw/usb/usb-hcd.h"
>> #include "sysemu/dma.h"
>> #include "usb-internal.h"
>>
>> @@ -91,7 +92,6 @@ typedef struct OHCIState {
>>     void (*ohci_die)(struct OHCIState *ohci);
>> } OHCIState;
>>
>> -#define TYPE_SYSBUS_OHCI "sysbus-ohci"
>> #define SYSBUS_OHCI(obj) OBJECT_CHECK(OHCISysBusState, (obj),
>> TYPE_SYSBUS_OHCI)
>>
>> typedef struct {
>> diff --git a/include/hw/usb/usb-hcd.h b/include/hw/usb/usb-hcd.h
>> new file mode 100644
>> index 00..21fdfaf22d
>> --- /dev/null
>> +++ b/include/hw/usb/usb-hcd.h
>> @@ -0,0 +1,16 @@
>> +/*
>> + * QEMU USB HCD types
>> + *
>> + * Copyright (c) 2020  Philippe Mathieu-Daudé 
>> + *
>> + * SPDX-License-Identifier: GPL-2.0-or-later
>> + */
>> +
>> +#ifndef HW_USB_HCD_TYPES_H
>> +#define HW_USB_HCD_TYPES_H
>> +
>> +/* OHCI */
>> +#define TYPE_SYSBUS_OHCI    "sysbus-ohci"
>> +#define TYPE_PCI_OHCI   "pci-ohci"
>> +
>> +#endif
>> diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
>> index 52e0d83760..53c24ff602 100644
>> --- a/hw/arm/allwinner-a10.c
>> +++ b/hw/arm/allwinner-a10.c
>> @@ -25,7 +25,7 @@
>> #include "hw/misc/unimp.h"
>> #include "sysemu/sysemu.h"
>> #include "hw/boards.h"
>> -#include "hw/usb/hcd-ohci.h"
>> +#include "hw/usb/usb-hcd.h"
>>
>> #define AW_A10_MMC0_BASE    0x01c0f000
>> #define AW_A10_PIC_REG_BASE 0x01c20400
>> diff --git a/hw/arm/allwinner-h3.c b/hw/arm/allwinner-h3.c
>> index 8e09468e86..d1d90ffa79 100644
>> --- a/hw/arm/allwinner-h3.c
>> +++ b/hw/arm/allwinner-h3.c
>> @@ -28,6 +28,7 @@
>> #include "hw/sysbus.h"
>> #include "hw/char/serial.h"
>> #include "hw/misc/unimp.h"
>> +#include "hw/usb/usb-hcd.h"
>> #include "hw/usb/hcd-ehci.h"
>> #include "hw/loader.h"
>> #include "sysemu/sysemu.h"
>> @@ -381,16 +382,16 @@ static void allwinner_h3_realize(DeviceState
>> *dev, Error **errp)
>>  qdev_get_gpio_in(DEVICE(>gic),
>>   AW_H3_GIC_SPI_EHCI3));
>>
>> -    sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_OHCI0],
>> +    sysbus_create_simple(TYPE_SYSBUS_OHCI, s->memmap[AW_H3_OHCI0],
>>  qdev_get_gpio_in(DEVICE(>gic),
>>   AW_H3_GIC_SPI_OHCI0));
>> -    sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_OHCI1],
>> +    sysbus_create_simple(TYPE_SYSBUS_OHCI, s->memmap[AW_H3_OHCI1],
>>  qdev_get_gpio_in(DEVICE(>gic),
>>   AW_H3_GIC_SPI_OHCI1));
>> -    sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_OHCI2],
>> +    sysbus_create_simple(TYPE_SYSBUS_OHCI, s->memmap[AW_H3_OHCI2],
>>  qdev_get_gpio_in(DEVICE(>gic),
>>   AW_H3_GIC_SPI_OHCI2));
>> -    sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_OHCI3],
>> +    sysbus_create_simple(TYPE_SYSBUS_OHCI, s->memmap[AW_H3_OHCI3],
>>  qdev_get_gpio_in(DEVICE(>gic),
>>   AW_H3_GIC_SPI_OHCI3));
>>
>> diff --git a/hw/arm/pxa2xx.c 

Re: [PATCH 22/26] hw/usb/usb-hcd: Use OHCI type definitions

2020-07-04 Thread BALATON Zoltan

On Sat, 4 Jul 2020, Philippe Mathieu-Daudé wrote:

Various machine/board/soc models create OHCI device instances
with the generic QDEV API, and don't need to access USB internals.

Simplify header inclusions by moving the QOM type names into a
simple header, with no need to include other "hw/usb" headers.

Suggested-by: BALATON Zoltan 
Signed-off-by: Philippe Mathieu-Daudé 
---
hw/usb/hcd-ohci.h|  2 +-
include/hw/usb/usb-hcd.h | 16 


I wonder if we need a new header for this or these could just go in the 
new public hw/usb/usb.h as machines creating a HCD may also add devices 
(like keyboard/mouse) so probably will need both headers anyway so 
splitting it up may not worth it but I don't really mind, either way.


For sm501 and sam460ex parts:

Reviewed-by: BALATON Zoltan 

Regards,
BALATON Zoltan


hw/arm/allwinner-a10.c   |  2 +-
hw/arm/allwinner-h3.c|  9 +
hw/arm/pxa2xx.c  |  3 ++-
hw/arm/realview.c|  3 ++-
hw/arm/versatilepb.c |  3 ++-
hw/display/sm501.c   |  3 ++-
hw/ppc/mac_newworld.c|  3 ++-
hw/ppc/mac_oldworld.c|  3 ++-
hw/ppc/sam460ex.c|  3 ++-
hw/ppc/spapr.c   |  3 ++-
hw/usb/hcd-ohci-pci.c|  2 +-
13 files changed, 40 insertions(+), 15 deletions(-)
create mode 100644 include/hw/usb/usb-hcd.h

diff --git a/hw/usb/hcd-ohci.h b/hw/usb/hcd-ohci.h
index 771927ea17..6949cf0dab 100644
--- a/hw/usb/hcd-ohci.h
+++ b/hw/usb/hcd-ohci.h
@@ -21,6 +21,7 @@
#ifndef HCD_OHCI_H
#define HCD_OHCI_H

+#include "hw/usb/usb-hcd.h"
#include "sysemu/dma.h"
#include "usb-internal.h"

@@ -91,7 +92,6 @@ typedef struct OHCIState {
void (*ohci_die)(struct OHCIState *ohci);
} OHCIState;

-#define TYPE_SYSBUS_OHCI "sysbus-ohci"
#define SYSBUS_OHCI(obj) OBJECT_CHECK(OHCISysBusState, (obj), TYPE_SYSBUS_OHCI)

typedef struct {
diff --git a/include/hw/usb/usb-hcd.h b/include/hw/usb/usb-hcd.h
new file mode 100644
index 00..21fdfaf22d
--- /dev/null
+++ b/include/hw/usb/usb-hcd.h
@@ -0,0 +1,16 @@
+/*
+ * QEMU USB HCD types
+ *
+ * Copyright (c) 2020  Philippe Mathieu-Daudé 
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef HW_USB_HCD_TYPES_H
+#define HW_USB_HCD_TYPES_H
+
+/* OHCI */
+#define TYPE_SYSBUS_OHCI"sysbus-ohci"
+#define TYPE_PCI_OHCI   "pci-ohci"
+
+#endif
diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
index 52e0d83760..53c24ff602 100644
--- a/hw/arm/allwinner-a10.c
+++ b/hw/arm/allwinner-a10.c
@@ -25,7 +25,7 @@
#include "hw/misc/unimp.h"
#include "sysemu/sysemu.h"
#include "hw/boards.h"
-#include "hw/usb/hcd-ohci.h"
+#include "hw/usb/usb-hcd.h"

#define AW_A10_MMC0_BASE0x01c0f000
#define AW_A10_PIC_REG_BASE 0x01c20400
diff --git a/hw/arm/allwinner-h3.c b/hw/arm/allwinner-h3.c
index 8e09468e86..d1d90ffa79 100644
--- a/hw/arm/allwinner-h3.c
+++ b/hw/arm/allwinner-h3.c
@@ -28,6 +28,7 @@
#include "hw/sysbus.h"
#include "hw/char/serial.h"
#include "hw/misc/unimp.h"
+#include "hw/usb/usb-hcd.h"
#include "hw/usb/hcd-ehci.h"
#include "hw/loader.h"
#include "sysemu/sysemu.h"
@@ -381,16 +382,16 @@ static void allwinner_h3_realize(DeviceState *dev, Error 
**errp)
 qdev_get_gpio_in(DEVICE(>gic),
  AW_H3_GIC_SPI_EHCI3));

-sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_OHCI0],
+sysbus_create_simple(TYPE_SYSBUS_OHCI, s->memmap[AW_H3_OHCI0],
 qdev_get_gpio_in(DEVICE(>gic),
  AW_H3_GIC_SPI_OHCI0));
-sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_OHCI1],
+sysbus_create_simple(TYPE_SYSBUS_OHCI, s->memmap[AW_H3_OHCI1],
 qdev_get_gpio_in(DEVICE(>gic),
  AW_H3_GIC_SPI_OHCI1));
-sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_OHCI2],
+sysbus_create_simple(TYPE_SYSBUS_OHCI, s->memmap[AW_H3_OHCI2],
 qdev_get_gpio_in(DEVICE(>gic),
  AW_H3_GIC_SPI_OHCI2));
-sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_OHCI3],
+sysbus_create_simple(TYPE_SYSBUS_OHCI, s->memmap[AW_H3_OHCI3],
 qdev_get_gpio_in(DEVICE(>gic),
  AW_H3_GIC_SPI_OHCI3));

diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
index f104a33463..27196170f5 100644
--- a/hw/arm/pxa2xx.c
+++ b/hw/arm/pxa2xx.c
@@ -18,6 +18,7 @@
#include "hw/arm/pxa.h"
#include "sysemu/sysemu.h"
#include "hw/char/serial.h"
+#include "hw/usb/usb-hcd.h"
#include "hw/i2c/i2c.h"
#include "hw/irq.h"
#include "hw/qdev-properties.h"
@@ -2196,7 +2197,7 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space,
s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi");
}

-sysbus_create_simple("sysbus-ohci", 0x4c00,
+sysbus_create_simple(TYPE_SYSBUS_OHCI, 0x4c00,
 qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1));

s->pcmcia[0] = 

[PATCH 22/26] hw/usb/usb-hcd: Use OHCI type definitions

2020-07-04 Thread Philippe Mathieu-Daudé
Various machine/board/soc models create OHCI device instances
with the generic QDEV API, and don't need to access USB internals.

Simplify header inclusions by moving the QOM type names into a
simple header, with no need to include other "hw/usb" headers.

Suggested-by: BALATON Zoltan 
Signed-off-by: Philippe Mathieu-Daudé 
---
 hw/usb/hcd-ohci.h|  2 +-
 include/hw/usb/usb-hcd.h | 16 
 hw/arm/allwinner-a10.c   |  2 +-
 hw/arm/allwinner-h3.c|  9 +
 hw/arm/pxa2xx.c  |  3 ++-
 hw/arm/realview.c|  3 ++-
 hw/arm/versatilepb.c |  3 ++-
 hw/display/sm501.c   |  3 ++-
 hw/ppc/mac_newworld.c|  3 ++-
 hw/ppc/mac_oldworld.c|  3 ++-
 hw/ppc/sam460ex.c|  3 ++-
 hw/ppc/spapr.c   |  3 ++-
 hw/usb/hcd-ohci-pci.c|  2 +-
 13 files changed, 40 insertions(+), 15 deletions(-)
 create mode 100644 include/hw/usb/usb-hcd.h

diff --git a/hw/usb/hcd-ohci.h b/hw/usb/hcd-ohci.h
index 771927ea17..6949cf0dab 100644
--- a/hw/usb/hcd-ohci.h
+++ b/hw/usb/hcd-ohci.h
@@ -21,6 +21,7 @@
 #ifndef HCD_OHCI_H
 #define HCD_OHCI_H
 
+#include "hw/usb/usb-hcd.h"
 #include "sysemu/dma.h"
 #include "usb-internal.h"
 
@@ -91,7 +92,6 @@ typedef struct OHCIState {
 void (*ohci_die)(struct OHCIState *ohci);
 } OHCIState;
 
-#define TYPE_SYSBUS_OHCI "sysbus-ohci"
 #define SYSBUS_OHCI(obj) OBJECT_CHECK(OHCISysBusState, (obj), TYPE_SYSBUS_OHCI)
 
 typedef struct {
diff --git a/include/hw/usb/usb-hcd.h b/include/hw/usb/usb-hcd.h
new file mode 100644
index 00..21fdfaf22d
--- /dev/null
+++ b/include/hw/usb/usb-hcd.h
@@ -0,0 +1,16 @@
+/*
+ * QEMU USB HCD types
+ *
+ * Copyright (c) 2020  Philippe Mathieu-Daudé 
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef HW_USB_HCD_TYPES_H
+#define HW_USB_HCD_TYPES_H
+
+/* OHCI */
+#define TYPE_SYSBUS_OHCI"sysbus-ohci"
+#define TYPE_PCI_OHCI   "pci-ohci"
+
+#endif
diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
index 52e0d83760..53c24ff602 100644
--- a/hw/arm/allwinner-a10.c
+++ b/hw/arm/allwinner-a10.c
@@ -25,7 +25,7 @@
 #include "hw/misc/unimp.h"
 #include "sysemu/sysemu.h"
 #include "hw/boards.h"
-#include "hw/usb/hcd-ohci.h"
+#include "hw/usb/usb-hcd.h"
 
 #define AW_A10_MMC0_BASE0x01c0f000
 #define AW_A10_PIC_REG_BASE 0x01c20400
diff --git a/hw/arm/allwinner-h3.c b/hw/arm/allwinner-h3.c
index 8e09468e86..d1d90ffa79 100644
--- a/hw/arm/allwinner-h3.c
+++ b/hw/arm/allwinner-h3.c
@@ -28,6 +28,7 @@
 #include "hw/sysbus.h"
 #include "hw/char/serial.h"
 #include "hw/misc/unimp.h"
+#include "hw/usb/usb-hcd.h"
 #include "hw/usb/hcd-ehci.h"
 #include "hw/loader.h"
 #include "sysemu/sysemu.h"
@@ -381,16 +382,16 @@ static void allwinner_h3_realize(DeviceState *dev, Error 
**errp)
  qdev_get_gpio_in(DEVICE(>gic),
   AW_H3_GIC_SPI_EHCI3));
 
-sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_OHCI0],
+sysbus_create_simple(TYPE_SYSBUS_OHCI, s->memmap[AW_H3_OHCI0],
  qdev_get_gpio_in(DEVICE(>gic),
   AW_H3_GIC_SPI_OHCI0));
-sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_OHCI1],
+sysbus_create_simple(TYPE_SYSBUS_OHCI, s->memmap[AW_H3_OHCI1],
  qdev_get_gpio_in(DEVICE(>gic),
   AW_H3_GIC_SPI_OHCI1));
-sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_OHCI2],
+sysbus_create_simple(TYPE_SYSBUS_OHCI, s->memmap[AW_H3_OHCI2],
  qdev_get_gpio_in(DEVICE(>gic),
   AW_H3_GIC_SPI_OHCI2));
-sysbus_create_simple("sysbus-ohci", s->memmap[AW_H3_OHCI3],
+sysbus_create_simple(TYPE_SYSBUS_OHCI, s->memmap[AW_H3_OHCI3],
  qdev_get_gpio_in(DEVICE(>gic),
   AW_H3_GIC_SPI_OHCI3));
 
diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
index f104a33463..27196170f5 100644
--- a/hw/arm/pxa2xx.c
+++ b/hw/arm/pxa2xx.c
@@ -18,6 +18,7 @@
 #include "hw/arm/pxa.h"
 #include "sysemu/sysemu.h"
 #include "hw/char/serial.h"
+#include "hw/usb/usb-hcd.h"
 #include "hw/i2c/i2c.h"
 #include "hw/irq.h"
 #include "hw/qdev-properties.h"
@@ -2196,7 +2197,7 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space,
 s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi");
 }
 
-sysbus_create_simple("sysbus-ohci", 0x4c00,
+sysbus_create_simple(TYPE_SYSBUS_OHCI, 0x4c00,
  qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1));
 
 s->pcmcia[0] = pxa2xx_pcmcia_init(address_space, 0x2000);
diff --git a/hw/arm/realview.c b/hw/arm/realview.c
index b6c0a1adb9..0aa34bd4c2 100644
--- a/hw/arm/realview.c
+++ b/hw/arm/realview.c
@@ -16,6 +16,7 @@
 #include "hw/net/lan9118.h"
 #include "hw/net/smc91c111.h"
 #include "hw/pci/pci.h"
+#include "hw/usb/usb-hcd.h"
 #include "net/net.h"
 #include "sysemu/sysemu.h"
 #include "hw/boards.h"
@@