frno7 / linux

Linux 2.2, 2.6, 3.x, 4.x and 5.x kernels for the PlayStation 2.
Other
84 stars 5 forks source link

Enable the i.LINK (Firewire) device #24

Open frno7 opened 5 years ago

frno7 commented 5 years ago

Implement a device driver for the i.LINK, also known as FireWire, hardware found in the PlayStation 2 models SCPH-10000 to 3900x.

See also #11.

sp193 commented 5 years ago

The i.Link controller's registers are not IEEE1394-compliant. The official PS2Linux had no support for it either. There will be a need to reverse-engineer code and to write a custom driver.

frno7 commented 5 years ago

I have been informed that there are similarities with a LSI 1394 Lead Vehicle design, and that it defaults to BE byte order rather than LE as is appropriate for the PlayStation 2. The DMAC registers are possibly different.

sp193 commented 5 years ago

It's nearly exactly the same as the controller from the LSI Lead Vehicle. That's where we got the documentation for controlling it from, but it doesn't describe how to write a driver that is compliant with IEEE1394. As such, the homebrew i.Link driver is very unreliable and incomplete. A new copy of the Sony ILINK.IRX module may be a better choice. I've been doing that since 2012, but haven't completed it.

Our controller has slightly different registers (e.g. watermark, DBUF FIFO size registers do not work, while there is an extra control register at 0xBF80847C). i.Link has its own DMAC, which is the undocumented 3rd DMAC. Only Konami seems to have used it. Thankfully, Sony implemented logic for automatic responses, but somehow there seems to be byte-swapping always enabled. I think it may still work well if a PS2 communicates with another PS2, but this can be a problem if the PS2 communicates with another non-PS2 IEEE1394 host.

DMAC3 has its own DPCR3 and DICR3 registers. Of the three DMA channels, 13, 14 and 15, only 14 and 15 seem capable of Automatic Responses. 13 seemed to be a unidirectional channel for PHT0. 15 is for PHT1, while I think 14 is for PHT0. Unlike the LSI Lead Vehicle's DMAC, all 3 channels share the same DMA range registers. The Reference Tag Address Registers (RTAR) use the same format as the LSI Lead Vehicle, according to Silverbull.

As the LSI Lead Vehicle documentation suggests, the exact capabilities of the DMA channel, depends on the controller.

The USB OHCI controller documentation there seems to be an exact match with the one we have, from what I know.