Skip to content

RFC usb/uhci: Add UHCI sysbus support, and enable for AST machines

Guenter Roeck qemu-arm qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest0 of 8 patches 1 replyIn review

Changes since RFC from the cover letter

- Rebased to v9.1.0-1673-g134b443512
- Added Reviewed-by: tags
- Fixed bug in interrupt initialization of vt82c686-uhci-pci.c which if instantiated caused a machine crash
- Instantiate UHCI controllers as companion devices on AST2600 machines

Patches in v1 No applies recorded yet

None of the 8 patches the cover letter announces are in this archive.

Reviews trailers per patch

PatchCédric Le Goater
SeriesR-b R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC PATCH 0/8] usb/uhci: Add UHCI sysbus support, and enable for AST machines

Some machines (like Aspeed ARM) only support a sysbus UHCI controller. The current UHCI implementation in qemu only supports PCI based UHCI controllers.

This patch series separates basic and PCI functionality from the hcd-uhci implementation and then adds uhci-sysbus support. This is then used to implement and enable sysbus based UHCI support for Aspeed machines.

The series is submitted as RFC since I am quite sure that I didn't get everything right. All code surrounding VMStates deserves special scrutiny, as well as the changes outside hw/usb/ and hw/arm/.

A side effect of this patch series is that Aspeed AST2400/2500 machines will now instantiate UHCI, even if the machine does not actually support it (it also always instantiates both EHCI ports, so that is not really different). This means that the default USB bus is now the UHCI bus, not the second EHCI bus. The bus number must therefore now be specified explicitly when attaching a device unless attaching it to the UHCI port is ok. I don't know if it is possible to avoid that and to ensure that the default USB port is still the second EHCI port.

The code was tested on x86 machines to ensure that the existing UHCI implementation still works. It was also tested on various Aspeed machines with enabled UHCI ports (ast2500-evb, ast2600-evb, and rainier-bmc).

Changes since RFC:
- Rebased to v9.1.0-1673-g134b443512
- Added Reviewed-by: tags
- Fixed bug in interrupt initialization of vt82c686-uhci-pci.c which if instantiated caused a machine crash
- Instantiate UHCI controllers as companion devices on AST2600 machines

----------------------------------------------------------------
Guenter Roeck (10):
usb/uhci: checkpatch cleanup
usb/uhci: Introduce and use register defines usb/uhci: Move PCI-related code into a separate file usb/uhci: enlarge uhci memory space usb/uhci: Add support for usb-uhci-sysbus usb/uhci: Add aspeed specific read and write functions
aspeed: Add uhci support for ast2600
aspeed: Add uhci support for ast2400 and ast2500
usb-hub: Add support for v2.0 hubs
usb-hub: Fix handling port power control messages

 hw/arm/Kconfig                |   1 +
 hw/arm/aspeed_ast2400.c       |  14 ++
 hw/arm/aspeed_ast2600.c       |  20 +++
 hw/isa/Kconfig                |   4 +-
 hw/isa/vt82c686.c             |   4 +-
 hw/usb/Kconfig                |  10 +-
 hw/usb/dev-hub.c              |  85 ++++++++++-
 hw/usb/hcd-uhci-pci.c         | 255 ++++++++++++++++++++++++++++++++
 hw/usb/hcd-uhci-pci.h         |  63 ++++++++
 hw/usb/hcd-uhci-sysbus.c      | 202 +++++++++++++++++++++++++
 hw/usb/hcd-uhci-sysbus.h      |  34 +++++
 hw/usb/hcd-uhci.c             | 337 +++++++++++++-----------------------------
 hw/usb/hcd-uhci.h             |  30 ++--
 hw/usb/meson.build            |   2 +
 hw/usb/vt82c686-uhci-pci.c    |  18 +--
 include/hw/arm/aspeed_soc.h   |   3 +
 include/hw/southbridge/piix.h |   4 +-
 include/hw/usb/uhci-regs.h    |  11 ++
 18 files changed, 822 insertions(+), 275 deletions(-)
 create mode 100644 hw/usb/hcd-uhci-pci.c
 create mode 100644 hw/usb/hcd-uhci-pci.h
 create mode 100644 hw/usb/hcd-uhci-sysbus.c
 create mode 100644 hw/usb/hcd-uhci-sysbus.h