19860Sgdamore@opensolaris.org /*
29860Sgdamore@opensolaris.org * CDDL HEADER START
39860Sgdamore@opensolaris.org *
49860Sgdamore@opensolaris.org * The contents of this file are subject to the terms of the
59860Sgdamore@opensolaris.org * Common Development and Distribution License (the "License").
69860Sgdamore@opensolaris.org * You may not use this file except in compliance with the License.
79860Sgdamore@opensolaris.org *
89860Sgdamore@opensolaris.org * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
99860Sgdamore@opensolaris.org * or http://www.opensolaris.org/os/licensing.
109860Sgdamore@opensolaris.org * See the License for the specific language governing permissions
119860Sgdamore@opensolaris.org * and limitations under the License.
129860Sgdamore@opensolaris.org *
139860Sgdamore@opensolaris.org * When distributing Covered Code, include this CDDL HEADER in each
149860Sgdamore@opensolaris.org * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
159860Sgdamore@opensolaris.org * If applicable, add the following below this CDDL HEADER, with the
169860Sgdamore@opensolaris.org * fields enclosed by brackets "[]" replaced with your own identifying
179860Sgdamore@opensolaris.org * information: Portions Copyright [yyyy] [name of copyright owner]
189860Sgdamore@opensolaris.org *
199860Sgdamore@opensolaris.org * CDDL HEADER END
209860Sgdamore@opensolaris.org */
219860Sgdamore@opensolaris.org /*
2211717Sgdamore@opensolaris.org * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
239860Sgdamore@opensolaris.org * Use is subject to license terms.
249860Sgdamore@opensolaris.org */
259860Sgdamore@opensolaris.org
269860Sgdamore@opensolaris.org /*
27*11949Sstallion@opensolaris.org * MII overrides for other PHYs.
289860Sgdamore@opensolaris.org */
299860Sgdamore@opensolaris.org
309860Sgdamore@opensolaris.org #include <sys/types.h>
319860Sgdamore@opensolaris.org #include <sys/ddi.h>
329860Sgdamore@opensolaris.org #include <sys/sunddi.h>
339860Sgdamore@opensolaris.org #include <sys/mii.h>
349860Sgdamore@opensolaris.org #include <sys/miiregs.h>
359860Sgdamore@opensolaris.org #include "miipriv.h"
369860Sgdamore@opensolaris.org
379860Sgdamore@opensolaris.org #define OUI(MFG, VEND) { MII_OUI_##MFG, VEND }
389860Sgdamore@opensolaris.org
399860Sgdamore@opensolaris.org static const struct {
409860Sgdamore@opensolaris.org uint32_t oui;
419860Sgdamore@opensolaris.org const char *vendor;
429860Sgdamore@opensolaris.org } other_vendors[] = {
43*11949Sstallion@opensolaris.org OUI(ALTIMA, "Altima Communications"),
449860Sgdamore@opensolaris.org OUI(AMD, "Advanced Micro Devices"),
459860Sgdamore@opensolaris.org OUI(AMD_2, "Advanced Micro Devices"),
4610393SSaurabh.Mishra@Sun.COM OUI(ATTANSIC, "Atheros/Attansic"),
479860Sgdamore@opensolaris.org OUI(BROADCOM, "Broadcom Corporation"),
489860Sgdamore@opensolaris.org OUI(BROADCOM_2, "Broadcom Corporation"),
499860Sgdamore@opensolaris.org OUI(CICADA, "Cicada Semiconductor"),
509860Sgdamore@opensolaris.org OUI(CICADA_2, "Cicada Semiconductor"),
519860Sgdamore@opensolaris.org OUI(DAVICOM, "Davicom Semiconductor"),
529860Sgdamore@opensolaris.org OUI(DAVICOM_2, "Davicom Semiconductor"),
539860Sgdamore@opensolaris.org OUI(ICPLUS, "IC Plus Corp."),
549860Sgdamore@opensolaris.org OUI(ICS, "Integrated Circuit Systems"),
5510806Sgdamore@opensolaris.org OUI(LUCENT, "Lucent Technologies"),
569860Sgdamore@opensolaris.org OUI(INTEL, "Intel"),
579860Sgdamore@opensolaris.org OUI(MARVELL, "Marvell Technology"),
589860Sgdamore@opensolaris.org OUI(NATIONAL_SEMI, "National Semiconductor"),
599860Sgdamore@opensolaris.org OUI(NATIONAL_SEMI_2, "National Semiconductor"),
609860Sgdamore@opensolaris.org OUI(QUALITY_SEMI, "Quality Semiconductor"),
619860Sgdamore@opensolaris.org OUI(QUALITY_SEMI_2, "Quality Semiconductor"),
629860Sgdamore@opensolaris.org { 0, NULL }
639860Sgdamore@opensolaris.org };
649860Sgdamore@opensolaris.org
659860Sgdamore@opensolaris.org #define ID(MFG, MODEL, DESC) \
669860Sgdamore@opensolaris.org { MII_OUI_##MFG, MII_MODEL_##MFG##_##MODEL, DESC }
679860Sgdamore@opensolaris.org #define IDN(MFG, N, MODEL, DESC) \
689860Sgdamore@opensolaris.org { MII_OUI_##MFG##_##N, MII_MODEL_##MFG##_##MODEL, DESC }
699860Sgdamore@opensolaris.org static const struct {
709860Sgdamore@opensolaris.org uint32_t oui;
719860Sgdamore@opensolaris.org uint32_t model;
729860Sgdamore@opensolaris.org const char *desc;
739860Sgdamore@opensolaris.org } other_phys[] = {
749860Sgdamore@opensolaris.org
759860Sgdamore@opensolaris.org /*
76*11949Sstallion@opensolaris.org * Altima phys are standard compliant.
77*11949Sstallion@opensolaris.org * AMD Am79C874 and Am79C875 phys are work-alikes.
78*11949Sstallion@opensolaris.org */
79*11949Sstallion@opensolaris.org ID(ALTIMA, AC101, "AC101/Am79C874"),
80*11949Sstallion@opensolaris.org ID(ALTIMA, AC101L, "AC101L"),
81*11949Sstallion@opensolaris.org ID(ALTIMA, AM79C875, "Am79C875"),
82*11949Sstallion@opensolaris.org
83*11949Sstallion@opensolaris.org /*
849860Sgdamore@opensolaris.org * AMD phys are pretty much standard.
859860Sgdamore@opensolaris.org */
869860Sgdamore@opensolaris.org ID(AMD, AM79C901, "Am79C901"),
879860Sgdamore@opensolaris.org ID(AMD, AM79C972, "Am79C792"),
889860Sgdamore@opensolaris.org ID(AMD, AM79C973, "Am79C793"),
899860Sgdamore@opensolaris.org IDN(AMD, 2, AM79C901, "Am79C901"),
909860Sgdamore@opensolaris.org IDN(AMD, 2, AM79C972, "Am79C792"),
919860Sgdamore@opensolaris.org IDN(AMD, 2, AM79C973, "Am79C793"),
929860Sgdamore@opensolaris.org
939860Sgdamore@opensolaris.org /*
949860Sgdamore@opensolaris.org * Davicom phys are standard compliant.
959860Sgdamore@opensolaris.org */
969860Sgdamore@opensolaris.org ID(DAVICOM, DM9101, "DM9101"),
979860Sgdamore@opensolaris.org ID(DAVICOM, DM9102, "DM9102"),
989860Sgdamore@opensolaris.org ID(DAVICOM, DM9161, "DM9161"),
999860Sgdamore@opensolaris.org IDN(DAVICOM, 2, DM9101, "DM9101"),
1009860Sgdamore@opensolaris.org IDN(DAVICOM, 2, DM9102, "DM9102"),
1019860Sgdamore@opensolaris.org
1029860Sgdamore@opensolaris.org /*
1039860Sgdamore@opensolaris.org * IC Plus phy is standard compliant.
1049860Sgdamore@opensolaris.org */
1059860Sgdamore@opensolaris.org ID(ICPLUS, IP101, "IP101"),
1069860Sgdamore@opensolaris.org
1079860Sgdamore@opensolaris.org /*
1089860Sgdamore@opensolaris.org * ICS phys need double read (bits are latched), have some
1099860Sgdamore@opensolaris.org * faster polling support, and support for automatic power down.
1109860Sgdamore@opensolaris.org * The framework deals with the first, we don't need the second,
1119860Sgdamore@opensolaris.org * and the third is set to default anyway, so we don't need to
1129860Sgdamore@opensolaris.org * use any special handling.
1139860Sgdamore@opensolaris.org */
1149860Sgdamore@opensolaris.org ID(ICS, ICS1889, "ICS1889"),
1159860Sgdamore@opensolaris.org ID(ICS, ICS1890, "ICS1890"),
1169860Sgdamore@opensolaris.org ID(ICS, ICS1892, "ICS1892"),
1179860Sgdamore@opensolaris.org ID(ICS, ICS1893, "ICS1893"),
1189860Sgdamore@opensolaris.org
11910806Sgdamore@opensolaris.org ID(LUCENT, LU6612, "LU6612"),
12010806Sgdamore@opensolaris.org
1219860Sgdamore@opensolaris.org { 0, 0, NULL },
1229860Sgdamore@opensolaris.org };
1239860Sgdamore@opensolaris.org
1249860Sgdamore@opensolaris.org boolean_t
phy_other_probe(phy_handle_t * ph)1259860Sgdamore@opensolaris.org phy_other_probe(phy_handle_t *ph)
1269860Sgdamore@opensolaris.org {
1279860Sgdamore@opensolaris.org uint32_t vid = MII_PHY_MFG(ph->phy_id);
1289860Sgdamore@opensolaris.org uint32_t pid = MII_PHY_MODEL(ph->phy_id);
1299860Sgdamore@opensolaris.org
13011717Sgdamore@opensolaris.org if ((ph->phy_id == 0) || (ph->phy_id == 0xffffffffU)) {
13111717Sgdamore@opensolaris.org /*
13211717Sgdamore@opensolaris.org * IDs are technically optional, but all discrete PHYs
13311717Sgdamore@opensolaris.org * should have them.
13411717Sgdamore@opensolaris.org */
13511717Sgdamore@opensolaris.org ph->phy_vendor = "Internal";
13611717Sgdamore@opensolaris.org ph->phy_model = "PHY";
13711717Sgdamore@opensolaris.org }
1389860Sgdamore@opensolaris.org for (int i = 0; other_vendors[i].vendor; i++) {
1399860Sgdamore@opensolaris.org if (vid == other_vendors[i].oui) {
1409860Sgdamore@opensolaris.org ph->phy_vendor = other_vendors[i].vendor;
1419860Sgdamore@opensolaris.org
1429860Sgdamore@opensolaris.org for (int j = 0; other_phys[j].desc; j++) {
1439860Sgdamore@opensolaris.org if (vid == other_phys[j].oui &&
1449860Sgdamore@opensolaris.org pid == other_phys[j].model) {
1459860Sgdamore@opensolaris.org ph->phy_model = other_phys[j].desc;
1469860Sgdamore@opensolaris.org return (B_TRUE);
1479860Sgdamore@opensolaris.org }
1489860Sgdamore@opensolaris.org }
1499860Sgdamore@opensolaris.org
1509860Sgdamore@opensolaris.org /* PHY from this vendor isn't known to us */
1519860Sgdamore@opensolaris.org return (B_FALSE);
1529860Sgdamore@opensolaris.org }
1539860Sgdamore@opensolaris.org }
1549860Sgdamore@opensolaris.org return (B_FALSE);
1559860Sgdamore@opensolaris.org }
156