Re: Problem with PHY offloc for Cadence ethernet
Jared McNeill <[email protected]>
| Newsgroups | gmane.os.netbsd.ports.arm,gmane.os.netbsd.devel.network |
|---|---|
| Message-ID | <PH7PR12MB595127F1925F1DDBE85885B9B9312@PH7PR12MB5951.namprd12.prod.outlook.com> |
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 <[email protected]> > 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 > > >