Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

NetBSD 11.0 on Netgate SG-1000 AM335x cpsw, KSZ9031 and i2c notes



Hi,

I have NetBSD 11.0 evbarm-earmv7hf running on the Netgate SG-1000,
the AM3352 box that shipped with pfSense. It's the stock armv7.img
with a patched am335x-boneblack.dtb and a u-boot.env added to the
FAT partition. It boots from microSD through Netgate's U-Boot on
the eMMC and doesn't touch the eMMC. One ethernet port works (WAN),
gigabit, DHCP/DNS/NTP/pkgin all fine.

Repo with the dts, scripts, logs and a prebuilt image
https://github.com/ttpolabs/netbsd-netgate-sg1000

The build reproduces from the 11.0 armv7.img byte for byte on the
dts/dtb. Short version of what I found

cpsw pinctrl. With the stock BBB tree port 1 gets gigabit link but
nothing comes in. The BBB pinctrl muxes the CPSW pins for MII and
this board is RGMII. Dropping pinctrl from the switch node so U-Boot's
pin setup stays fixed it. if_cpsw.c 1.17 also never reads phy-mode
or phy-handle and nothing writes GMII_SEL, so the kernel is leaning
on U-Boot for pin muxing, GMII_SEL (0x3a here) and the KSZ9031 skews.

Second port. mii_attach() is called with MII_PHY_ANY and offset 0
so only the first PHY found attaches (phy 1) and PHY 2 never does.
Enabling port@2 in the tree changes nothing. FreeBSD ran this board
as dual EMAC. I'm guessing thats driver work. Is anyone looking at
dual EMAC for cpsw?

Forced 100 Mbit doesn't work on port 1. cpsw_init() sets MACCONTROL
once with GIG set whenever the PHY can do 1000 and cpsw_mii_statchg()
is empty, so I think the MAC stays in gigabit mode at 100. I've yet
to read MACCONTROL back to confirm.

KSZ9031 skew. micphy.c has the cpsw skew fixup for the KSZ9021 but
nothing for the 9031. Netgate values (from ufw.dts, which is in ps/200
units because of FreeBSD's PS_TO_REG) match what U-Boot leaves in
PHY 1.

Disabled i2c nodes still get enumerated. tps@24 with status "disabled"
and a compatible nothing matches still shows up as

    tps (sg1000,no-pmic) at iic0 addr 0x24 not configured

and with only status "disabled" tps65217pmic0 still attached.
of_enter_i2c_devs() in 11.0 and fdtbus_i2c_enumerate_devices() in
-current don't check status . Linux only registers available children.
I'll file a PR for this one unless that's intended.

omaptimer0 "couldn't enable module". am3_prcm.c has timer1 at CM_WKUP
offset 0x10. I believe that's DMTIMER0 and timer1 is 0xC4 but I haven't
confirmed against the TRM table yet.

Question for the list. I'd like a real SG-1000 dts instead of the
patched BBB one. As far as I can tell NetBSD imports its device trees
from Linux (sys/external/gpl2/dts) so I'm guessing upstreaming to
Linux is the way. Is there a way to carry a board dts in NetBSD in
the meantime or is it Linux first and wait for the next import?


Full details and logs are in the README. Happy to test patches on the
board.

Thanks

Elias Howell


Home | Main Index | Thread Index | Old Index