Page MenuHomeFreeBSD

Add support for bcm54213PE in brgphy.
ClosedPublic

Authored by crowston_protonmail.com on Jun 13 2020, 12:25 AM.

Details

Summary

This chip is used in the Rasperry Pi 4, and is supported by the if_genet
driver. Currently we use the ukphy mii driver, this patch switches over
to the brgphy mii driver instead. To support the rgmii-rxid phy mode,
which is now the default in the Linux dtb, we add support for clock
skewing.

These changes are taken from OpenBSD and NetBSD, except for the bailout
in brgphy_bcm54xx_clock_delay() in rgmii mode, which I found necessary
after testing.

Test Plan

I tested this on a Raspberry Pi 4, 8 GB model, with two dtbs. One dtb was the latest dtb with the rgmii-rxid phy mode, the other was an older dtb with the rgmii phy mode. I transfered some data over a local network with iperf3 and also sent a few hundred pings to a remote server.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

karels added inline comments.
sys/arm64/broadcom/genet/if_genet.c
318 ↗(On Diff #73055)

Did you experiment with leaving out MIIF_DOPAUSE? I see that NetBSD does not use it, and it is only set now because a driver that I copied used it. But I never went back to test it.

  • if_genet: remove MIFF_DOPAUSE mode.
crowston_protonmail.com added inline comments.
sys/arm64/broadcom/genet/if_genet.c
318 ↗(On Diff #73055)

You are right, it seems to have no effect. I removed it.

sys/arm64/broadcom/genet/if_genet.c
318 ↗(On Diff #73055)

Thanks!

sys/dev/mii/miivar.h
137 ↗(On Diff #73066)

My only quibble with the changes is the naming of MIIF_RXID and MIIF_TXID, although they are the same as NetBSD and OpenBSD. I don't know which is better, compatibility or clarity. MIIF_xDELAY would be much more obvious. Any other opinions? They could also be numbered sequentially.

crowston_protonmail.com marked an inline comment as done.
  • if_genet: rename MIIF_RXID, MIIF_TXID.
crowston_protonmail.com added inline comments.
sys/dev/mii/miivar.h
137 ↗(On Diff #73066)

Fixed

Looks good to me, I'm ready to approve. I'd also like to see a reviewer who knows the brgphy code.

This revision is now accepted and ready to land.Jun 18 2020, 12:25 AM
This revision was automatically updated to reflect the committed changes.