2 * Broadcom BCM5221 Ethernet PHY
4 * (C) Copyright 2005 REA Elektronik GmbH <www.rea.de>
5 * Anders Larsen <alarsen@rea.de>
7 * See file CREDITS for list of people who contributed to this
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 #define BCM5221_BMCR 0 /* Basic Mode Control Register */
27 #define BCM5221_BMSR 1 /* Basic Mode Status Register */
28 #define BCM5221_PHYID1 2 /* PHY Identifier Register 1 */
29 #define BCM5221_PHYID2 3 /* PHY Identifier Register 2 */
30 #define BCM5221_ANAR 4 /* Auto-negotiation Advertisement Register */
31 #define BCM5221_ANLPAR 5 /* Auto-negotiation Link Partner Ability Register */
32 #define BCM5221_ANER 6 /* Auto-negotiation Expansion Register */
33 #define BCM5221_ACSR 24 /* Auxiliary Control/Status Register */
34 #define BCM5221_INTR 26 /* Interrupt Register */
36 /* --Bit definitions: BCM5221_BMCR */
37 #define BCM5221_RESET (1 << 15) /* 1= Software Reset; 0=Normal Operation */
38 #define BCM5221_LOOPBACK (1 << 14) /* 1=loopback Enabled; 0=Normal Operation */
39 #define BCM5221_SPEED_SELECT (1 << 13) /* 1=100Mbps; 0=10Mbps */
40 #define BCM5221_AUTONEG (1 << 12)
41 #define BCM5221_POWER_DOWN (1 << 11)
42 #define BCM5221_ISOLATE (1 << 10)
43 #define BCM5221_RESTART_AUTONEG (1 << 9)
44 #define BCM5221_DUPLEX_MODE (1 << 8)
45 #define BCM5221_COLLISION_TEST (1 << 7)
47 /*--Bit definitions: BCM5221_BMSR */
48 #define BCM5221_100BASE_T4 (1 << 15)
49 #define BCM5221_100BASE_TX_FD (1 << 14)
50 #define BCM5221_100BASE_TX_HD (1 << 13)
51 #define BCM5221_10BASE_T_FD (1 << 12)
52 #define BCM5221_10BASE_T_HD (1 << 11)
53 #define BCM5221_MF_PREAMB_SUPPR (1 << 6)
54 #define BCM5221_AUTONEG_COMP (1 << 5)
55 #define BCM5221_REMOTE_FAULT (1 << 4)
56 #define BCM5221_AUTONEG_ABILITY (1 << 3)
57 #define BCM5221_LINK_STATUS (1 << 2)
58 #define BCM5221_JABBER_DETECT (1 << 1)
59 #define BCM5221_EXTEND_CAPAB (1 << 0)
61 /*--definitions: BCM5221_PHYID1 */
62 #define BCM5221_PHYID1_OUI 0x1018
63 #define BCM5221_LSB_MASK 0x3F
65 /*--Bit definitions: BCM5221_ANAR, BCM5221_ANLPAR */
66 #define BCM5221_NP (1 << 15)
67 #define BCM5221_ACK (1 << 14)
68 #define BCM5221_RF (1 << 13)
69 #define BCM5221_FCS (1 << 10)
70 #define BCM5221_T4 (1 << 9)
71 #define BCM5221_TX_FDX (1 << 8)
72 #define BCM5221_TX_HDX (1 << 7)
73 #define BCM5221_10_FDX (1 << 6)
74 #define BCM5221_10_HDX (1 << 5)
75 #define BCM5221_AN_IEEE_802_3 0x0001
77 /*--Bit definitions: BCM5221_ANER */
78 #define BCM5221_PDF (1 << 4)
79 #define BCM5221_LP_NP_ABLE (1 << 3)
80 #define BCM5221_NP_ABLE (1 << 2)
81 #define BCM5221_PAGE_RX (1 << 1)
82 #define BCM5221_LP_AN_ABLE (1 << 0)
84 /*--Bit definitions: BCM5221_ACSR */
85 #define BCM5221_100 (1 << 1)
86 #define BCM5221_FDX (1 << 0)
88 /*--Bit definitions: BCM5221_INTR */
89 #define BCM5221_FDX_LED (1 << 15)
90 #define BCM5221_INTR_ENABLE (1 << 14)
91 #define BCM5221_FDX_MASK (1 << 11)
92 #define BCM5221_SPD_MASK (1 << 10)
93 #define BCM5221_LINK_MASK (1 << 9)
94 #define BCM5221_INTR_MASK (1 << 8)
95 #define BCM5221_FDX_CHG (1 << 3)
96 #define BCM5221_SPD_CHG (1 << 2)
97 #define BCM5221_LINK_CHG (1 << 1)
98 #define BCM5221_INTR_STATUS (1 << 0)
100 /****************** function prototypes **********************/
101 unsigned int bcm5221_IsPhyConnected(AT91PS_EMAC p_mac);
102 unsigned char bcm5221_GetLinkSpeed(AT91PS_EMAC p_mac);
103 unsigned char bcm5221_AutoNegotiate(AT91PS_EMAC p_mac, int *status);
104 unsigned char bcm5221_InitPhy(AT91PS_EMAC p_mac);