Home | History | Annotate | Line # | Download | only in mii
makphyreg.h revision 1.8
      1  1.7  jdolecek /*	$NetBSD: makphyreg.h,v 1.8 2018/12/25 08:33:52 msaitoh Exp $	*/
      2  1.1   thorpej 
      3  1.1   thorpej /*-
      4  1.1   thorpej  * Copyright (c) 2001 The NetBSD Foundation, Inc.
      5  1.1   thorpej  * All rights reserved.
      6  1.1   thorpej  *
      7  1.1   thorpej  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1   thorpej  * by Jason R. Thorpe.
      9  1.1   thorpej  *
     10  1.1   thorpej  * Redistribution and use in source and binary forms, with or without
     11  1.1   thorpej  * modification, are permitted provided that the following conditions
     12  1.1   thorpej  * are met:
     13  1.1   thorpej  * 1. Redistributions of source code must retain the above copyright
     14  1.1   thorpej  *    notice, this list of conditions and the following disclaimer.
     15  1.1   thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1   thorpej  *    notice, this list of conditions and the following disclaimer in the
     17  1.1   thorpej  *    documentation and/or other materials provided with the distribution.
     18  1.1   thorpej  *
     19  1.1   thorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  1.1   thorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  1.1   thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  1.1   thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  1.1   thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  1.1   thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  1.1   thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  1.1   thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  1.1   thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  1.1   thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  1.1   thorpej  * POSSIBILITY OF SUCH DAMAGE.
     30  1.1   thorpej  */
     31  1.1   thorpej 
     32  1.1   thorpej #ifndef _DEV_MII_MAKPHYREG_H_
     33  1.1   thorpej #define	_DEV_MII_MAKPHYREG_H_
     34  1.1   thorpej 
     35  1.1   thorpej /*
     36  1.1   thorpej  * Marvell 88E1000 ``Alaska'' 10/100/1000 PHY registers.
     37  1.1   thorpej  */
     38  1.1   thorpej 
     39  1.1   thorpej #define	MII_MAKPHY_PSCR		0x10	/* PHY specific control register */
     40  1.1   thorpej #define	PSCR_DIS_JABBER		(1U << 0)   /* disable jabber */
     41  1.1   thorpej #define	PSCR_POL_REV		(1U << 1)   /* polarity reversal */
     42  1.1   thorpej #define	PSCR_SQE_TEST		(1U << 2)   /* SQE test */
     43  1.1   thorpej #define	PSCR_MBO		(1U << 3)   /* must be one */
     44  1.1   thorpej #define	PSCR_DIS_125CLK		(1U << 4)   /* 125CLK low */
     45  1.1   thorpej #define	PSCR_MDI_XOVER_MODE(x)	((x) << 5)  /* crossover mode */
     46  1.2       wiz #define	PSCR_LOW_10T_THRESH	(1U << 7)   /* lower 10BASE-T Rx threshold */
     47  1.1   thorpej #define	PSCR_FORCE_LINK_GOOD	(1U << 10)  /* force link good */
     48  1.1   thorpej #define	PSCR_CRS_ON_TX		(1U << 11)  /* assert CRS on transmit */
     49  1.1   thorpej #define	PSCR_RX_FIFO(x)		((x) << 12) /* Rx FIFO depth */
     50  1.1   thorpej #define	PSCR_TX_FIFO(x)		((x) << 14) /* Tx FIFO depth */
     51  1.1   thorpej 
     52  1.1   thorpej #define	XOVER_MODE_MDI		0
     53  1.1   thorpej #define	XOVER_MODE_MDIX		1
     54  1.1   thorpej #define	XOVER_MODE_AUTO		2
     55  1.1   thorpej 
     56  1.1   thorpej #define	MII_MAKPHY_PSSR		0x11	/* PHY specific status register */
     57  1.1   thorpej #define	PSSR_JABBER		(1U << 0)   /* jabber indication */
     58  1.1   thorpej #define	PSSR_POLARITY		(1U << 1)   /* polarity indiciation */
     59  1.1   thorpej #define	PSSR_MDIX		(1U << 6)   /* 1 = MIDX, 0 = MDI */
     60  1.1   thorpej #define	PSSR_CABLE_LENGTH_get(x) (((x) >> 7) & 0x3)
     61  1.1   thorpej #define	PSSR_LINK		(1U << 10)  /* link indication */
     62  1.1   thorpej #define	PSSR_RESOLVED		(1U << 11)  /* speed and duplex resolved */
     63  1.1   thorpej #define	PSSR_PAGE_RECEIVED	(1U << 12)  /* page received */
     64  1.1   thorpej #define	PSSR_DUPLEX		(1U << 13)  /* 1 = FDX */
     65  1.1   thorpej #define	PSSR_SPEED_get(x)	(((x) >> 14) & 0x3)
     66  1.1   thorpej 
     67  1.1   thorpej #define	SPEED_10		0
     68  1.1   thorpej #define	SPEED_100		1
     69  1.1   thorpej #define	SPEED_1000		2
     70  1.1   thorpej #define	SPEED_reserved		3
     71  1.1   thorpej 
     72  1.1   thorpej #define	MII_MAKPHY_IE		0x12	/* Interrupt enable */
     73  1.1   thorpej #define	IE_JABBER		(1U << 0)   /* jabber indication */
     74  1.1   thorpej #define	IE_POL_CHANGED		(1U << 1)   /* polarity changed */
     75  1.1   thorpej #define	IE_MDI_XOVER_CHANGED	(1U << 6)   /* MDI/MDIX changed */
     76  1.1   thorpej #define	IE_FIFO_OVER_UNDER	(1U << 7)   /* FIFO over/underflow */
     77  1.1   thorpej #define	IE_FALSE_CARRIER	(1U << 8)   /* false carrier detected */
     78  1.1   thorpej #define	IE_SYMBOL_ERROR		(1U << 9)   /* symbol error occurred */
     79  1.1   thorpej #define	IE_LINK_CHANGED		(1U << 10)  /* link status changed */
     80  1.1   thorpej #define	IE_ANEG_COMPLETE	(1U << 11)  /* autonegotiation completed */
     81  1.1   thorpej #define	IE_PAGE_RECEIVED	(1U << 12)  /* page received */
     82  1.1   thorpej #define	IE_DUPLEX_CHANGED	(1U << 13)  /* duplex changed */
     83  1.1   thorpej #define	IE_SPEED_CHANGED	(1U << 14)  /* speed changed */
     84  1.1   thorpej #define	IE_ANEG_ERROR		(1U << 15)  /* autonegotiation error occurred */
     85  1.1   thorpej 
     86  1.1   thorpej #define	MII_MAKPHY_IS		0x13	/* Interrupt status */
     87  1.1   thorpej 	/* See Interrupt enable bits */
     88  1.1   thorpej 
     89  1.1   thorpej #define	MII_MAKPHY_EPSC		0x14	/* extended PHY specific control */
     90  1.1   thorpej #define	EPSC_TX_CLK(x)		((x) << 4)  /* transmit clock */
     91  1.5   msaitoh #define	EPSC_TBI_RCLK_DIS	(1U << 12)  /* TBI RCLK disable */
     92  1.5   msaitoh #define	EPSC_TBI_RX_CLK125_EN	(1U << 13)  /* TBI RX_CLK125 enable */
     93  1.1   thorpej #define	EPSC_LINK_DOWN_NO_IDLES	(1U << 15)  /* 1 = lost lock detect */
     94  1.1   thorpej 
     95  1.1   thorpej #define	MII_MAKPHY_REC		0x15	/* receive error counter */
     96  1.1   thorpej 
     97  1.6  christos #define	MII_MAKPHY_EADR		0x16	/* extended address register */
     98  1.6  christos 
     99  1.1   thorpej #define	MII_MAKPHY_LEDCTRL	0x18	/* LED control */
    100  1.1   thorpej #define	LEDCTRL_LED_TX		(1U << 0)   /* 1 = activ/link, 0 = xmit */
    101  1.1   thorpej #define	LEDCTRL_LED_RX		(1U << 1)   /* 1 = activ/link, 1 = recv */
    102  1.1   thorpej #define	LEDCTRL_LED_DUPLEX	(1U << 2)   /* 1 = duplex, 0 = dup/coll */
    103  1.1   thorpej #define	LEDCTRL_LED_LINK	(1U << 3)   /* 1 = spd/link, 0 = link */
    104  1.1   thorpej #define	LEDCTRL_BLINK_RATE(x)	((x) << 8)
    105  1.1   thorpej #define	LEDCTRL_PULSE_STRCH(x)	((x) << 12)
    106  1.1   thorpej #define	LEDCTRL_DISABLE		(1U << 15)  /* disable LED */
    107  1.1   thorpej 
    108  1.6  christos #define MII_MAKPHY_ESSR		0x1b    /* Extended PHY specific status */
    109  1.6  christos #define ESSR_FIBER_LINK		0x2000
    110  1.6  christos #define ESSR_GMII_COPPER	0x000f
    111  1.6  christos #define ESSR_GMII_FIBER		0x0007
    112  1.6  christos #define ESSR_TBI_COPPER		0x000d
    113  1.6  christos #define ESSR_TBI_FIBER		0x0005
    114  1.6  christos 
    115  1.6  christos 
    116  1.1   thorpej #endif /* _DEV_MII_MAKPHYREG_H_ */
    117