Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Dec 2015 02:31:39 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r292738 - in head: share/man/man4 sys/conf sys/dev/etherswitch sys/dev/etherswitch/arswitch sys/dev/etherswitch/e6000sw sys/dev/etherswitch/ip17x sys/dev/etherswitch/ukswitch sys/dev/md...
Message-ID:  <201512260231.tBQ2VdPH037312@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Sat Dec 26 02:31:39 2015
New Revision: 292738
URL: https://svnweb.freebsd.org/changeset/base/292738

Log:
  [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

Added:
  head/share/man/man4/mdio.4   (contents, props changed)
  head/sys/dev/mdio/
  head/sys/dev/mdio/mdio.c
     - copied, changed from r292734, head/sys/dev/etherswitch/mdio.c
  head/sys/dev/mdio/mdio.h
     - copied, changed from r292734, head/sys/dev/etherswitch/mdio.h
  head/sys/dev/mdio/mdio_if.m
     - copied unchanged from r292734, head/sys/dev/etherswitch/mdio_if.m
  head/sys/modules/mdio/
  head/sys/modules/mdio/Makefile   (contents, props changed)
Deleted:
  head/sys/dev/etherswitch/mdio.c
  head/sys/dev/etherswitch/mdio.h
  head/sys/dev/etherswitch/mdio_if.m
Modified:
  head/share/man/man4/Makefile
  head/sys/conf/files
  head/sys/dev/etherswitch/arswitch/arswitch.c
  head/sys/dev/etherswitch/arswitch/arswitch_7240.c
  head/sys/dev/etherswitch/arswitch/arswitch_8216.c
  head/sys/dev/etherswitch/arswitch/arswitch_8226.c
  head/sys/dev/etherswitch/arswitch/arswitch_8316.c
  head/sys/dev/etherswitch/arswitch/arswitch_8327.c
  head/sys/dev/etherswitch/arswitch/arswitch_9340.c
  head/sys/dev/etherswitch/arswitch/arswitch_phy.c
  head/sys/dev/etherswitch/arswitch/arswitch_reg.c
  head/sys/dev/etherswitch/e6000sw/e6000sw.c
  head/sys/dev/etherswitch/ip17x/ip17x.c
  head/sys/dev/etherswitch/ukswitch/ukswitch.c
  head/sys/dev/mge/if_mge.c
  head/sys/modules/Makefile

Modified: head/share/man/man4/Makefile
==============================================================================
--- head/share/man/man4/Makefile	Sat Dec 26 00:31:19 2015	(r292737)
+++ head/share/man/man4/Makefile	Sat Dec 26 02:31:39 2015	(r292738)
@@ -266,6 +266,7 @@ MAN=	aac.4 \
 	malo.4 \
 	mcd.4 \
 	md.4 \
+	mdio.4 \
 	me.4 \
 	mem.4 \
 	meteor.4 \

Added: head/share/man/man4/mdio.4
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/share/man/man4/mdio.4	Sat Dec 26 02:31:39 2015	(r292738)
@@ -0,0 +1,53 @@
+.\" Written by Landon Fuller for the FreeBSD Project.
+.\" Based on the miibus(4) manual page written by Tom Rhodes.
+.\" Please see the /usr/src/COPYRIGHT file for copyright information.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 17, 2015
+.Dt MDIO 4
+.Os
+.Sh NAME
+.Nm mdio
+.Nd IEEE 802.3 Management Data Input/Output interface
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device mdio"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides an interconnection between the Media Access Control (MAC)
+sublayer and Physical Layer (PHY) entities' control and status registers,
+as defined by the IEEE 802.3 Standard.
+.Pp
+The
+.Nm
+layer allows device drivers to share common support code for various
+external PHY devices.
+.Pp
+.Tn MDIO
+is one of two signal interfaces that comprise the
+Media Independent Interface (MII) defined by the IEEE 802.3
+Standard. The
+.Xr miibus 4
+driver provides support for devices that require full
+.Tn MII
+support.
+.Sh SEE ALSO
+.Xr miibus 4
+.Sh STANDARDS
+More information on
+.Tn MDIO
+can be found in the IEEE 802.3 Standard.
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 10.0 .
+.Sh AUTHORS
+The driver was written by
+.An Stefan Bethke Aq Mt stb@lassitu.de .

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Sat Dec 26 00:31:19 2015	(r292737)
+++ head/sys/conf/files	Sat Dec 26 02:31:39 2015	(r292738)
@@ -1404,8 +1404,6 @@ dev/etherswitch/ip17x/ip175c.c		optional
 dev/etherswitch/ip17x/ip175d.c		optional ip17x
 dev/etherswitch/ip17x/ip17x_phy.c	optional ip17x
 dev/etherswitch/ip17x/ip17x_vlans.c	optional ip17x
-dev/etherswitch/mdio_if.m		optional miiproxy | mdio
-dev/etherswitch/mdio.c			optional miiproxy | mdio
 dev/etherswitch/miiproxy.c		optional miiproxy
 dev/etherswitch/rtl8366/rtl8366rb.c	optional rtl8366rb
 dev/etherswitch/ukswitch/ukswitch.c	optional ukswitch
@@ -1908,6 +1906,8 @@ dev/mca/mca_bus.c		optional mca
 dev/mcd/mcd.c			optional mcd isa nowerror
 dev/mcd/mcd_isa.c		optional mcd isa nowerror
 dev/md/md.c			optional md
+dev/mdio/mdio_if.m		optional miiproxy | mdio
+dev/mdio/mdio.c			optional miiproxy | mdio
 dev/mem/memdev.c		optional mem
 dev/mem/memutil.c		optional mem
 dev/mfi/mfi.c			optional mfi

Modified: head/sys/dev/etherswitch/arswitch/arswitch.c
==============================================================================
--- head/sys/dev/etherswitch/arswitch/arswitch.c	Sat Dec 26 00:31:19 2015	(r292737)
+++ head/sys/dev/etherswitch/arswitch/arswitch.c	Sat Dec 26 02:31:39 2015	(r292738)
@@ -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>
 

Modified: head/sys/dev/etherswitch/arswitch/arswitch_7240.c
==============================================================================
--- head/sys/dev/etherswitch/arswitch/arswitch_7240.c	Sat Dec 26 00:31:19 2015	(r292737)
+++ head/sys/dev/etherswitch/arswitch/arswitch_7240.c	Sat Dec 26 02:31:39 2015	(r292738)
@@ -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>
 

Modified: head/sys/dev/etherswitch/arswitch/arswitch_8216.c
==============================================================================
--- head/sys/dev/etherswitch/arswitch/arswitch_8216.c	Sat Dec 26 00:31:19 2015	(r292737)
+++ head/sys/dev/etherswitch/arswitch/arswitch_8216.c	Sat Dec 26 02:31:39 2015	(r292738)
@@ -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>
 

Modified: head/sys/dev/etherswitch/arswitch/arswitch_8226.c
==============================================================================
--- head/sys/dev/etherswitch/arswitch/arswitch_8226.c	Sat Dec 26 00:31:19 2015	(r292737)
+++ head/sys/dev/etherswitch/arswitch/arswitch_8226.c	Sat Dec 26 02:31:39 2015	(r292738)
@@ -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>
 

Modified: head/sys/dev/etherswitch/arswitch/arswitch_8316.c
==============================================================================
--- head/sys/dev/etherswitch/arswitch/arswitch_8316.c	Sat Dec 26 00:31:19 2015	(r292737)
+++ head/sys/dev/etherswitch/arswitch/arswitch_8316.c	Sat Dec 26 02:31:39 2015	(r292738)
@@ -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>
 

Modified: head/sys/dev/etherswitch/arswitch/arswitch_8327.c
==============================================================================
--- head/sys/dev/etherswitch/arswitch/arswitch_8327.c	Sat Dec 26 00:31:19 2015	(r292737)
+++ head/sys/dev/etherswitch/arswitch/arswitch_8327.c	Sat Dec 26 02:31:39 2015	(r292738)
@@ -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>
 

Modified: head/sys/dev/etherswitch/arswitch/arswitch_9340.c
==============================================================================
--- head/sys/dev/etherswitch/arswitch/arswitch_9340.c	Sat Dec 26 00:31:19 2015	(r292737)
+++ head/sys/dev/etherswitch/arswitch/arswitch_9340.c	Sat Dec 26 02:31:39 2015	(r292738)
@@ -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>
 

Modified: head/sys/dev/etherswitch/arswitch/arswitch_phy.c
==============================================================================
--- head/sys/dev/etherswitch/arswitch/arswitch_phy.c	Sat Dec 26 00:31:19 2015	(r292737)
+++ head/sys/dev/etherswitch/arswitch/arswitch_phy.c	Sat Dec 26 02:31:39 2015	(r292738)
@@ -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>
 

Modified: head/sys/dev/etherswitch/arswitch/arswitch_reg.c
==============================================================================
--- head/sys/dev/etherswitch/arswitch/arswitch_reg.c	Sat Dec 26 00:31:19 2015	(r292737)
+++ head/sys/dev/etherswitch/arswitch/arswitch_reg.c	Sat Dec 26 02:31:39 2015	(r292738)
@@ -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>
 

Modified: head/sys/dev/etherswitch/e6000sw/e6000sw.c
==============================================================================
--- head/sys/dev/etherswitch/e6000sw/e6000sw.c	Sat Dec 26 00:31:19 2015	(r292737)
+++ head/sys/dev/etherswitch/e6000sw/e6000sw.c	Sat Dec 26 02:31:39 2015	(r292738)
@@ -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>

Modified: head/sys/dev/etherswitch/ip17x/ip17x.c
==============================================================================
--- head/sys/dev/etherswitch/ip17x/ip17x.c	Sat Dec 26 00:31:19 2015	(r292737)
+++ head/sys/dev/etherswitch/ip17x/ip17x.c	Sat Dec 26 02:31:39 2015	(r292738)
@@ -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>

Modified: head/sys/dev/etherswitch/ukswitch/ukswitch.c
==============================================================================
--- head/sys/dev/etherswitch/ukswitch/ukswitch.c	Sat Dec 26 00:31:19 2015	(r292737)
+++ head/sys/dev/etherswitch/ukswitch/ukswitch.c	Sat Dec 26 02:31:39 2015	(r292738)
@@ -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>
 

Copied and modified: head/sys/dev/mdio/mdio.c (from r292734, head/sys/dev/etherswitch/mdio.c)
==============================================================================
--- head/sys/dev/etherswitch/mdio.c	Fri Dec 25 18:11:40 2015	(r292734, copy source)
+++ head/sys/dev/mdio/mdio.c	Sat Dec 26 02:31:39 2015	(r292738)
@@ -29,8 +29,9 @@
 #include <sys/param.h>
 #include <sys/bus.h>
 #include <sys/systm.h>
+#include <sys/module.h>
 
-#include <dev/etherswitch/mdio.h>
+#include <dev/mdio/mdio.h>
 
 #include "mdio_if.h"
 
@@ -115,3 +116,5 @@ driver_t mdio_driver = {
 };
 
 devclass_t mdio_devclass;
+
+MODULE_VERSION(mdio, 1);

Copied and modified: head/sys/dev/mdio/mdio.h (from r292734, head/sys/dev/etherswitch/mdio.h)
==============================================================================
--- head/sys/dev/etherswitch/mdio.h	Fri Dec 25 18:11:40 2015	(r292734, copy source)
+++ head/sys/dev/mdio/mdio.h	Sat Dec 26 02:31:39 2015	(r292738)
@@ -26,10 +26,10 @@
  * $FreeBSD$
  */
 
-#ifndef	__DEV_ETHERSWITCH_MDIO_H__
-#define	__DEV_ETHERSWITCH_MDIO_H__
+#ifndef	__DEV_MDIO_MDIO_H__
+#define	__DEV_MDIO_MDIO_H__
 
 extern driver_t mdio_driver;
 extern devclass_t mdio_devclass;
 
-#endif	/* __DEV_ETHERSWITCH_MDIO_H__ */
+#endif	/* __DEV_MDIO_MDIO_H__ */

Copied: head/sys/dev/mdio/mdio_if.m (from r292734, head/sys/dev/etherswitch/mdio_if.m)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/mdio/mdio_if.m	Sat Dec 26 02:31:39 2015	(r292738, copy of r292734, head/sys/dev/etherswitch/mdio_if.m)
@@ -0,0 +1,24 @@
+# $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;
+};

