Page MenuHomeFreeBSD

Add dwc_otg_acpi
ClosedPublic

Authored by val_packett.cool on Jun 9 2020, 9:26 PM.
Tags
Referenced Files
F81577456: D25203.diff
Thu, Apr 18, 9:36 AM
F81530474: D25203.diff
Wed, Apr 17, 3:23 PM
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
Subscribers

Details

Summary

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: https://github.com/tianocore/edk2-platforms/blob/2d07a49e45326a56354167061390deba526b3c70/Platform/RaspberryPi/AcpiTables/GpuDevs.asl#L13-L33

Test Plan

RPi:

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 (https://www.FreeBSD.org) 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 (https://www.FreeBSD.org) 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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

val_packett.cool added inline comments.
sys/dev/usb/controller/dwc_otg_acpi.c
4 ↗(On Diff #72894)

(@hselasky ok to drop all rights reserved?)

andrew added inline comments.
sys/dev/usb/controller/dwc_otg_acpi.c
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.

val_packett.cool added inline comments.
sys/dev/usb/controller/dwc_otg_acpi.c
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.

sys/dev/usb/controller/dwc_otg_acpi.c
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.