Date: Sun, 25 Apr 2010 05:09:08 +0000 (UTC) From: Juli Mallett <jmallett@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r207185 - user/jmallett/octeon/sys/mips/cavium/octe Message-ID: <201004250509.o3P598GX053927@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jmallett Date: Sun Apr 25 05:09:08 2010 New Revision: 207185 URL: http://svn.freebsd.org/changeset/base/207185 Log: o) Allow miibus attachment to fail, falling back to non-MII media handling. o) Only allow miibus access to *our* PHY on the shared MII bus. XXX The PHY numbering that we get from the Simple Executive seems to be off or we're not configuring something right at the MII layer or something; the miibus correctly finds the RTL8212 chips on the CAM-0100 and says they are at PHY 2 and PHY 3. Except octe0 and octe1 think their PHYs are #4 and #9 respectively. Modified: user/jmallett/octeon/sys/mips/cavium/octe/octe.c Modified: user/jmallett/octeon/sys/mips/cavium/octe/octe.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/octe.c Sun Apr 25 04:04:22 2010 (r207184) +++ user/jmallett/octeon/sys/mips/cavium/octe/octe.c Sun Apr 25 05:09:08 2010 (r207185) @@ -145,20 +145,21 @@ octe_attach(device_t dev) if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifmedia_init(&priv->media, 0, octe_medchange, octe_medstat); - if (priv->phy_id == -1) { - ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO, 0, NULL); - ifmedia_set(&priv->media, IFM_ETHER | IFM_AUTO); - } else { + if (priv->phy_id != -1) { error = mii_phy_probe(dev, &priv->miibus, octe_mii_medchange, octe_mii_medstat); if (error != 0) { - device_printf(dev, "could not find PHY!\n"); - /* XXX Cleanup. */ - return (error); + device_printf(dev, "missing phy %u\n", priv->phy_id); } } + if (priv->miibus == NULL) { + ifmedia_init(&priv->media, 0, octe_medchange, octe_medstat); + + ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO, 0, NULL); + ifmedia_set(&priv->media, IFM_ETHER | IFM_AUTO); + } + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_init = octe_init; ifp->if_ioctl = octe_ioctl; @@ -199,6 +200,9 @@ octe_miibus_readreg(device_t dev, int ph priv = device_get_softc(dev); + if (phy != priv->phy_id) + return (0); + return (cvm_oct_mdio_read(priv->ifp, phy, reg)); } @@ -209,6 +213,9 @@ octe_miibus_writereg(device_t dev, int p priv = device_get_softc(dev); + KASSERT(phy == priv->phy_id, + ("write to phy %u but our phy is %u", phy, priv->phy_id)); + cvm_oct_mdio_write(priv->ifp, phy, reg, val); return (0);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004250509.o3P598GX053927>