11844Swollman/*	$NetBSD: mii_bitbang.h,v 1.6 2009/05/12 14:31:27 cegger Exp $	*/
250476Speter
31844Swollman/*-
41638Srgrimes * Copyright (c) 1999 The NetBSD Foundation, Inc.
594940Sru * All rights reserved.
61638Srgrimes *
742915Sjdp * This code is derived from software contributed to The NetBSD Foundation
842915Sjdp * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
942915Sjdp * NASA Ames Research Center.
1042915Sjdp *
1142915Sjdp * Redistribution and use in source and binary forms, with or without
1242915Sjdp * modification, are permitted provided that the following conditions
1342915Sjdp * are met:
1442915Sjdp * 1. Redistributions of source code must retain the above copyright
1599362Sru *    notice, this list of conditions and the following disclaimer.
1642915Sjdp * 2. Redistributions in binary form must reproduce the above copyright
1729141Speter *    notice, this list of conditions and the following disclaimer in the
18100375Sru *    documentation and/or other materials provided with the distribution.
19100332Sru *
20100332Sru * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
2142915Sjdp * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2242915Sjdp * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2329141Speter * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24117034Sgordon * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25117034Sgordon * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
262827Sjkh * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
272827Sjkh * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
282827Sjkh * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
292827Sjkh * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
302827Sjkh * POSSIBILITY OF SUCH DAMAGE.
311638Srgrimes *
322827Sjkh * $FreeBSD$
331638Srgrimes */
3418529Sbde
3518529Sbde#define	MII_BIT_MDO		0	/* data out (host->PHY) */
361638Srgrimes#define	MII_BIT_MDI		1	/* data in (PHY->host) */
3742450Sjdp#define	MII_BIT_MDC		2	/* clock */
381638Srgrimes#define	MII_BIT_DIR_HOST_PHY	3	/* set direction: host->PHY */
39117173Sru#define	MII_BIT_DIR_PHY_HOST	4	/* set direction: PHY->host */
401638Srgrimes#define	MII_NBITS		5
4196512Sru
4296512Srustruct mii_bitbang_ops {
4396512Sru	uint32_t	(*mbo_read)(device_t);
4496512Sru	void		(*mbo_write)(device_t, uint32_t);
4596512Sru	uint32_t	mbo_bits[MII_NBITS];
4696512Sru};
4796512Sru
4896512Srutypedef	const struct mii_bitbang_ops *mii_bitbang_ops_t;
491638Srgrimes
5024761Sjdpint	mii_bitbang_readreg(device_t dev, mii_bitbang_ops_t ops,
511638Srgrimes	    int phy, int reg);
5242450Sjdpvoid	mii_bitbang_sync(device_t dev, mii_bitbang_ops_t ops);
531844Swollmanvoid	mii_bitbang_writereg(device_t dev, mii_bitbang_ops_t ops,
541844Swollman	    int phy, int reg, int val);
5536673Sdt