Page MenuHomeFreeBSD

Add dwc_otg_acpi

Authored by on Jun 9 2020, 9:26 PM.
Referenced Files
Unknown Object (File)
Mar 12 2024, 6:24 PM
Unknown Object (File)
Feb 10 2024, 8:17 PM
Unknown Object (File)
Feb 10 2024, 8:17 PM
Unknown Object (File)
Feb 10 2024, 8:17 PM
Unknown Object (File)
Feb 10 2024, 8:17 PM
Unknown Object (File)
Feb 10 2024, 12:41 AM
Unknown Object (File)
Feb 8 2024, 9:53 PM
Unknown Object (File)
Jan 20 2024, 5:55 AM



The Raspberry Pi 4 uses XHCI for all host USB ports, however the DWC OTG is still present and is now responsible for the Type-C port, always in device mode.

This adds support for it in ACPI mode. The code is based on dwc_otg_fdt, simplified (only one interrupt, always device mode).

ACPI table:

Test Plan


dwcotg0: <DWC OTG 2.0 integrated USB controller> iomem 0xfe980000-0xfe98ffff irq 1 on acpi0
usbus1 on dwcotg0
usbus1: 480Mbps High Speed USB v2.0
ugen1.1: <DWCOTG OTG Root HUB> at usbus1
uhub1 on usbus1
uhub1: <DWCOTG OTG Root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus1
ugen1.2: <Unknown > at usbus1 (disconnected)
uhub_reattach_port: could not allocate new device
usb_alloc_device: setting up USB template failed - usb_template(4) not loaded?
# (seems to spam ^this^ a bit when I don't have a template specified — hopefully only when plugged into a computer, not a plain power supply :D)
ugen1.2: <The FreeBSD Project ( USB Ethernet Adapter> at usbus1
cdce0 on uhub1
cdce0: <USB Ethernet Comm Interface> on usbus1
ue0: <USB Ethernet> on cdce0

Host (MACCHIATObin):

[30260] ugen2.10: <The FreeBSD Project ( USB Ethernet Adapter> at usbus2
[30260] cdce0 on uhub3
[30260] cdce0: <USB Ethernet Comm Interface> on usbus2
[30260] ue1: <USB Ethernet> on cdce0

Diff Detail

rS FreeBSD src repository - subversion
Lint Skipped
Tests Skipped

Event Timeline added inline comments.

(@hselasky ok to drop all rights reserved?)

andrew added inline comments.

This indentation looks wrong


It looks like most of this could move to dwc_otg_init as it's common between the two existing callers and this.


The generic DEVMETHODs should move to the base class. added inline comments.

It's interleaved with slightly different things (mode, irq rid) but I'll move everything below the sc_irq_res assignment, sure


There's no base class, dwc_otg only exports functions. I'm not sure it's worth creating just for three generic methods.


Yes, no problem.

alright, moved the common things into the common init, and it even works (on acpi)

This revision was not accepted when it landed; it landed in state Needs Review.Jun 30 2020, 3:58 PM
Closed by commit rS362803: Add dwc_otg_acpi (authored by andrew). · Explain Why
This revision was automatically updated to reflect the committed changes.