1196239Simp/*	$NetBSD: mii_bitbang.h,v 1.6 2009/05/12 14:31:27 cegger Exp $	*/
2196239Simp
3196239Simp/*-
4196239Simp * Copyright (c) 1999 The NetBSD Foundation, Inc.
5196239Simp * All rights reserved.
6196239Simp *
7196239Simp * This code is derived from software contributed to The NetBSD Foundation
8196239Simp * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9196239Simp * NASA Ames Research Center.
10196239Simp *
11196239Simp * Redistribution and use in source and binary forms, with or without
12196239Simp * modification, are permitted provided that the following conditions
13196239Simp * are met:
14196239Simp * 1. Redistributions of source code must retain the above copyright
15196239Simp *    notice, this list of conditions and the following disclaimer.
16196239Simp * 2. Redistributions in binary form must reproduce the above copyright
17196239Simp *    notice, this list of conditions and the following disclaimer in the
18196239Simp *    documentation and/or other materials provided with the distribution.
19196239Simp *
20196239Simp * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21196239Simp * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22196239Simp * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23196239Simp * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24196239Simp * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25196239Simp * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26196239Simp * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27196239Simp * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28196239Simp * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29196239Simp * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30217612Sjmallett * POSSIBILITY OF SUCH DAMAGE.
31196239Simp *
32196239Simp * $FreeBSD$
33196239Simp */
34196239Simp
35196239Simp#define	MII_BIT_MDO		0	/* data out (host->PHY) */
36217655Simp#define	MII_BIT_MDI		1	/* data in (PHY->host) */
37196239Simp#define	MII_BIT_MDC		2	/* clock */
38196239Simp#define	MII_BIT_DIR_HOST_PHY	3	/* set direction: host->PHY */
39196239Simp#define	MII_BIT_DIR_PHY_HOST	4	/* set direction: PHY->host */
40197003Simp#define	MII_NBITS		5
41196239Simp
42196239Simpstruct mii_bitbang_ops {
43196239Simp	uint32_t	(*mbo_read)(device_t);
44196239Simp	void		(*mbo_write)(device_t, uint32_t);
45196239Simp	uint32_t	mbo_bits[MII_NBITS];
46196239Simp};
47196239Simp
48196239Simptypedef	const struct mii_bitbang_ops *mii_bitbang_ops_t;
49196239Simp
50196239Simpint	mii_bitbang_readreg(device_t dev, mii_bitbang_ops_t ops,
51196239Simp	    int phy, int reg);
52196239Simpvoid	mii_bitbang_sync(device_t dev, mii_bitbang_ops_t ops);
53196239Simpvoid	mii_bitbang_writereg(device_t dev, mii_bitbang_ops_t ops,
54196239Simp	    int phy, int reg, int val);
55196239Simp