#
✕ nick:sven
#asahi-dev · 2022-11-17 13:00
svencore_exit also asserts the hard reset line
#asahi-dev · 2022-11-17 13:00
svendwc3_core_exit does that, yes
#asahi-dev · 2022-11-17 13:00
svenah.. so that's what linux does on suspend
#asahi-dev · 2022-11-17 13:00
sven dwc3_core_exit(dwc);
#asahi-dev · 2022-11-17 13:00
sven if (!PMSG_IS_AUTO(msg) && !device_may_wakeup(dwc->dev)) {
#asahi-dev · 2022-11-17 12:59
svenmaybe I misremember but I think dwc3 actually removes the xhci device on suspend
#asahi-dev · 2022-11-17 12:58
sveni'm re-using that code to also shut it down when switching to USB_ROLE_NONE
#asahi-dev · 2022-11-17 12:58
svendwc3 definitely shuts down on suspend
#asahi-dev · 2022-11-17 12:57
sventhat tipd thing is doing a lot of the heavy lifting for us :D
#asahi-dev · 2022-11-17 12:57
sveni probably won't get around to fixing suspend/resume but you can probably hack it by issuing tps_disconnect in the tipd suspend handler and tps_connect in the resume handler
#asahi-dev · 2022-11-17 12:56
svenlol
#asahi-dev · 2022-11-17 12:55
svenlike, where's the fun if nothing breaks in something called bleeding edge :D
#asahi-dev · 2022-11-17 12:55
sven+if
#asahi-dev · 2022-11-17 12:55
sveni would be disappointed that wouldn't be happening on -edge!
#asahi-dev · 2022-11-17 12:37
svenprobably makes sense to change it to something like "you'll probably have to replug the connector to make it work"
#asahi-dev · 2022-11-17 12:36
svenyup, that message is a bit older when that was still true :D
#asahi-dev · 2022-11-17 12:36
svenyeah, as expected
#asahi-dev · 2022-11-17 12:36
svenat least whatever happens doesn't break it without a reboot. getting *that* correct was truly annoying
#asahi-dev · 2022-11-17 12:35
svenplus maybe tipd also triggers something? dunno
#asahi-dev · 2022-11-17 12:33
svenbut I guess what might happen is dwc3 shutdown -> pipehandler to dummy -> resume -> pipehandler to usb3 -> dwc3 init and it may not like that without a atcphy reinit inbetween
#asahi-dev · 2022-11-17 12:32
svenI don't really know without looking at the code how exactly the resume part is triggered
#asahi-dev · 2022-11-17 12:32
svenI need to rework the way that order is ensured for altmode anyway and I'll see how to enforce it with suspend as well
#asahi-dev · 2022-11-17 12:25
svenusually as long as first dwc3 shuts down and then atcphy and as long as first atcphy is configured again and only then dwc3 starts everything should work
#asahi-dev · 2022-11-17 12:23
sven*with
#asahi-dev · 2022-11-17 12:23
svenwithout suspend/resume you can probably hit some edge cases it doesn't like
#asahi-dev · 2022-11-17 12:23
svenwithout suspend/resume that's guaranteed
#asahi-dev · 2022-11-17 12:23
svenprobably atcphy being unstable as usual if you don't do certain things in just the right order
#asahi-dev · 2022-11-17 11:28
svenit works as long as nothing unexpected like suspend/resume happens :D
#asahi-dev · 2022-11-17 11:27
sventhat's part of a slightly fragile setup that orders dwc3 shutdown vs. mux shutdown
#asahi-dev · 2022-11-17 11:27
svennot surprised that happens after suspend/resume
#asahi-dev · 2022-11-17 11:15
svenoh well, let's see what I can figure out by just poking those chips and observing the interrupt status
#asahi-dev · 2022-11-17 11:14
sventhe original TPS chips also have some external flash read commands and it wouldn't surprise me if there's also hidden "read RAM" commands. but those don't exist anymore on the apple variant
#asahi-dev · 2022-11-17 11:12
svenugh. it's a pity apple had to move around essentially all interrupt bits. the rest matches up very nicely
#asahi-dev · 2022-11-17 11:11
svenI saw those addons but they're more or less useless without the ROM
#asahi-dev · 2022-11-17 11:11
svenyeah, that's what I assume as well
#asahi-dev · 2022-11-17 11:11
sveni need to figure out some interrupt bits (mode discovery completed, etc.) which might be easier by just looking at the fw
#asahi-dev · 2022-11-17 11:10
svenmarcan: have you ever dumped the cd321x firmware when looking into those USB PD commands?
#asahi-dev · 2022-11-17 10:16
svenneed to split that up into individual bits as well. just some busywork with the HV and XNU's debug log
#asahi-dev · 2022-11-17 10:15
sventhere are also three or so writel left which just configure an entire register to some constant value
#asahi-dev · 2022-11-17 10:14
svenI just didn't get around to those values yet
#asahi-dev · 2022-11-17 10:14
sventhe whole driver started with literally everything hardcoded
#asahi-dev · 2022-11-17 10:14
svenyeah, i'll just have to figure out where it gets them from eventually. chances are it's just some of the previous MMIO reads
#asahi-dev · 2022-11-17 10:11
sven<3 LANE1_AUSPMA_RX_TOP_TJ_BLK_PMAFSM_REG4_PCS_PMAFSM_REQ
#asahi-dev · 2022-11-17 10:11
svenyou need to set the _OV to actually override the signal
#asahi-dev · 2022-11-17 10:11
svenmost of the phy regs come in pairs. you have WHATEVER and WHATEVER_OV
#asahi-dev · 2022-11-17 10:10
svenit's already shortened from what XNU calls it
#asahi-dev · 2022-11-17 10:09
svenit does that on t8103 as well if you switch to USB3+DP or DP-only
#asahi-dev · 2022-11-17 10:09
sven:D
#asahi-dev · 2022-11-17 10:08
svenI missed that originally
#asahi-dev · 2022-11-17 10:08
svenyes

plus ›