Repository navigation
PlayStation 2 SMAP Ethernet driver - #2
Merged
Merged
Conversation
The SMAP part of the SPEED chip in the PlayStation 2 expansion bay is an IBM EMAC3 MAC with a National DP83846 PHY on MII address 1, a 4 KiB TX FIFO, a 16 KiB RX FIFO and two rings of 64 buffer descriptors, all memory-mapped at physical 0x14000000 on the EE side. The window answers once the DEV9 expansion bay is powered; the driver checks that through the IOP before it touches the window, because an unpowered bay turns every EE access into a data bus error. The register layout, the FIFO and buffer-descriptor protocol, the EMAC3 defaults and the EEPROM bit-bang sequence come from Sony's driver in the PlayStation 2 Linux kit, linux-2.4.17/drivers/ps2/smap.c, GPL v2. The driver structure is new for 5.4: net_device_ops, NAPI, and phylib with its own MDIO bus instead of the original link-check thread. Data moves by programmed I/O, 32-bit accesses through a bounce buffer because skb data is only 2-byte aligned. The IOP-side DMA of the original driver is not ported. Measured on an SCPH-30004 over TCP with SSH on top: 2.4 MB/s transmit and 1.4 MB/s receive, sustained over 300 MB. The three SPEED interrupts reach the EE through the IOP interrupt relay. Because the SPEED interrupt mask register belongs to the IOP, the driver never touches it and acknowledges its sources through SMAP_INTR_CLR, as the original did. It also clears TXDNV and RXDNV, which the IOP side does not acknowledge; left standing they keep the interrupt line asserted and the interface stops receiving interrupts under load. A poll parameter selects interrupt mode with a polling fallback (default), interrupts only, or polling only. The fallback exists because the interrupt relay for a bay device had never been exercised, and an interrupt-only driver that stays silent says nothing about whether the data path works. Signed-off-by: Hubert Wyrzykiewicz <h.wyrzyk@gmail.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Add the platform device the SMAP driver binds to: the 16 KiB SPEED register window at physical 0x14000000, which holds the registers, both FIFO data ports and the two buffer descriptor rings, and the three interrupts relayed from the IOP, named rx, tx and emac3 so the driver does not depend on their order. Enable the driver as a module in ps2_defconfig. Signed-off-by: Hubert Wyrzykiewicz <h.wyrzyk@gmail.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Owner
Author
|
Verified on hardware. Cold boot from this branch on an SCPH-30004: The module is in-tree - 30 MB transmit in 14.0 s (2.25 MB/s), matching the out-of-tree build, with no Two things this branch got wrong before it worked, both worth recording:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Staging pull request inside my own fork - not aimed at
frno7/linux. Opened here so the diff can be read without touching upstream.Base is
ps2-dev9-power-up, notps2-main, and that is deliberate: the driver refuses to load on a kernel whoseiop-dev9does not power the expansion bay. Built on plainps2-mainit fails withso this work sits on top of the two DEV9 fixes.
What it does
net: ps2: Add PlayStation 2 SMAP Ethernet driver-drivers/net/ethernet/ps2/with its own Kconfig and Makefile, wired intodrivers/net/ethernet/{Kconfig,Makefile}. EE-side port of Sony'slinux-2.4.17/drivers/ps2/smap.c(GPL v2) onto 5.4:net_device_ops, NAPI, phylib with its own MDIO bus, MAC read from the EEPROM. Programmed I/O through a bounce buffer; the IOP-side DMA of the original is not ported.MIPS: PS2: Register the SMAP Ethernet device- the platform device the driver binds to, plusCONFIG_PS2_SMAP=minps2_defconfig.The chip window is shared with the ATA registers at
IOP_PATA_BASE, so the device declares the two ranges SMAP actually uses rather than the whole window. Claiming all of it collides with the ATA device registered a few lines earlier, and the SMAP device then never registers at all. On hardware:Hardware results
SCPH-30004 (PAL, ROM 0150), adapter in the expansion bay, same driver source built out of tree:
pata_ps2loaded at the same timeKnown gaps
checkpatchreports 0 errors and 47 style warnings, mostly networking block-comment style and long lines.🤖 Generated with Claude Code