xref: /onnv-gate/usr/src/uts/common/io/mii/mii_cicada.c (revision 9860:20e31304c39b)
1*9860Sgdamore@opensolaris.org /*
2*9860Sgdamore@opensolaris.org  * CDDL HEADER START
3*9860Sgdamore@opensolaris.org  *
4*9860Sgdamore@opensolaris.org  * The contents of this file are subject to the terms of the
5*9860Sgdamore@opensolaris.org  * Common Development and Distribution License (the "License").
6*9860Sgdamore@opensolaris.org  * You may not use this file except in compliance with the License.
7*9860Sgdamore@opensolaris.org  *
8*9860Sgdamore@opensolaris.org  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*9860Sgdamore@opensolaris.org  * or http://www.opensolaris.org/os/licensing.
10*9860Sgdamore@opensolaris.org  * See the License for the specific language governing permissions
11*9860Sgdamore@opensolaris.org  * and limitations under the License.
12*9860Sgdamore@opensolaris.org  *
13*9860Sgdamore@opensolaris.org  * When distributing Covered Code, include this CDDL HEADER in each
14*9860Sgdamore@opensolaris.org  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*9860Sgdamore@opensolaris.org  * If applicable, add the following below this CDDL HEADER, with the
16*9860Sgdamore@opensolaris.org  * fields enclosed by brackets "[]" replaced with your own identifying
17*9860Sgdamore@opensolaris.org  * information: Portions Copyright [yyyy] [name of copyright owner]
18*9860Sgdamore@opensolaris.org  *
19*9860Sgdamore@opensolaris.org  * CDDL HEADER END
20*9860Sgdamore@opensolaris.org  */
21*9860Sgdamore@opensolaris.org /*
22*9860Sgdamore@opensolaris.org  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23*9860Sgdamore@opensolaris.org  * Use is subject to license terms.
24*9860Sgdamore@opensolaris.org  */
25*9860Sgdamore@opensolaris.org 
26*9860Sgdamore@opensolaris.org /*
27*9860Sgdamore@opensolaris.org  * MII overrides for Cicada (now Vitesse) PHYs.
28*9860Sgdamore@opensolaris.org  */
29*9860Sgdamore@opensolaris.org 
30*9860Sgdamore@opensolaris.org #include <sys/types.h>
31*9860Sgdamore@opensolaris.org #include <sys/ddi.h>
32*9860Sgdamore@opensolaris.org #include <sys/sunddi.h>
33*9860Sgdamore@opensolaris.org #include <sys/mii.h>
34*9860Sgdamore@opensolaris.org #include <sys/miiregs.h>
35*9860Sgdamore@opensolaris.org #include "miipriv.h"
36*9860Sgdamore@opensolaris.org 
37*9860Sgdamore@opensolaris.org #define	MII_CICADA_BYPASS_CONTROL	MII_VENDOR(2)
38*9860Sgdamore@opensolaris.org #define	CICADA_125MHZ_CLOCK_ENABLE	0x0001
39*9860Sgdamore@opensolaris.org 
40*9860Sgdamore@opensolaris.org #define	MII_CICADA_10BASET_CONTROL	MII_VENDOR(6)
41*9860Sgdamore@opensolaris.org #define	MII_CICADA_DISABLE_ECHO_MODE	0x2000
42*9860Sgdamore@opensolaris.org 
43*9860Sgdamore@opensolaris.org #define	MII_CICADA_EXT_CONTROL		MII_VENDOR(7)
44*9860Sgdamore@opensolaris.org #define	MII_CICADA_MODE_SELECT_BITS 	0xf000
45*9860Sgdamore@opensolaris.org #define	MII_CICADA_MODE_SELECT_RGMII	0x1000
46*9860Sgdamore@opensolaris.org #define	MII_CICADA_POWER_SUPPLY_BITS	0x0e00
47*9860Sgdamore@opensolaris.org #define	MII_CICADA_POWER_SUPPLY_3_3V	0x0000
48*9860Sgdamore@opensolaris.org #define	MII_CICADA_POWER_SUPPLY_2_5V	0x0200
49*9860Sgdamore@opensolaris.org 
50*9860Sgdamore@opensolaris.org #define	MII_CICADA_AUXCTRL_STATUS	MII_VENDOR(12)
51*9860Sgdamore@opensolaris.org #define	MII_CICADA_PIN_PRORITY_SETTING	0x0004
52*9860Sgdamore@opensolaris.org #define	MII_CICADA_PIN_PRORITY_DEFAULT	0x0000
53*9860Sgdamore@opensolaris.org 
54*9860Sgdamore@opensolaris.org /*
55*9860Sgdamore@opensolaris.org  * The nge driver seems to do some rather specialized programming of
56*9860Sgdamore@opensolaris.org  * this PHY.  Specifically, it appears that the PHY is programmed for
57*9860Sgdamore@opensolaris.org  * 2.5 RGMII operation and the PIN_PRIOITY_SETTING is set for RGMII
58*9860Sgdamore@opensolaris.org  * interfaces.  For MII interfaces, the echo mode is disabled and the
59*9860Sgdamore@opensolaris.org  * 125MHz clock is disabled.
60*9860Sgdamore@opensolaris.org  *
61*9860Sgdamore@opensolaris.org  * It isn't immediately clear to me how to cleanly do this.  One could
62*9860Sgdamore@opensolaris.org  * probably argue that this particular PHY would never ever be used in
63*9860Sgdamore@opensolaris.org  * a strict MII setting, but I hate to make an incorrect assumption.
64*9860Sgdamore@opensolaris.org  *
65*9860Sgdamore@opensolaris.org  * For now, absent data sheets on this part, we're going just leave
66*9860Sgdamore@opensolaris.org  * the code for this in nge.
67*9860Sgdamore@opensolaris.org  *
68*9860Sgdamore@opensolaris.org  * If someone has data sheets and can "prove" that the architecture
69*9860Sgdamore@opensolaris.org  * works portably across drivers, revisiting this logic and adding code
70*9860Sgdamore@opensolaris.org  * to handle these PHYs would be cleaner.
71*9860Sgdamore@opensolaris.org  */
72*9860Sgdamore@opensolaris.org boolean_t
phy_cicada_probe(phy_handle_t * ph)73*9860Sgdamore@opensolaris.org phy_cicada_probe(phy_handle_t *ph)
74*9860Sgdamore@opensolaris.org {
75*9860Sgdamore@opensolaris.org 	switch (MII_PHY_MFG(ph->phy_id)) {
76*9860Sgdamore@opensolaris.org 	case MII_OUI_CICADA:
77*9860Sgdamore@opensolaris.org 	case MII_OUI_CICADA_2:
78*9860Sgdamore@opensolaris.org 		switch (MII_PHY_MODEL(ph->phy_id)) {
79*9860Sgdamore@opensolaris.org 		case MII_MODEL_CICADA_CS8201:
80*9860Sgdamore@opensolaris.org 		case MII_MODEL_CICADA_CS8201A:
81*9860Sgdamore@opensolaris.org 		case MII_MODEL_CICADA_CS8201B:
82*9860Sgdamore@opensolaris.org 			ph->phy_vendor = "Cicada";
83*9860Sgdamore@opensolaris.org 			ph->phy_model = "CS8201";
84*9860Sgdamore@opensolaris.org 			return (B_TRUE);
85*9860Sgdamore@opensolaris.org 		default:
86*9860Sgdamore@opensolaris.org 			break;
87*9860Sgdamore@opensolaris.org 		}
88*9860Sgdamore@opensolaris.org 		break;
89*9860Sgdamore@opensolaris.org 
90*9860Sgdamore@opensolaris.org 	default:
91*9860Sgdamore@opensolaris.org 		break;
92*9860Sgdamore@opensolaris.org 	}
93*9860Sgdamore@opensolaris.org 
94*9860Sgdamore@opensolaris.org 	return (B_FALSE);
95*9860Sgdamore@opensolaris.org }
96