summaryrefslogtreecommitdiffstats
path: root/sys/dev/etherswitch
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2015-12-26 02:31:39 +0000
committeradrian <adrian@FreeBSD.org>2015-12-26 02:31:39 +0000
commit86c6170821c7ea40b4763ab908848cbaffe2e55f (patch)
tree20fa4aeed5f541515950720a65a9e5dd0c163c1c /sys/dev/etherswitch
parent77193eb303148e86085223efbbb1d69d90fe83ba (diff)
downloadFreeBSD-src-86c6170821c7ea40b4763ab908848cbaffe2e55f.zip
FreeBSD-src-86c6170821c7ea40b4763ab908848cbaffe2e55f.tar.gz
[mdio] migrate mdiobus out of etherswitch and into a top-level device of its own.
The mdio driver interface is generally useful for devices that require MDIO without the full MII bus interface. This lifts the driver/interface out of etherswitch(4), and adds a mdio(4) man page. Submitted by: Landon Fuller <landon@landonf.org> Differential Revision: https://reviews.freebsd.org/D4606
Diffstat (limited to 'sys/dev/etherswitch')
-rw-r--r--sys/dev/etherswitch/arswitch/arswitch.c2
-rw-r--r--sys/dev/etherswitch/arswitch/arswitch_7240.c2
-rw-r--r--sys/dev/etherswitch/arswitch/arswitch_8216.c2
-rw-r--r--sys/dev/etherswitch/arswitch/arswitch_8226.c2
-rw-r--r--sys/dev/etherswitch/arswitch/arswitch_8316.c2
-rw-r--r--sys/dev/etherswitch/arswitch/arswitch_8327.c2
-rw-r--r--sys/dev/etherswitch/arswitch/arswitch_9340.c2
-rw-r--r--sys/dev/etherswitch/arswitch/arswitch_phy.c2
-rw-r--r--sys/dev/etherswitch/arswitch/arswitch_reg.c2
-rw-r--r--sys/dev/etherswitch/e6000sw/e6000sw.c2
-rw-r--r--sys/dev/etherswitch/ip17x/ip17x.c2
-rw-r--r--sys/dev/etherswitch/mdio.c117
-rw-r--r--sys/dev/etherswitch/mdio.h35
-rw-r--r--sys/dev/etherswitch/mdio_if.m24
-rw-r--r--sys/dev/etherswitch/ukswitch/ukswitch.c2
15 files changed, 12 insertions, 188 deletions
diff --git a/sys/dev/etherswitch/arswitch/arswitch.c b/sys/dev/etherswitch/arswitch/arswitch.c
index 3b1d575..4388819 100644
--- a/sys/dev/etherswitch/arswitch/arswitch.c
+++ b/sys/dev/etherswitch/arswitch/arswitch.c
@@ -52,7 +52,7 @@
#include <dev/iicbus/iicbus.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
-#include <dev/etherswitch/mdio.h>
+#include <dev/mdio/mdio.h>
#include <dev/etherswitch/etherswitch.h>
diff --git a/sys/dev/etherswitch/arswitch/arswitch_7240.c b/sys/dev/etherswitch/arswitch/arswitch_7240.c
index f3750bf..3d2543a7 100644
--- a/sys/dev/etherswitch/arswitch/arswitch_7240.c
+++ b/sys/dev/etherswitch/arswitch/arswitch_7240.c
@@ -50,7 +50,7 @@
#include <dev/iicbus/iicbus.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
-#include <dev/etherswitch/mdio.h>
+#include <dev/mdio/mdio.h>
#include <dev/etherswitch/etherswitch.h>
diff --git a/sys/dev/etherswitch/arswitch/arswitch_8216.c b/sys/dev/etherswitch/arswitch/arswitch_8216.c
index 72b2327..bd5c2cb 100644
--- a/sys/dev/etherswitch/arswitch/arswitch_8216.c
+++ b/sys/dev/etherswitch/arswitch/arswitch_8216.c
@@ -50,7 +50,7 @@
#include <dev/iicbus/iicbus.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
-#include <dev/etherswitch/mdio.h>
+#include <dev/mdio/mdio.h>
#include <dev/etherswitch/etherswitch.h>
diff --git a/sys/dev/etherswitch/arswitch/arswitch_8226.c b/sys/dev/etherswitch/arswitch/arswitch_8226.c
index 43d2281..5a86627 100644
--- a/sys/dev/etherswitch/arswitch/arswitch_8226.c
+++ b/sys/dev/etherswitch/arswitch/arswitch_8226.c
@@ -50,7 +50,7 @@
#include <dev/iicbus/iicbus.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
-#include <dev/etherswitch/mdio.h>
+#include <dev/mdio/mdio.h>
#include <dev/etherswitch/etherswitch.h>
diff --git a/sys/dev/etherswitch/arswitch/arswitch_8316.c b/sys/dev/etherswitch/arswitch/arswitch_8316.c
index 91dd72d..d646e18 100644
--- a/sys/dev/etherswitch/arswitch/arswitch_8316.c
+++ b/sys/dev/etherswitch/arswitch/arswitch_8316.c
@@ -50,7 +50,7 @@
#include <dev/iicbus/iicbus.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
-#include <dev/etherswitch/mdio.h>
+#include <dev/mdio/mdio.h>
#include <dev/etherswitch/etherswitch.h>
diff --git a/sys/dev/etherswitch/arswitch/arswitch_8327.c b/sys/dev/etherswitch/arswitch/arswitch_8327.c
index 96c2282..6e221a8 100644
--- a/sys/dev/etherswitch/arswitch/arswitch_8327.c
+++ b/sys/dev/etherswitch/arswitch/arswitch_8327.c
@@ -50,7 +50,7 @@
#include <dev/iicbus/iicbus.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
-#include <dev/etherswitch/mdio.h>
+#include <dev/mdio/mdio.h>
#include <dev/etherswitch/etherswitch.h>
diff --git a/sys/dev/etherswitch/arswitch/arswitch_9340.c b/sys/dev/etherswitch/arswitch/arswitch_9340.c
index 7754335..89f6caa 100644
--- a/sys/dev/etherswitch/arswitch/arswitch_9340.c
+++ b/sys/dev/etherswitch/arswitch/arswitch_9340.c
@@ -50,7 +50,7 @@
#include <dev/iicbus/iicbus.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
-#include <dev/etherswitch/mdio.h>
+#include <dev/mdio/mdio.h>
#include <dev/etherswitch/etherswitch.h>
diff --git a/sys/dev/etherswitch/arswitch/arswitch_phy.c b/sys/dev/etherswitch/arswitch/arswitch_phy.c
index 43abaa1..ceeb307 100644
--- a/sys/dev/etherswitch/arswitch/arswitch_phy.c
+++ b/sys/dev/etherswitch/arswitch/arswitch_phy.c
@@ -48,7 +48,7 @@
#include <dev/iicbus/iicbus.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
-#include <dev/etherswitch/mdio.h>
+#include <dev/mdio/mdio.h>
#include <dev/etherswitch/etherswitch.h>
diff --git a/sys/dev/etherswitch/arswitch/arswitch_reg.c b/sys/dev/etherswitch/arswitch/arswitch_reg.c
index d6797a8..420e516 100644
--- a/sys/dev/etherswitch/arswitch/arswitch_reg.c
+++ b/sys/dev/etherswitch/arswitch/arswitch_reg.c
@@ -49,7 +49,7 @@
#include <dev/iicbus/iicbus.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
-#include <dev/etherswitch/mdio.h>
+#include <dev/mdio/mdio.h>
#include <dev/etherswitch/etherswitch.h>
diff --git a/sys/dev/etherswitch/e6000sw/e6000sw.c b/sys/dev/etherswitch/e6000sw/e6000sw.c
index e598607..ca4ec3f 100644
--- a/sys/dev/etherswitch/e6000sw/e6000sw.c
+++ b/sys/dev/etherswitch/e6000sw/e6000sw.c
@@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$");
#include <arm/mv/mvvar.h>
#include <dev/etherswitch/etherswitch.h>
-#include <dev/etherswitch/mdio.h>
+#include <dev/mdio/mdio.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
#include <dev/mge/if_mgevar.h>
diff --git a/sys/dev/etherswitch/ip17x/ip17x.c b/sys/dev/etherswitch/ip17x/ip17x.c
index 2f51217..43cdddb 100644
--- a/sys/dev/etherswitch/ip17x/ip17x.c
+++ b/sys/dev/etherswitch/ip17x/ip17x.c
@@ -51,7 +51,7 @@
#include <machine/bus.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
-#include <dev/etherswitch/mdio.h>
+#include <dev/mdio/mdio.h>
#include <dev/etherswitch/etherswitch.h>
#include <dev/etherswitch/ip17x/ip17x_phy.h>
diff --git a/sys/dev/etherswitch/mdio.c b/sys/dev/etherswitch/mdio.c
deleted file mode 100644
index 1d1d370..0000000
--- a/sys/dev/etherswitch/mdio.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*-
- * Copyright (c) 2011-2012 Stefan Bethke.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#include <sys/param.h>
-#include <sys/bus.h>
-#include <sys/systm.h>
-
-#include <dev/etherswitch/mdio.h>
-
-#include "mdio_if.h"
-
-static void
-mdio_identify(driver_t *driver, device_t parent)
-{
-
- if (device_find_child(parent, mdio_driver.name, -1) == NULL)
- BUS_ADD_CHILD(parent, 0, mdio_driver.name, -1);
-}
-
-static int
-mdio_probe(device_t dev)
-{
-
- device_set_desc(dev, "MDIO");
-
- return (BUS_PROBE_SPECIFIC);
-}
-
-static int
-mdio_attach(device_t dev)
-{
-
- bus_generic_probe(dev);
- bus_enumerate_hinted_children(dev);
- return (bus_generic_attach(dev));
-}
-
-static int
-mdio_detach(device_t dev)
-{
-
- bus_generic_detach(dev);
- return (0);
-}
-
-static int
-mdio_readreg(device_t dev, int phy, int reg)
-{
-
- return (MDIO_READREG(device_get_parent(dev), phy, reg));
-}
-
-static int
-mdio_writereg(device_t dev, int phy, int reg, int val)
-{
-
- return (MDIO_WRITEREG(device_get_parent(dev), phy, reg, val));
-}
-
-static void
-mdio_hinted_child(device_t dev, const char *name, int unit)
-{
-
- device_add_child(dev, name, unit);
-}
-
-static device_method_t mdio_methods[] = {
- /* device interface */
- DEVMETHOD(device_identify, mdio_identify),
- DEVMETHOD(device_probe, mdio_probe),
- DEVMETHOD(device_attach, mdio_attach),
- DEVMETHOD(device_detach, mdio_detach),
- DEVMETHOD(device_shutdown, bus_generic_shutdown),
-
- /* bus interface */
- DEVMETHOD(bus_add_child, device_add_child_ordered),
- DEVMETHOD(bus_hinted_child, mdio_hinted_child),
-
- /* MDIO access */
- DEVMETHOD(mdio_readreg, mdio_readreg),
- DEVMETHOD(mdio_writereg, mdio_writereg),
-
- DEVMETHOD_END
-};
-
-driver_t mdio_driver = {
- "mdio",
- mdio_methods,
- 0
-};
-
-devclass_t mdio_devclass;
diff --git a/sys/dev/etherswitch/mdio.h b/sys/dev/etherswitch/mdio.h
deleted file mode 100644
index 82578e0..0000000
--- a/sys/dev/etherswitch/mdio.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*-
- * Copyright (c) 2011-2012 Stefan Bethke.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef __DEV_ETHERSWITCH_MDIO_H__
-#define __DEV_ETHERSWITCH_MDIO_H__
-
-extern driver_t mdio_driver;
-extern devclass_t mdio_devclass;
-
-#endif /* __DEV_ETHERSWITCH_MDIO_H__ */
diff --git a/sys/dev/etherswitch/mdio_if.m b/sys/dev/etherswitch/mdio_if.m
deleted file mode 100644
index 9aedd92..0000000
--- a/sys/dev/etherswitch/mdio_if.m
+++ /dev/null
@@ -1,24 +0,0 @@
-# $FreeBSD$
-
-#include <sys/bus.h>
-
-INTERFACE mdio;
-
-#
-# Read register from device on MDIO bus
-#
-METHOD int readreg {
- device_t dev;
- int phy;
- int reg;
-};
-
-#
-# Write register to device on MDIO bus
-#
-METHOD int writereg {
- device_t dev;
- int phy;
- int reg;
- int val;
-};
diff --git a/sys/dev/etherswitch/ukswitch/ukswitch.c b/sys/dev/etherswitch/ukswitch/ukswitch.c
index fa65455..876aa9d 100644
--- a/sys/dev/etherswitch/ukswitch/ukswitch.c
+++ b/sys/dev/etherswitch/ukswitch/ukswitch.c
@@ -50,7 +50,7 @@
#include <machine/bus.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
-#include <dev/etherswitch/mdio.h>
+#include <dev/mdio/mdio.h>
#include <dev/etherswitch/etherswitch.h>
OpenPOWER on IntegriCloud