summaryrefslogtreecommitdiffstats
path: root/sys/dev/mii/e1000phy.c
diff options
context:
space:
mode:
authoryongari <yongari@FreeBSD.org>2009-09-28 21:03:28 +0000
committeryongari <yongari@FreeBSD.org>2009-09-28 21:03:28 +0000
commit7139323b97db2431031665257e19c2277ac858b2 (patch)
treedd58f27c1c39d788de3e84609f0ac3c360da8886 /sys/dev/mii/e1000phy.c
parentac4cfae59ca38cdb6e04d4ff7a214f405f17430e (diff)
downloadFreeBSD-src-7139323b97db2431031665257e19c2277ac858b2.zip
FreeBSD-src-7139323b97db2431031665257e19c2277ac858b2.tar.gz
Add hack to pass controller specific information to phy driver.
Unlike most other PHYs there is no easy way to know which media type the PHY supports on Marvell PHYs. MIIF_HAVEFIBER flags is now passed via bus-specific instance variable of a device. While I'm here add 88E1112 specific work around to set SIGDET polarity low. Many thanks "Eugene Perevyazko <john <> dnepro dot net>" who kindly gave remote access to system with DGE-560SX.
Diffstat (limited to 'sys/dev/mii/e1000phy.c')
-rw-r--r--sys/dev/mii/e1000phy.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/dev/mii/e1000phy.c b/sys/dev/mii/e1000phy.c
index 39f41fe..2ff31d3 100644
--- a/sys/dev/mii/e1000phy.c
+++ b/sys/dev/mii/e1000phy.c
@@ -59,6 +59,9 @@ __FBSDID("$FreeBSD$");
#include "miidevs.h"
#include <dev/mii/e1000phyreg.h>
+/* XXX */
+#include <machine/bus.h>
+#include <dev/msk/if_mskreg.h>
#include "miibus_if.h"
@@ -68,6 +71,7 @@ static int e1000phy_attach(device_t);
struct e1000phy_softc {
struct mii_softc mii_sc;
int mii_model;
+ struct msk_mii_data *mmd;
};
static device_method_t e1000phy_methods[] = {
@@ -130,6 +134,7 @@ e1000phy_attach(device_t dev)
struct mii_softc *sc;
struct mii_attach_args *ma;
struct mii_data *mii;
+ struct ifnet *ifp;
esc = device_get_softc(dev);
sc = &esc->mii_sc;
@@ -145,6 +150,16 @@ e1000phy_attach(device_t dev)
mii->mii_instance++;
esc->mii_model = MII_MODEL(ma->mii_id2);
+ ifp = sc->mii_pdata->mii_ifp;
+ if (strcmp(ifp->if_dname, "msk") == 0) {
+ /* XXX */
+ esc->mmd = device_get_ivars(
+ device_get_parent(device_get_parent(dev)));
+ if (esc->mmd != NULL &&
+ (esc->mmd->mii_flags & MIIF_HAVEFIBER) != 0)
+ sc->mii_flags |= MIIF_HAVEFIBER;
+ }
+
switch (esc->mii_model) {
case MII_MODEL_MARVELL_E1011:
case MII_MODEL_MARVELL_E1112:
@@ -199,6 +214,13 @@ e1000phy_reset(struct mii_softc *sc)
reg &= ~E1000_SCR_MODE_MASK;
reg |= E1000_SCR_MODE_1000BX;
PHY_WRITE(sc, E1000_SCR, reg);
+ if (esc->mmd != NULL && esc->mmd->pmd == 'P') {
+ /* Set SIGDET polarity low for SFP module. */
+ PHY_WRITE(sc, E1000_EADR, 1);
+ reg = PHY_READ(sc, E1000_SCR);
+ reg |= E1000_SCR_FIB_SIGDET_POLARITY;
+ PHY_WRITE(sc, E1000_SCR, reg);
+ }
PHY_WRITE(sc, E1000_EADR, page);
}
} else {
OpenPOWER on IntegriCloud