Modified: head/sys/dev/mge/if_mge.c
==============================================================================
--- head/sys/dev/mge/if_mge.c	Sat Dec 26 00:31:19 2015	(r292737)
+++ head/sys/dev/mge/if_mge.c	Sat Dec 26 02:31:39 2015	(r292738)
@@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$");
 #include <dev/fdt/fdt_common.h>
 #include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/ofw_bus_subr.h>
-#include <dev/etherswitch/mdio.h>
+#include <dev/mdio/mdio.h>
 
 #include <dev/mge/if_mgevar.h>
 #include <arm/mv/mvreg.h>

Modified: head/sys/modules/Makefile
==============================================================================
--- head/sys/modules/Makefile	Sat Dec 26 00:31:19 2015	(r292737)
+++ head/sys/modules/Makefile	Sat Dec 26 02:31:39 2015	(r292738)
@@ -220,6 +220,7 @@ SUBDIR=	\
 	malo \
 	mcd \
 	md \
+	mdio \
 	mem \
 	mfi \
 	mii \

Added: head/sys/modules/mdio/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/modules/mdio/Makefile	Sat Dec 26 02:31:39 2015	(r292738)
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../dev/mdio
+
+KMOD=	mdio
+SRCS=	mdio.c
+SRCS+=	mdio_if.c mdio_if.h
+SRCS+=	device_if.h bus_if.h
+
+.include <bsd.kmod.mk>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512260231.tBQ2VdPH037312>