From owner-svn-src-head@freebsd.org Sat Jun 10 23:55:15 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3745BBF893D; Sat, 10 Jun 2017 23:55:15 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F1649672CA; Sat, 10 Jun 2017 23:55:14 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5ANtDIr047388; Sat, 10 Jun 2017 23:55:13 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5ANtDc1047387; Sat, 10 Jun 2017 23:55:13 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201706102355.v5ANtDc1047387@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 10 Jun 2017 23:55:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r319814 - head/sys/dev/mii X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jun 2017 23:55:15 -0000 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 {