tech-net archive

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

Re: Problem with PHY offloc for Cadence ethernet



Hi Lloyd --

I think the right thing to do here is to have the bus glue pass the PHY ID to cemac_attach_common. For Zynq you can get that information from the device tree -- see https://nxr.netbsd.org/xref/src/sys/arch/arm/sunxi/sunxi_emac.c#1342 for an example of how other drivers do this.

HTH,
Jared

On Fri, 22 Mar 2024, Lloyd Parkes wrote:

Kia ora koutou,
I got NetBSD booting on my ALINX AX7021B Zynq system the other day and
I've just now managed to get the ethernet online.

The problem turned out to be that the PHY appears at offset location 0,
but the Cadence ethernet driver calls mii_attach with a fixed offset
location of 1 (i.e. "mii_attach(sc->sc_dev, mii, 0xffffffff,
MII_PHY_ANY, 1, 0);").

I changed "1" to "MII_OFFSET_ANY" made my ethernet come online.

I went through the Mercurial logs to see if I can find out why that
code is that way and I found this log message.

 $ hg log -r 1021807 -v if_cemac.c
 changeset:   1021807:df4107b887fe
 branch:      trunk
 user:        jmcneill <jmcneill%NetBSD.org@localhost>
 date:        Sat Nov 12 16:54:36 2022 +0000
 files:       sys/dev/cadence/if_cemac.c
 description:
 Skip the first PHY found to remove the shadow PHY that appears at
 the broadcast address 0.

Well, that makes things more difficult for me. My board doesn't have
any extra PHYs that need to be skipped.

Is this something that should be fixable with a suitable devicetree
specification? I already have to write the devicetree source and I
don't mind having a go at improving the Cadence driver's support for
the FDT bindings if there is anything lacking there. I really just
don't know what's right and what's feasible. Any advice will be
appreciated.

Ngā mihi,
Lloyd




Home | Main Index | Thread Index | Old Index