#
✕ nick:sven
#asahi-dev · 2021-11-28 17:53
svenwhat bad does looks good fwiw. I’d start from there and get that working first
#asahi-dev · 2021-11-28 17:51
svenor maybe first start with a driver that polls and only add interrupts later
#asahi-dev · 2021-11-28 17:47
svenbsd also doesn’t seem to use interrupts there and doing it that way might just work out
#asahi-dev · 2021-11-28 17:46
svenI don’t know what the hw does in this case
#asahi-dev · 2021-11-28 17:45
svenspi cannot receive without also transmitting something
#asahi-dev · 2021-11-28 17:45
svenso?
#asahi-dev · 2021-11-28 17:42
svenit should really be fill N bytes to tx fifo, trigger xfer, read N bytes from rx fifo
#asahi-dev · 2021-11-28 17:42
svenmy first bet is the rx/tx fifo handling
#asahi-dev · 2021-11-28 15:18
sventwo more weeks of work and my xmas vacation starts. i should be able to just get it done then :-)
#asahi-dev · 2021-11-28 15:18
svenworking on the rtkit part right now
#asahi-dev · 2021-11-28 15:17
sventhough at this point it actually wouldn't have been that bad. for some reason i assumed that nvme was going to be much more complex than it actually is
#asahi-dev · 2021-11-28 15:16
sventhat's why i never wrote nvme.py :D
#asahi-dev · 2021-11-28 15:14
svenbecause you write to STATUS anyway in the irq handler and just ack everything
#asahi-dev · 2021-11-28 15:14
svenoh, no
#asahi-dev · 2021-11-28 15:13
svendoes it not keep firing the interrupt if you keep that bit enabled?
#asahi-dev · 2021-11-28 15:04
sven:>
#asahi-dev · 2021-11-28 15:03
sven:D
#asahi-dev · 2021-11-28 15:02
svenand the xfer would be complete if you read from the RX fifo and don't have any more bytes to send
#asahi-dev · 2021-11-28 15:02
svenand then in the interrupt probably first see if you can read from the RX fifo and then try to fill the TX fifo again
#asahi-dev · 2021-11-28 15:01
sveni dunno how this hardware works but SPI is probably slow i'd expect that at first you just fill the TX fifo, start the xfer and then wait for an interrupt
#asahi-dev · 2021-11-28 14:57
sveni'd expect something like "fill TX fifo, start xfer, read from RX fifo"
#asahi-dev · 2021-11-28 14:56
svenit maybe works because at first the RX fifo will always be empty but then the call to apple_spimc_drain_rx is probably not required?
#asahi-dev · 2021-11-28 14:56
sventhe controller needs to know what to send before it can receive anything
#asahi-dev · 2021-11-28 14:55
svenbut how can it do that when you read first?
#asahi-dev · 2021-11-28 14:55
svenSPI always sends and receives data at the same time
#asahi-dev · 2021-11-28 14:54
svenuh
#asahi-dev · 2021-11-28 14:53
svenlooks like it always first receives everything before writing everything?
#asahi-dev · 2021-11-28 14:53
svenhrm, spi is also technically full duplex but i dunno how that works with the spi subssytem or that driver
#asahi-dev · 2021-11-28 14:48
svenlooks good otherwise!
#asahi-dev · 2021-11-28 14:47
svenmaybe also add a check to apple_spimc_irq to ensure there actually is an xfer in progress and return IRQ_NONE otherwise
#asahi-dev · 2021-11-28 14:46
svenyou can probably even get rid of spi->clk then completely
#asahi-dev · 2021-11-28 14:45
svenfeel free to squash in https://f.svpe.de/4eae0bf083999e3028280f7e374b2fd1ca02a915e730cc802b9c1d00fdf4106c_0001-spi-review.patch untested, but compiles and should work
#asahi-dev · 2021-11-28 14:44
svenit might be. if it is i'd just add a comment about that
#asahi-dev · 2021-11-28 14:43
svendidn't see that
#asahi-dev · 2021-11-28 14:43
svenah.. true
#asahi-dev · 2021-11-28 14:39
svenand do you know why you need to read and then write REG_STATUS? does that ack an irq or something?
#asahi-dev · 2021-11-28 14:39
svenj_ey: it's a bit weird that the irq is started by setting REG_CONFIG_IE_TXEMPTY but never stopped. does that happen automatically?
#asahi-dev · 2021-11-26 20:04
sven0 it power off, 0x20 is power on (and so is 0x220 which seems to be the same). 0x10 is some kind of hibernation or sleep mode. no idea yet about 1 or 2 (or maybe 3; need to double check tomorrow) or what that flag means
#asahi-dev · 2021-11-26 20:04
sventhe rtkit protocol seems to have at least the following power states: 0, 1, 2, maybe 3, 0x10, 0x20 and i think you can set an additional flag (0x200) for some of them which does $something while it's ignored for others
#asahi-dev · 2021-11-24 18:39
svenand 0x7 is the ack for 0x6 and ofc 0xb is the ack for 0xb because who needs consistency anyway
#asahi-dev · 2021-11-24 18:37
svenI guess that makes 0x6 “set iop power state” then
#asahi-dev · 2021-11-24 18:36
svenokay, Rtkit command 0xb very likely is “set AP power state”. If you send it with the same state twice rtkit will crash with a message along the lines of “Invalid AP power state”
#asahi-dev · 2021-11-24 16:04
svenand the usb curse strikes again!
#asahi-dev · 2021-11-24 16:04
svenlol
#asahi-dev · 2021-11-24 08:12
svenhuh, onboard audio sounds like something unrelated breaking as well
#asahi-dev · 2021-11-24 08:11
sventhat's when macOS triggers the dwc3 reset in the atc phy
#asahi-dev · 2021-11-24 08:11
svensleep should also fix
#asahi-dev · 2021-11-24 08:06
svenas much as i hate the reset hack i'm kinda convinced it's just necessary for this cursed controller at this point
#asahi-dev · 2021-11-24 08:05
svenwhile i can reproduce the device mode fail reliably now
#asahi-dev · 2021-11-24 08:05
sveni just don't know how to provoke that yet

plus ›