summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2011-10-08 12:33:10 +0000
committermarius <marius@FreeBSD.org>2011-10-08 12:33:10 +0000
commit07ac74d257832436e5d62b6a367e914e7b885db8 (patch)
treed092c392cb4048b55d5299cf6e1cdf2d236f5376 /sys/dev
parentd905bcbba92d530f4fc057a29b74755a8ae49382 (diff)
downloadFreeBSD-src-07ac74d257832436e5d62b6a367e914e7b885db8.zip
FreeBSD-src-07ac74d257832436e5d62b6a367e914e7b885db8.tar.gz
- Follow the lead of dcphy(4) and pnphy(4) and move the reminder of the PHY
drivers that only ever attach to a particular MAC driver, i.e. inphy(4), ruephy(4) and xlphy(4), to the directory where the respective MAC driver lives and only compile it into the kernel when the latter is also there, also removing it from miibus.ko and moving it into the module of the respective MAC driver. - While at it, rename exphy.c, which comes from NetBSD where the MAC driver it corresponds to also is named ex(4) instead of xl(4) but that in FreeBSD actually identifies itself as xlphy(4), and its function names accordingly for consistency. - Additionally while at it, fix some minor style issues like whitespace in the register headers and add multi-inclusion protection to inphyreg.h.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/fxp/inphy.c (renamed from sys/dev/mii/inphy.c)2
-rw-r--r--sys/dev/fxp/inphyreg.h (renamed from sys/dev/mii/inphyreg.h)13
-rw-r--r--sys/dev/usb/net/ruephy.c (renamed from sys/dev/mii/ruephy.c)3
-rw-r--r--sys/dev/usb/net/ruephyreg.h (renamed from sys/dev/mii/ruephyreg.h)12
-rw-r--r--sys/dev/xl/xlphy.c (renamed from sys/dev/mii/exphy.c)42
5 files changed, 38 insertions, 34 deletions
diff --git a/sys/dev/mii/inphy.c b/sys/dev/fxp/inphy.c
index e6a601c..587f3fd 100644
--- a/sys/dev/mii/inphy.c
+++ b/sys/dev/fxp/inphy.c
@@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
#include <dev/mii/miivar.h>
#include "miidevs.h"
-#include <dev/mii/inphyreg.h>
+#include <dev/fxp/inphyreg.h>
#include "miibus_if.h"
diff --git a/sys/dev/mii/inphyreg.h b/sys/dev/fxp/inphyreg.h
index 4b7d1f1..42c683d 100644
--- a/sys/dev/mii/inphyreg.h
+++ b/sys/dev/fxp/inphyreg.h
@@ -29,7 +29,12 @@
* $FreeBSD$
*/
-#define MII_INPHY_SCR 0x10 /* status and control register */
-#define SCR_FLOWCTL 0x8000
-#define SCR_S100 0x0002 /* autonegotiated speed */
-#define SCR_FDX 0x0001 /* autonegotiated duplex */
+#ifndef _INPHYREG_H
+#define _INPHYREG_H
+
+#define MII_INPHY_SCR 0x10 /* status and control register */
+#define SCR_FLOWCTL 0x8000
+#define SCR_S100 0x0002 /* autonegotiated speed */
+#define SCR_FDX 0x0001 /* autonegotiated duplex */
+
+#endif
diff --git a/sys/dev/mii/ruephy.c b/sys/dev/usb/net/ruephy.c
index a0d5441..64150a5 100644
--- a/sys/dev/mii/ruephy.c
+++ b/sys/dev/usb/net/ruephy.c
@@ -48,8 +48,7 @@ __FBSDID("$FreeBSD$");
#include <dev/mii/miivar.h>
#include "miidevs.h"
-#include <machine/bus.h>
-#include <dev/mii/ruephyreg.h>
+#include <dev/usb/net/ruephyreg.h>
#include "miibus_if.h"
diff --git a/sys/dev/mii/ruephyreg.h b/sys/dev/usb/net/ruephyreg.h
index 5f3911b..01d3cc1 100644
--- a/sys/dev/mii/ruephyreg.h
+++ b/sys/dev/usb/net/ruephyreg.h
@@ -27,12 +27,12 @@
*/
#ifndef _RUEPHYREG_H_
-#define _RUEPHYREG_H_
+#define _RUEPHYREG_H_
-#define RUEPHY_MII_MSR 0x0137 /* B, R/W */
-#define RUEPHY_MSR_RXFCE 0x40
-#define RUEPHY_MSR_DUPLEX 0x10
-#define RUEPHY_MSR_SPEED100 0x08
-#define RUEPHY_MSR_LINK 0x04
+#define RUEPHY_MII_MSR 0x0137 /* B, R/W */
+#define RUEPHY_MSR_RXFCE 0x40
+#define RUEPHY_MSR_DUPLEX 0x10
+#define RUEPHY_MSR_SPEED100 0x08
+#define RUEPHY_MSR_LINK 0x04
#endif /* _RUEPHYREG_H_ */
diff --git a/sys/dev/mii/exphy.c b/sys/dev/xl/xlphy.c
index 04add67..e5ac9fc 100644
--- a/sys/dev/mii/exphy.c
+++ b/sys/dev/xl/xlphy.c
@@ -77,30 +77,30 @@ __FBSDID("$FreeBSD$");
#include "miibus_if.h"
-static int exphy_probe(device_t);
-static int exphy_attach(device_t);
+static int xlphy_probe(device_t);
+static int xlphy_attach(device_t);
-static device_method_t exphy_methods[] = {
+static device_method_t xlphy_methods[] = {
/* device interface */
- DEVMETHOD(device_probe, exphy_probe),
- DEVMETHOD(device_attach, exphy_attach),
+ DEVMETHOD(device_probe, xlphy_probe),
+ DEVMETHOD(device_attach, xlphy_attach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
-static devclass_t exphy_devclass;
+static devclass_t xlphy_devclass;
-static driver_t exphy_driver = {
+static driver_t xlphy_driver = {
"xlphy",
- exphy_methods,
+ xlphy_methods,
sizeof(struct mii_softc)
};
-DRIVER_MODULE(xlphy, miibus, exphy_driver, exphy_devclass, 0, 0);
+DRIVER_MODULE(xlphy, miibus, xlphy_driver, xlphy_devclass, 0, 0);
-static int exphy_service(struct mii_softc *, struct mii_data *, int);
-static void exphy_reset(struct mii_softc *);
+static int xlphy_service(struct mii_softc *, struct mii_data *, int);
+static void xlphy_reset(struct mii_softc *);
/*
* Some 3Com internal PHYs report zero for OUI and model, others use
@@ -109,42 +109,42 @@ static void exphy_reset(struct mii_softc *);
* handled fine by ukphy(4); they can be isolated and don't require
* special treatment after reset.
*/
-static const struct mii_phydesc exphys[] = {
+static const struct mii_phydesc xlphys[] = {
{ 0, 0, "3Com internal media interface" },
MII_PHY_DESC(xxBROADCOM, 3C905C),
MII_PHY_END
};
-static const struct mii_phy_funcs exphy_funcs = {
- exphy_service,
+static const struct mii_phy_funcs xlphy_funcs = {
+ xlphy_service,
ukphy_status,
- exphy_reset
+ xlphy_reset
};
static int
-exphy_probe(device_t dev)
+xlphy_probe(device_t dev)
{
if (strcmp(device_get_name(device_get_parent(device_get_parent(dev))),
"xl") == 0)
- return (mii_phy_dev_probe(dev, exphys, BUS_PROBE_DEFAULT));
+ return (mii_phy_dev_probe(dev, xlphys, BUS_PROBE_DEFAULT));
return (ENXIO);
}
static int
-exphy_attach(device_t dev)
+xlphy_attach(device_t dev)
{
/*
* The 3Com PHY can never be isolated.
*/
mii_phy_dev_attach(dev, MIIF_NOISOLATE | MIIF_NOMANPAUSE,
- &exphy_funcs, 1);
+ &xlphy_funcs, 1);
return (0);
}
static int
-exphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
+xlphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
{
switch (cmd) {
@@ -184,7 +184,7 @@ exphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
}
static void
-exphy_reset(struct mii_softc *sc)
+xlphy_reset(struct mii_softc *sc)
{
mii_phy_reset(sc);
OpenPOWER on IntegriCloud