1226995Smarius/* $NetBSD: mii_bitbang.h,v 1.6 2009/05/12 14:31:27 cegger Exp $ */ 2226995Smarius 3226995Smarius/*- 4226995Smarius * Copyright (c) 1999 The NetBSD Foundation, Inc. 5226995Smarius * All rights reserved. 6226995Smarius * 7226995Smarius * This code is derived from software contributed to The NetBSD Foundation 8226995Smarius * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 9226995Smarius * NASA Ames Research Center. 10226995Smarius * 11226995Smarius * Redistribution and use in source and binary forms, with or without 12226995Smarius * modification, are permitted provided that the following conditions 13226995Smarius * are met: 14226995Smarius * 1. Redistributions of source code must retain the above copyright 15226995Smarius * notice, this list of conditions and the following disclaimer. 16226995Smarius * 2. Redistributions in binary form must reproduce the above copyright 17226995Smarius * notice, this list of conditions and the following disclaimer in the 18226995Smarius * documentation and/or other materials provided with the distribution. 19226995Smarius * 20226995Smarius * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 21226995Smarius * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22226995Smarius * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23226995Smarius * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 24226995Smarius * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25226995Smarius * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26226995Smarius * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27226995Smarius * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28226995Smarius * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29226995Smarius * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30226995Smarius * POSSIBILITY OF SUCH DAMAGE. 31226995Smarius * 32226995Smarius * $FreeBSD$ 33226995Smarius */ 34226995Smarius 35226995Smarius#define MII_BIT_MDO 0 /* data out (host->PHY) */ 36226995Smarius#define MII_BIT_MDI 1 /* data in (PHY->host) */ 37226995Smarius#define MII_BIT_MDC 2 /* clock */ 38226995Smarius#define MII_BIT_DIR_HOST_PHY 3 /* set direction: host->PHY */ 39226995Smarius#define MII_BIT_DIR_PHY_HOST 4 /* set direction: PHY->host */ 40226995Smarius#define MII_NBITS 5 41226995Smarius 42226995Smariusstruct mii_bitbang_ops { 43226995Smarius uint32_t (*mbo_read)(device_t); 44226995Smarius void (*mbo_write)(device_t, uint32_t); 45226995Smarius uint32_t mbo_bits[MII_NBITS]; 46226995Smarius}; 47226995Smarius 48226995Smariustypedef const struct mii_bitbang_ops *mii_bitbang_ops_t; 49226995Smarius 50226995Smariusint mii_bitbang_readreg(device_t dev, mii_bitbang_ops_t ops, 51226995Smarius int phy, int reg); 52226995Smariusvoid mii_bitbang_sync(device_t dev, mii_bitbang_ops_t ops); 53226995Smariusvoid mii_bitbang_writereg(device_t dev, mii_bitbang_ops_t ops, 54226995Smarius int phy, int reg, int val); 55