blob: 4719389cfdc893e261e192fc90b8c047552163e8 [file] [log] [blame]
Wolfgang Denk645da512005-10-05 02:00:09 +02001/*
2 * Broadcom BCM5221 Ethernet PHY
3 *
4 * (C) Copyright 2005 REA Elektronik GmbH <www.rea.de>
5 * Anders Larsen <alarsen@rea.de>
6 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02007 * SPDX-License-Identifier: GPL-2.0+
Wolfgang Denk645da512005-10-05 02:00:09 +02008 */
9
Wolfgang Denk53677ef2008-05-20 16:00:29 +020010#define BCM5221_BMCR 0 /* Basic Mode Control Register */
Wolfgang Denk645da512005-10-05 02:00:09 +020011#define BCM5221_BMSR 1 /* Basic Mode Status Register */
12#define BCM5221_PHYID1 2 /* PHY Identifier Register 1 */
13#define BCM5221_PHYID2 3 /* PHY Identifier Register 2 */
14#define BCM5221_ANAR 4 /* Auto-negotiation Advertisement Register */
15#define BCM5221_ANLPAR 5 /* Auto-negotiation Link Partner Ability Register */
16#define BCM5221_ANER 6 /* Auto-negotiation Expansion Register */
17#define BCM5221_ACSR 24 /* Auxiliary Control/Status Register */
18#define BCM5221_INTR 26 /* Interrupt Register */
19
20/* --Bit definitions: BCM5221_BMCR */
21#define BCM5221_RESET (1 << 15) /* 1= Software Reset; 0=Normal Operation */
22#define BCM5221_LOOPBACK (1 << 14) /* 1=loopback Enabled; 0=Normal Operation */
23#define BCM5221_SPEED_SELECT (1 << 13) /* 1=100Mbps; 0=10Mbps */
24#define BCM5221_AUTONEG (1 << 12)
25#define BCM5221_POWER_DOWN (1 << 11)
26#define BCM5221_ISOLATE (1 << 10)
27#define BCM5221_RESTART_AUTONEG (1 << 9)
28#define BCM5221_DUPLEX_MODE (1 << 8)
29#define BCM5221_COLLISION_TEST (1 << 7)
30
31/*--Bit definitions: BCM5221_BMSR */
32#define BCM5221_100BASE_T4 (1 << 15)
33#define BCM5221_100BASE_TX_FD (1 << 14)
34#define BCM5221_100BASE_TX_HD (1 << 13)
35#define BCM5221_10BASE_T_FD (1 << 12)
36#define BCM5221_10BASE_T_HD (1 << 11)
37#define BCM5221_MF_PREAMB_SUPPR (1 << 6)
38#define BCM5221_AUTONEG_COMP (1 << 5)
39#define BCM5221_REMOTE_FAULT (1 << 4)
40#define BCM5221_AUTONEG_ABILITY (1 << 3)
41#define BCM5221_LINK_STATUS (1 << 2)
42#define BCM5221_JABBER_DETECT (1 << 1)
43#define BCM5221_EXTEND_CAPAB (1 << 0)
44
45/*--definitions: BCM5221_PHYID1 */
46#define BCM5221_PHYID1_OUI 0x1018
47#define BCM5221_LSB_MASK 0x3F
48
49/*--Bit definitions: BCM5221_ANAR, BCM5221_ANLPAR */
50#define BCM5221_NP (1 << 15)
51#define BCM5221_ACK (1 << 14)
52#define BCM5221_RF (1 << 13)
53#define BCM5221_FCS (1 << 10)
54#define BCM5221_T4 (1 << 9)
55#define BCM5221_TX_FDX (1 << 8)
56#define BCM5221_TX_HDX (1 << 7)
57#define BCM5221_10_FDX (1 << 6)
58#define BCM5221_10_HDX (1 << 5)
59#define BCM5221_AN_IEEE_802_3 0x0001
60
61/*--Bit definitions: BCM5221_ANER */
62#define BCM5221_PDF (1 << 4)
63#define BCM5221_LP_NP_ABLE (1 << 3)
64#define BCM5221_NP_ABLE (1 << 2)
65#define BCM5221_PAGE_RX (1 << 1)
66#define BCM5221_LP_AN_ABLE (1 << 0)
67
68/*--Bit definitions: BCM5221_ACSR */
69#define BCM5221_100 (1 << 1)
70#define BCM5221_FDX (1 << 0)
71
72/*--Bit definitions: BCM5221_INTR */
73#define BCM5221_FDX_LED (1 << 15)
74#define BCM5221_INTR_ENABLE (1 << 14)
75#define BCM5221_FDX_MASK (1 << 11)
76#define BCM5221_SPD_MASK (1 << 10)
77#define BCM5221_LINK_MASK (1 << 9)
78#define BCM5221_INTR_MASK (1 << 8)
79#define BCM5221_FDX_CHG (1 << 3)
80#define BCM5221_SPD_CHG (1 << 2)
81#define BCM5221_LINK_CHG (1 << 1)
82#define BCM5221_INTR_STATUS (1 << 0)
83
84/****************** function prototypes **********************/
85unsigned int bcm5221_IsPhyConnected(AT91PS_EMAC p_mac);
86unsigned char bcm5221_GetLinkSpeed(AT91PS_EMAC p_mac);
87unsigned char bcm5221_AutoNegotiate(AT91PS_EMAC p_mac, int *status);
88unsigned char bcm5221_InitPhy(AT91PS_EMAC p_mac);