aboutsummaryrefslogtreecommitdiff
path: root/include/bcm5221.h
blob: 61424b12761dc30e7335ab5b1435529c904fcb96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
 * Broadcom BCM5221 Ethernet PHY
 *
 * (C) Copyright 2005 REA Elektronik GmbH <www.rea.de>
 * Anders Larsen <alarsen@rea.de>
 *
 * See file CREDITS for list of people who contributed to this
 * project.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 * MA 02111-1307 USA
 */

#define	BCM5221_BMCR		0	/* Basic Mode Control Register */
#define BCM5221_BMSR		1	/* Basic Mode Status Register */
#define BCM5221_PHYID1		2	/* PHY Identifier Register 1 */
#define BCM5221_PHYID2		3	/* PHY Identifier Register 2 */
#define BCM5221_ANAR		4	/* Auto-negotiation Advertisement Register  */
#define BCM5221_ANLPAR		5	/* Auto-negotiation Link Partner Ability Register */
#define BCM5221_ANER		6	/* Auto-negotiation Expansion Register  */
#define BCM5221_ACSR		24	/* Auxiliary Control/Status Register */
#define BCM5221_INTR		26	/* Interrupt Register */

/* --Bit definitions: BCM5221_BMCR */
#define BCM5221_RESET		(1 << 15)	/* 1= Software Reset; 0=Normal Operation */
#define BCM5221_LOOPBACK	(1 << 14)	/* 1=loopback Enabled; 0=Normal Operation */
#define BCM5221_SPEED_SELECT	(1 << 13)	/* 1=100Mbps; 0=10Mbps */
#define BCM5221_AUTONEG		(1 << 12)
#define BCM5221_POWER_DOWN	(1 << 11)
#define BCM5221_ISOLATE		(1 << 10)
#define BCM5221_RESTART_AUTONEG	(1 << 9)
#define BCM5221_DUPLEX_MODE	(1 << 8)
#define BCM5221_COLLISION_TEST	(1 << 7)

/*--Bit definitions: BCM5221_BMSR */
#define BCM5221_100BASE_T4	(1 << 15)
#define BCM5221_100BASE_TX_FD	(1 << 14)
#define BCM5221_100BASE_TX_HD	(1 << 13)
#define BCM5221_10BASE_T_FD	(1 << 12)
#define BCM5221_10BASE_T_HD	(1 << 11)
#define BCM5221_MF_PREAMB_SUPPR	(1 << 6)
#define BCM5221_AUTONEG_COMP	(1 << 5)
#define BCM5221_REMOTE_FAULT	(1 << 4)
#define BCM5221_AUTONEG_ABILITY	(1 << 3)
#define BCM5221_LINK_STATUS	(1 << 2)
#define BCM5221_JABBER_DETECT	(1 << 1)
#define BCM5221_EXTEND_CAPAB	(1 << 0)

/*--definitions: BCM5221_PHYID1 */
#define BCM5221_PHYID1_OUI	0x1018
#define BCM5221_LSB_MASK	0x3F

/*--Bit definitions: BCM5221_ANAR, BCM5221_ANLPAR */
#define BCM5221_NP		(1 << 15)
#define BCM5221_ACK		(1 << 14)
#define BCM5221_RF		(1 << 13)
#define BCM5221_FCS		(1 << 10)
#define BCM5221_T4		(1 << 9)
#define BCM5221_TX_FDX		(1 << 8)
#define BCM5221_TX_HDX		(1 << 7)
#define BCM5221_10_FDX		(1 << 6)
#define BCM5221_10_HDX		(1 << 5)
#define BCM5221_AN_IEEE_802_3	0x0001

/*--Bit definitions: BCM5221_ANER */
#define BCM5221_PDF		(1 << 4)
#define BCM5221_LP_NP_ABLE	(1 << 3)
#define BCM5221_NP_ABLE		(1 << 2)
#define BCM5221_PAGE_RX		(1 << 1)
#define BCM5221_LP_AN_ABLE	(1 << 0)

/*--Bit definitions: BCM5221_ACSR */
#define BCM5221_100		(1 << 1)
#define BCM5221_FDX		(1 << 0)

/*--Bit definitions: BCM5221_INTR */
#define BCM5221_FDX_LED		(1 << 15)
#define BCM5221_INTR_ENABLE	(1 << 14)
#define BCM5221_FDX_MASK	(1 << 11)
#define BCM5221_SPD_MASK	(1 << 10)
#define BCM5221_LINK_MASK	(1 << 9)
#define BCM5221_INTR_MASK	(1 << 8)
#define BCM5221_FDX_CHG		(1 << 3)
#define BCM5221_SPD_CHG		(1 << 2)
#define BCM5221_LINK_CHG	(1 << 1)
#define BCM5221_INTR_STATUS	(1 << 0)

/******************  function prototypes **********************/
unsigned int  bcm5221_IsPhyConnected(AT91PS_EMAC p_mac);
unsigned char bcm5221_GetLinkSpeed(AT91PS_EMAC p_mac);
unsigned char bcm5221_AutoNegotiate(AT91PS_EMAC p_mac, int *status);
unsigned char bcm5221_InitPhy(AT91PS_EMAC p_mac);