Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Jun 2017 23:55:13 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r319814 - head/sys/dev/mii
Message-ID:  <201706102355.v5ANtDc1047387@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Sat Jun 10 23:55:13 2017
New Revision: 319814
URL: https://svnweb.freebsd.org/changeset/base/319814

Log:
  Add a set of constants describing the ways a MAC and PHY can be connected.
  
  While the initial need for this is to help support phy drivers which are
  configured with FDT data, there is nothing devicetree-specific about the
  concept or the names, so they are available for use even on non-FDT systems.
  
  The initial list of connection types comes from the current devicetree
  bindings documentation, but values not documented there can be added to
  the list in the future as needed, the values could be sorted into a
  different order without perturbing FDT code, etc.  The only invariant
  is that MII_CONTYPE_UNKNOWN should be first (so it has a value of zero,
  so that a con-type variable in a softc, for example, is initialized to
  MII_CONTYPE_UNKNOWN by default).

Modified:
  head/sys/dev/mii/miivar.h

Modified: head/sys/dev/mii/miivar.h
==============================================================================
--- head/sys/dev/mii/miivar.h	Sat Jun 10 23:45:26 2017	(r319813)
+++ head/sys/dev/mii/miivar.h	Sat Jun 10 23:55:13 2017	(r319814)
@@ -156,6 +156,42 @@ typedef struct mii_softc mii_softc_t;
 #define	MII_PHY_ANY		-1
 
 /*
+ * Constants used to describe the type of attachment between MAC and PHY.
+ */
+enum mii_contype {
+	MII_CONTYPE_UNKNOWN,	/* Must be have value 0. */
+
+	MII_CONTYPE_MII,
+	MII_CONTYPE_GMII,
+	MII_CONTYPE_SGMII,
+	MII_CONTYPE_QSGMII,
+	MII_CONTYPE_TBI,
+	MII_CONTYPE_REVMII,	/* Reverse MII */
+	MII_CONTYPE_RMII,
+	MII_CONTYPE_RGMII,	/* Delays provided by MAC or PCB */
+	MII_CONTYPE_RGMII_ID,	/* Rx and tx delays provided by PHY */
+	MII_CONTYPE_RGMII_RXID,	/* Only rx delay provided by PHY */
+	MII_CONTYPE_RGMII_TXID,	/* Only tx delay provided by PHY */
+	MII_CONTYPE_RTBI,
+	MII_CONTYPE_SMII,
+	MII_CONTYPE_XGMII,
+	MII_CONTYPE_TRGMII,
+	MII_CONTYPE_2000BX,
+	MII_CONTYPE_2500BX,
+	MII_CONTYPE_RXAUI,
+
+	MII_CONTYPE_COUNT	/* Add new types before this line. */
+};
+typedef enum mii_contype mii_contype_t;
+
+static inline bool
+mii_contype_is_rgmii(mii_contype_t con)
+{
+
+	return (con >= MII_CONTYPE_RGMII && con <= MII_CONTYPE_RGMII_TXID);
+}
+
+/*
  * Used to attach a PHY to a parent.
  */
 struct mii_attach_args {



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