bmake-ify mii
[unleashed.git] / kernel / drivers / net / mii / mii_natsemi.c
blobe84c3f9d75035f0ef2a254f31637aa2d19606d9d
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
27 * MII overrides for National Semiconductor PHYs.
30 #include <sys/types.h>
31 #include <sys/ddi.h>
32 #include <sys/sunddi.h>
33 #include <sys/mii.h>
34 #include <sys/miiregs.h>
35 #include "miipriv.h"
37 static int
38 ns83840_reset(phy_handle_t *ph)
40 /* first do an ordinary reset */
41 if (phy_reset(ph) != DDI_SUCCESS) {
42 return (DDI_FAILURE);
46 * As per INTEL "PRO/100B Adapter Software Technical Reference
47 * Manual", set bit 10 of MII register 23. National
48 * Semiconductor documentation shows this as "reserved, write
49 * to as zero". We also set the "CIM_DIS" bit, also as
50 * requested by the PRO/100B doc, to disable the carrier
51 * integrity monitor. (That should only ever be used by
52 * repeaters.)
54 * NetBSD also sets bit 8, without any explanation, so we'll
55 * follow suit.
57 PHY_SET(ph, MII_VENDOR(7), (1<<10) | (1<<8) | (1<<5));
58 return (DDI_SUCCESS);
61 boolean_t
62 phy_natsemi_probe(phy_handle_t *ph)
64 /* We could even look at revA vs revC, etc. but there is no need. */
65 if ((MII_PHY_MFG(ph->phy_id) != MII_OUI_NATIONAL_SEMI) &&
66 (MII_PHY_MFG(ph->phy_id) != MII_OUI_NATIONAL_SEMI_2)) {
67 return (B_FALSE);
69 ph->phy_vendor = "National Semiconductor";
71 switch (MII_PHY_MODEL(ph->phy_id)) {
72 case MII_MODEL_NATIONAL_SEMI_DP83840:
73 ph->phy_model = "DP83840";
74 ph->phy_reset = ns83840_reset;
75 return (B_TRUE);
77 case MII_MODEL_NATIONAL_SEMI_DP83843:
78 ph->phy_model = "DP83843";
79 return (B_TRUE);
81 case MII_MODEL_NATIONAL_SEMI_DP83847:
82 ph->phy_model = "DP83847";
83 return (B_TRUE);
85 case MII_MODEL_NATIONAL_SEMI_DP83815:
86 ph->phy_model = "DP83815";
87 return (B_TRUE);
89 return (B_FALSE);