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).
This commit is contained in:
Ian Lepore 2017-06-10 23:55:13 +00:00
parent f5c49e5c89
commit 0f75981ae9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=319814

View File

@ -155,6 +155,42 @@ typedef struct mii_softc mii_softc_t;
#define MII_OFFSET_ANY -1
#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.
*/