@@ -23,6 +23,7 @@
#include "hw/pci/pci.h"
#include "hw/sysbus.h"
#include "usb-internal.h"
+#include "hw/usb/usb-hcd.h"
#define CAPA_SIZE 0x10
@@ -316,7 +317,6 @@ void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp);
void usb_ehci_unrealize(EHCIState *s, DeviceState *dev);
void ehci_reset(void *opaque);
-#define TYPE_PCI_EHCI "pci-ehci-usb"
#define PCI_EHCI(obj) OBJECT_CHECK(EHCIPCIState, (obj), TYPE_PCI_EHCI)
typedef struct EHCIPCIState {
@@ -327,15 +327,6 @@ typedef struct EHCIPCIState {
EHCIState ehci;
} EHCIPCIState;
-
-#define TYPE_SYS_BUS_EHCI "sysbus-ehci-usb"
-#define TYPE_PLATFORM_EHCI "platform-ehci-usb"
-#define TYPE_EXYNOS4210_EHCI "exynos4210-ehci-usb"
-#define TYPE_AW_H3_EHCI "aw-h3-ehci-usb"
-#define TYPE_TEGRA2_EHCI "tegra2-ehci-usb"
-#define TYPE_PPC4xx_EHCI "ppc4xx-ehci-usb"
-#define TYPE_FUSBH200_EHCI "fusbh200-ehci-usb"
-
#define SYS_BUS_EHCI(obj) \
OBJECT_CHECK(EHCISysBusState, (obj), TYPE_SYS_BUS_EHCI)
#define SYS_BUS_EHCI_CLASS(class) \
@@ -2,6 +2,7 @@
#define CHIPIDEA_H
#include "hw/usb/hcd-ehci.h"
+#include "hw/usb/usb-hcd.h"
typedef struct ChipideaState {
/*< private >*/
@@ -10,7 +11,6 @@ typedef struct ChipideaState {
MemoryRegion iomem[3];
} ChipideaState;
-#define TYPE_CHIPIDEA "usb-chipidea"
#define CHIPIDEA(obj) OBJECT_CHECK(ChipideaState, (obj), TYPE_CHIPIDEA)
#endif /* CHIPIDEA_H */
@@ -13,4 +13,15 @@
#define TYPE_SYSBUS_OHCI "sysbus-ohci"
#define TYPE_PCI_OHCI "pci-ohci"
+/* EHCI */
+#define TYPE_SYS_BUS_EHCI "sysbus-ehci-usb"
+#define TYPE_PCI_EHCI "pci-ehci-usb"
+#define TYPE_PLATFORM_EHCI "platform-ehci-usb"
+#define TYPE_EXYNOS4210_EHCI "exynos4210-ehci-usb"
+#define TYPE_AW_H3_EHCI "aw-h3-ehci-usb"
+#define TYPE_TEGRA2_EHCI "tegra2-ehci-usb"
+#define TYPE_PPC4xx_EHCI "ppc4xx-ehci-usb"
+#define TYPE_FUSBH200_EHCI "fusbh200-ehci-usb"
+#define TYPE_CHIPIDEA "usb-chipidea"
+
#endif
@@ -29,7 +29,6 @@
#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"
#include "hw/arm/allwinner-h3.h"
@@ -35,7 +35,7 @@
#include "hw/qdev-properties.h"
#include "hw/arm/exynos4210.h"
#include "hw/sd/sdhci.h"
-#include "hw/usb/hcd-ehci.h"
+#include "hw/usb/usb-hcd.h"
#define EXYNOS4210_CHIPID_ADDR 0x10000000
@@ -38,6 +38,7 @@
#include "hw/loader.h"
#include "hw/pci-host/gpex.h"
#include "hw/qdev-properties.h"
+#include "hw/usb/usb-hcd.h"
#include "hw/char/pl011.h"
#include "net/net.h"
@@ -485,7 +486,7 @@ static void create_ehci(const SBSAMachineState *sms)
hwaddr base = sbsa_ref_memmap[SBSA_EHCI].base;
int irq = sbsa_ref_irqmap[SBSA_EHCI];
- sysbus_create_simple("platform-ehci-usb", base,
+ sysbus_create_simple(TYPE_PLATFORM_EHCI, base,
qdev_get_gpio_in(sms->gic, irq));
}
@@ -29,7 +29,7 @@
#include "hw/loader.h"
#include "hw/misc/zynq-xadc.h"
#include "hw/ssi/ssi.h"
-#include "hw/usb/chipidea.h"
+#include "hw/usb/usb-hcd.h"
#include "qemu/error-report.h"
#include "hw/sd/sdhci.h"
#include "hw/char/cadence_uart.h"
@@ -37,7 +37,6 @@
#include "hw/i2c/smbus_eeprom.h"
#include "hw/usb/usb.h"
#include "hw/usb/usb-hcd.h"
-#include "hw/usb/hcd-ehci.h"
#include "hw/ppc/fdt.h"
#include "hw/qdev-properties.h"
#include "hw/pci/pci.h"
@@ -11,6 +11,7 @@
#include "qemu/osdep.h"
#include "hw/usb/hcd-ehci.h"
+#include "hw/usb/usb-hcd.h"
#include "hw/usb/chipidea.h"
#include "qemu/log.h"
#include "qemu/module.h"
@@ -18,6 +18,7 @@
#include "qemu/osdep.h"
#include "hw/qdev-properties.h"
#include "hw/usb/hcd-ehci.h"
+#include "hw/usb/usb-hcd.h"
#include "migration/vmstate.h"
#include "qemu/module.h"
Various machine/board/soc models create EHCI 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 <balaton@eik.bme.hu> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> --- hw/usb/hcd-ehci.h | 11 +---------- include/hw/usb/chipidea.h | 2 +- include/hw/usb/usb-hcd.h | 11 +++++++++++ hw/arm/allwinner-h3.c | 1 - hw/arm/exynos4210.c | 2 +- hw/arm/sbsa-ref.c | 3 ++- hw/arm/xilinx_zynq.c | 2 +- hw/ppc/sam460ex.c | 1 - hw/usb/chipidea.c | 1 + hw/usb/hcd-ehci-sysbus.c | 1 + 10 files changed, 19 insertions(+), 16 deletions(-)