This patch series adds emulation for the dwc-hsotg USB controller, which is used on the Raspberry Pi 3 and earlier, as well as a number of other development boards. The main benefit for Raspberry Pi is that this enables networking on these boards, since the network adapter is attached via USB.
The emulation is working quite well, I have tested with USB network, mass storage, mouse, keyboard, and tablet. I have tested with the dwc2 driver in the upstream Linux kernel, and with the dwc-otg driver in the Raspbian kernel. One remaining issue is that USB redirection does not work, I tried connecting to a USB stick on the host, but the device generates babble errors and does not work. I will continue to work on this issue. The patch series also includes a very basic emulation of the MPHI device on the Raspberry Pi SOC, which provides the FIQ interrupt that is used by the dwc-otg driver in the Raspbian kernel. But that driver still does not work in full FIQ mode, so it is necessary to add a parameter to the kernel command line ("dwc_otg.fiq_fsm_enable=0") to make it work. I have used some on-line sources of information while developing this emulation, including: http://www.capital-micro.com/PDF/CME-M7_Family_User_Guide_EN.pdf has a pretty complete description of the controller starting on page 370. https://sourceforge.net/p/wive-ng/wive-ng-mt/ci/master/tree/docs/DataSheets/RT3050_5x_V2.0_081408_0902.pdf has a description of the controller registers starting on page 130. Changes from v1: - Fixed checkpatch errors/warnings, except for dwc2-regs.h since that is a direct import from the Linux kernel. - Switched from debug printfs to tracepoints in hcd-dwc2.c, on the advice of Gerd. I just dropped the debug prints in bcm2835_mphi.c, since I didn't consider them very useful. - Updated a couple of the commit messages with more info. Thanks for your time, Paul --- Paul Zimmerman (6): Add BCM2835 SOC MPHI emulation dwc-hsotg USB host controller register definitions dwc-hsotg USB host controller state definitions dwc-hsotg USB host controller emulation Add short-packet handling to usb-storage driver Wire in the dwc-hsotg USB host controller emulation hw/arm/bcm2835_peripherals.c | 38 +- hw/misc/Makefile.objs | 1 + hw/misc/bcm2835_mphi.c | 193 ++++ hw/usb/Kconfig | 5 + hw/usb/Makefile.objs | 1 + hw/usb/dev-storage.c | 15 +- hw/usb/hcd-dwc2.c | 1301 ++++++++++++++++++++++++++ hw/usb/hcd-dwc2.h | 180 ++++ hw/usb/trace-events | 47 + include/hw/arm/bcm2835_peripherals.h | 5 +- include/hw/misc/bcm2835_mphi.h | 50 + include/hw/usb/dwc2-regs.h | 895 ++++++++++++++++++ 12 files changed, 2728 insertions(+), 3 deletions(-) create mode 100644 hw/misc/bcm2835_mphi.c create mode 100644 hw/usb/hcd-dwc2.c create mode 100644 hw/usb/hcd-dwc2.h create mode 100644 include/hw/misc/bcm2835_mphi.h create mode 100644 include/hw/usb/dwc2-regs.h -- 2.17.1