#asahi · 2021-09-17 12:06
svenyeah, that's why it works. i originally didn't know why it broke when i used write32 :D#asahi · 2021-09-17 12:05
sveniirc i only use set32/clear32 in the driver#asahi · 2021-09-17 12:05
sventhat bit is already set there#asahi · 2021-09-17 12:05
svenno#asahi · 2021-09-17 12:04
svensure#asahi · 2021-09-17 12:04
svenif you need extra motivation: once i know what that bit does i can probably submit the first version of the i2c driver#asahi · 2021-09-17 12:03
sven:)#asahi · 2021-09-17 12:01
sven(without that i can't talk to the PD chip)#asahi · 2021-09-17 12:01
svenif you want to hook up something to an oscilloscope anyway: would also be nice to figure out what bit 0x800 in REG_CTL of the i2c controller does :>#asahi · 2021-09-17 12:00
svenlol#asahi · 2021-09-17 11:23
svenand if it's possible to do this in a saner way#asahi · 2021-09-17 11:23
svenbut i want to understand _why_#asahi · 2021-09-17 11:23
svensure, that already works#asahi · 2021-09-17 11:19
svenor if apple just published "ATC PHY Technical Reference Manual.pdf" :p#asahi · 2021-09-17 11:17
sveni think it might be possible to do without a reset by manually faking the "new device" event in xhci#asahi · 2021-09-17 11:17
svenyeah, that's what's so strange#asahi · 2021-09-17 11:17
sventhe "half broken xhci/dwc" state is probably just because i do a partial PHY reset#asahi · 2021-09-17 11:16
svenbut i have no clue what that might be#asahi · 2021-09-17 11:16
svenmy best guess that it's something in the PHY that goes wrong#asahi · 2021-09-17 11:15
svenme neither :/#asahi · 2021-09-17 11:15
svenno idea. this whole thing makes no sense to me#asahi · 2021-09-17 11:15
svenbut ugh.#asahi · 2021-09-17 11:15
sveni suspect it *may* be possible to just manually inject a "new device connected" into xhci to make this work#asahi · 2021-09-17 11:14
svenmacos works fine#asahi · 2021-09-17 11:14
sventhat's certainly what mac os uses to trigger the reinitialization#asahi · 2021-09-17 11:13
svenwhat's weird though: if you put a usb-c -> usb-a adapter inbetween reconnecting the usb-a side works just fine#asahi · 2021-09-17 11:12
svenyeah#asahi · 2021-09-17 11:12
svenoh. yes.#asahi · 2021-09-17 11:12
svenit's broken at that point#asahi · 2021-09-17 11:12
svenit just starts printing "new device" every 5s or so#asahi · 2021-09-17 11:12
svendottedmag: no. it won't recognize any device#asahi · 2021-09-17 11:10
svenit's just easier to reproduce in device mode because i have driver for that in m1n1#asahi · 2021-09-17 11:10
sven^-- like that#asahi · 2021-09-17 11:10
sven[ 11.404222] usb 3-1: new high-speed USB device number 4 using xhci-hcd#asahi · 2021-09-17 11:10
sven[ 5.547529] usb 3-1: new high-speed USB device number 3 using xhci-hcd#asahi · 2021-09-17 11:10
svenbut sometimes it then starts detecting a new device every ~5s or so#asahi · 2021-09-17 11:09
svenit works most of the time#asahi · 2021-09-17 11:08
sventhat's where it switched back from device to host#asahi · 2021-09-17 11:08
sven[cpu0] [Dwc3Tracer@/arm-io/usb-drd1] MMIO: W.4 GCTL = 0x691006 (U2RSTECN=1, PRTCAP=1, CORESOFTRESET=0, SOFITPSYNC=0, SCALEDOWN=0, DISSCRAMBLE=0, U2EXIT_LFPS=1, GBLHIBERNATIONEN=1, DSBLCLKGTNG=0)#asahi · 2021-09-17 11:08
sven[cpu0] [Dwc3Tracer@/arm-io/usb-drd1] MMIO: R.4 GCTL = 0x692006 (U2RSTECN=1, PRTCAP=2, CORESOFTRESET=0, SOFITPSYNC=0, SCALEDOWN=0, DISSCRAMBLE=0, U2EXIT_LFPS=1, GBLHIBERNATIONEN=1, DSBLCLKGTNG=0)#asahi · 2021-09-17 11:07
sventhat entire sequence repeats everytime i plug and unplug my usb storage device#asahi · 2021-09-17 11:06
svenhttps://f.svpe.de/79c6990c3294421add7b55d38edf20e6b20b4651f6a6b623be1276bcd8bb88ac_atc_hotplug.txt#asahi · 2021-09-17 11:04
svenso we can kind abuse that path to also do it for host -> none -> host transitions#asahi · 2021-09-17 11:04
sveni can hack this in linux because dwc3 as dual role support and already supports reinitializing the entire thing when transitioning from host -> device#asahi · 2021-09-17 11:03
svenyeah. it's ugly :(#asahi · 2021-09-17 11:00
svenmore usb fun: doing the full phy reset sequence macos does put the dwc core back into device mode even it was in host mode. looks like we'll actually have to tear down xhci and start it back up again whenever something is hotplugged :( (luckily that's like 10 lines changed in the linux dwc3 driver, but ugh)#asahi · 2021-09-17 06:34
sveneasier in device mode where it'll suddenly get spammed with USBReset events#asahi · 2021-09-17 06:34
svenmarcan: yup, that's what i assume as well at this point. especially because i can sometimes get it into a weird state if i just reset the PHY#asahi · 2021-09-16 18:18
svenjust resetting the port in the PHY doesn't always work#asahi · 2021-09-16 18:18
svenand it looks like that may be required :(