Page MenuHomeFreeBSD

Add dwc_otg_acpi

Authored by on Jun 9 2020, 9:26 PM.
Referenced Files
Unknown Object (File)
Thu, May 30, 5:05 PM
Unknown Object (File)
Sat, May 25, 11:53 PM
Unknown Object (File)
Sat, May 25, 11:46 PM
Unknown Object (File)
Sat, May 25, 10:39 PM
Unknown Object (File)
May 3 2024, 7:05 PM
Unknown Object (File)
May 1 2024, 5:44 PM
Unknown Object (File)
May 1 2024, 5:14 AM
Unknown Object (File)
Apr 21 2024, 2:25 PM



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 Not Applicable
Tests Not Applicable

Event Timeline added inline comments.
4 ↗(On Diff #72894)

(@hselasky ok to drop all rights reserved?)

andrew added inline comments.
81 ↗(On Diff #72894)

This indentation looks wrong

89 ↗(On Diff #72894)

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

195–197 ↗(On Diff #72894)

The generic DEVMETHODs should move to the base class. added inline comments.
89 ↗(On Diff #72894)

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

195–197 ↗(On Diff #72894)

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

4 ↗(On Diff #72894)

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.