1441d6780SZbigniew Bodek /*- 2441d6780SZbigniew Bodek * Copyright (c) 2015 The FreeBSD Foundation 3441d6780SZbigniew Bodek * 4441d6780SZbigniew Bodek * This software was developed by Semihalf under 5441d6780SZbigniew Bodek * the sponsorship of the FreeBSD Foundation. 6441d6780SZbigniew Bodek * 7441d6780SZbigniew Bodek * Redistribution and use in source and binary forms, with or without 8441d6780SZbigniew Bodek * modification, are permitted provided that the following conditions 9441d6780SZbigniew Bodek * are met: 10441d6780SZbigniew Bodek * 1. Redistributions of source code must retain the above copyright 11441d6780SZbigniew Bodek * notice, this list of conditions and the following disclaimer. 12441d6780SZbigniew Bodek * 2. Redistributions in binary form must reproduce the above copyright 13441d6780SZbigniew Bodek * notice, this list of conditions and the following disclaimer in the 14441d6780SZbigniew Bodek * documentation and/or other materials provided with the distribution. 15441d6780SZbigniew Bodek * 16441d6780SZbigniew Bodek * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17441d6780SZbigniew Bodek * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18441d6780SZbigniew Bodek * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19441d6780SZbigniew Bodek * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20441d6780SZbigniew Bodek * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21441d6780SZbigniew Bodek * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22441d6780SZbigniew Bodek * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23441d6780SZbigniew Bodek * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24441d6780SZbigniew Bodek * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25441d6780SZbigniew Bodek * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26441d6780SZbigniew Bodek * SUCH DAMAGE. 27441d6780SZbigniew Bodek * 28441d6780SZbigniew Bodek */ 29441d6780SZbigniew Bodek 30441d6780SZbigniew Bodek #ifndef __THUNDER_MDIO_VAR_H__ 31441d6780SZbigniew Bodek #define __THUNDER_MDIO_VAR_H__ 32441d6780SZbigniew Bodek 33441d6780SZbigniew Bodek #define THUNDER_MDIO_DEVSTR "Cavium ThunderX SMI/MDIO driver" 343f51d888SZbigniew Bodek MALLOC_DECLARE(M_THUNDER_MDIO); 35441d6780SZbigniew Bodek DECLARE_CLASS(thunder_mdio_driver); 36441d6780SZbigniew Bodek 37441d6780SZbigniew Bodek enum thunder_mdio_mode { 38441d6780SZbigniew Bodek MODE_NONE = 0, 39441d6780SZbigniew Bodek MODE_IEEE_C22, 40441d6780SZbigniew Bodek MODE_IEEE_C45 41441d6780SZbigniew Bodek }; 42441d6780SZbigniew Bodek 43441d6780SZbigniew Bodek struct phy_desc { 44441d6780SZbigniew Bodek device_t miibus; /* One miibus per LMAC */ 45*b9545c57SJustin Hibbits if_t ifp; /* Fake ifp to satisfy miibus */ 46441d6780SZbigniew Bodek int lmacid; /* ID number of LMAC connected */ 47441d6780SZbigniew Bodek TAILQ_ENTRY(phy_desc) phy_desc_list; 48441d6780SZbigniew Bodek }; 49441d6780SZbigniew Bodek 50441d6780SZbigniew Bodek struct thunder_mdio_softc { 51441d6780SZbigniew Bodek device_t dev; 52441d6780SZbigniew Bodek struct mtx mtx; 53441d6780SZbigniew Bodek struct resource * reg_base; 54441d6780SZbigniew Bodek 55441d6780SZbigniew Bodek enum thunder_mdio_mode mode; 56441d6780SZbigniew Bodek 57441d6780SZbigniew Bodek TAILQ_HEAD(,phy_desc) phy_desc_head; 58441d6780SZbigniew Bodek }; 59441d6780SZbigniew Bodek 60441d6780SZbigniew Bodek int thunder_mdio_attach(device_t); 61441d6780SZbigniew Bodek #endif 62