Page MenuHomeFreeBSD

Add dwc_otg_acpi
ClosedPublic

Authored by val_packett.cool on Jun 9 2020, 9:26 PM.
Tags
Referenced Files
Unknown Object (File)
Thu, Nov 7, 4:56 AM
Unknown Object (File)
Mon, Oct 28, 10:32 PM
Unknown Object (File)
Tue, Oct 22, 5:15 AM
Unknown Object (File)
Sat, Oct 19, 9:06 AM
Unknown Object (File)
Oct 12 2024, 9:10 AM
Unknown Object (File)
Oct 7 2024, 12:37 PM
Unknown Object (File)
Oct 6 2024, 12:36 PM
Unknown Object (File)
Oct 1 2024, 4:28 PM
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 Skipped
Unit
Tests Skipped

Event Timeline

val_packett.cool added inline comments.
sys/dev/usb/controller/dwc_otg_acpi.c
4

(@hselasky ok to drop all rights reserved?)

andrew added inline comments.
sys/dev/usb/controller/dwc_otg_acpi.c
81

This indentation looks wrong

89

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

The generic DEVMETHODs should move to the base class.

val_packett.cool added inline comments.
sys/dev/usb/controller/dwc_otg_acpi.c
89

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

195–197

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

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.