1/*
2 * Misc Broadcom BCM47XX MDC/MDIO enet phy definitions.
3 *
4 * Copyright (C) 2010, Broadcom Corporation
5 * All Rights Reserved.
6 *
7 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
8 * the contents of this file may not be disclosed to third parties, copied
9 * or duplicated in any form, in whole or in part, without the prior
10 * written permission of Broadcom Corporation.
11 * $Id: bcmenetphy.h,v 13.4 2008/07/24 03:15:30 Exp $
12 */
13
14#ifndef	_bcmenetphy_h_
15#define	_bcmenetphy_h_
16
17/* phy address */
18#define	MAXEPHY		32			/* mdio phy addresses are 5bit quantities */
19#define	EPHY_MASK	0x1f			/* phy mask */
20#define	EPHY_NONE	31			/* nvram: no phy present at all */
21#define	EPHY_NOREG	30			/* nvram: no local phy regs */
22
23#define	MAXPHYREG	32			/* max 32 registers per phy */
24
25/* just a few phy registers */
26#define	CTL_RESET	(1 << 15)		/* reset */
27#define	CTL_LOOP	(1 << 14)		/* loopback */
28#define	CTL_SPEED	(1 << 13)		/* speed selection lsb 0=10, 1=100 */
29#define	CTL_ANENAB	(1 << 12)		/* autonegotiation enable */
30#define	CTL_RESTART	(1 << 9)		/* restart autonegotiation */
31#define	CTL_DUPLEX	(1 << 8)		/* duplex mode 0=half, 1=full */
32#define	CTL_SPEED_MSB	(1 << 6)		/* speed selection msb */
33
34#define	CTL_SPEED_10	((0 << 6) | (0 << 13))	/* speed selection CTL.6=0, CTL.13=0 */
35#define	CTL_SPEED_100	((0 << 6) | (1 << 13))	/* speed selection CTL.6=0, CTL.13=1 */
36#define	CTL_SPEED_1000	((1 << 6) | (0 << 13))	/* speed selection CTL.6=1, CTL.13=0 */
37
38#define	ADV_10FULL	(1 << 6)		/* autonegotiate advertise 10full */
39#define	ADV_10HALF	(1 << 5)		/* autonegotiate advertise 10half */
40#define	ADV_100FULL	(1 << 8)		/* autonegotiate advertise 100full */
41#define	ADV_100HALF	(1 << 7)		/* autonegotiate advertise 100half */
42
43/* link partner ability register */
44#define LPA_SLCT	0x001f			/* same as advertise selector */
45#define LPA_10HALF	0x0020			/* can do 10mbps half-duplex */
46#define LPA_10FULL	0x0040			/* can do 10mbps full-duplex */
47#define LPA_100HALF	0x0080			/* can do 100mbps half-duplex */
48#define LPA_100FULL	0x0100			/* can do 100mbps full-duplex */
49#define LPA_100BASE4	0x0200			/* can do 100mbps 4k packets */
50#define LPA_RESV	0x1c00			/* unused */
51#define LPA_RFAULT	0x2000			/* link partner faulted */
52#define LPA_LPACK	0x4000			/* link partner acked us */
53#define LPA_NPAGE	0x8000			/* next page bit */
54
55#define LPA_DUPLEX	(LPA_10FULL | LPA_100FULL)
56#define LPA_100		(LPA_100FULL | LPA_100HALF | LPA_100BASE4)
57
58/* 1000BASE-T control register */
59#define	ADV_1000HALF	0x0100			/* advertise 1000BASE-T half duplex */
60#define	ADV_1000FULL	0x0200			/* advertise 1000BASE-T full duplex */
61
62/* 1000BASE-T status register */
63#define	LPA_1000HALF	0x0400			/* link partner 1000BASE-T half duplex */
64#define	LPA_1000FULL	0x0800			/* link partner 1000BASE-T full duplex */
65
66/* 1000BASE-T extended status register */
67#define	EST_1000THALF	0x1000			/* 1000BASE-T half duplex capable */
68#define	EST_1000TFULL	0x2000			/* 1000BASE-T full duplex capable */
69#define	EST_1000XHALF	0x4000			/* 1000BASE-X half duplex capable */
70#define	EST_1000XFULL	0x8000			/* 1000BASE-X full duplex capable */
71
72#define	STAT_REMFAULT	(1 << 4)		/* remote fault */
73#define	STAT_LINK	(1 << 2)		/* link status */
74#define	STAT_JAB	(1 << 1)		/* jabber detected */
75#define	AUX_FORCED	(1 << 2)		/* forced 10/100 */
76#define	AUX_SPEED	(1 << 1)		/* speed 0=10mbps 1=100mbps */
77#define	AUX_DUPLEX	(1 << 0)		/* duplex 0=half 1=full */
78
79#endif	/* _bcmenetphy_h_ */
80