1bdb9230aSGarrett D'Amore /* 2bdb9230aSGarrett D'Amore * CDDL HEADER START 3bdb9230aSGarrett D'Amore * 4bdb9230aSGarrett D'Amore * The contents of this file are subject to the terms of the 5bdb9230aSGarrett D'Amore * Common Development and Distribution License (the "License"). 6bdb9230aSGarrett D'Amore * You may not use this file except in compliance with the License. 7bdb9230aSGarrett D'Amore * 8bdb9230aSGarrett D'Amore * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9bdb9230aSGarrett D'Amore * or http://www.opensolaris.org/os/licensing. 10bdb9230aSGarrett D'Amore * See the License for the specific language governing permissions 11bdb9230aSGarrett D'Amore * and limitations under the License. 12bdb9230aSGarrett D'Amore * 13bdb9230aSGarrett D'Amore * When distributing Covered Code, include this CDDL HEADER in each 14bdb9230aSGarrett D'Amore * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15bdb9230aSGarrett D'Amore * If applicable, add the following below this CDDL HEADER, with the 16bdb9230aSGarrett D'Amore * fields enclosed by brackets "[]" replaced with your own identifying 17bdb9230aSGarrett D'Amore * information: Portions Copyright [yyyy] [name of copyright owner] 18bdb9230aSGarrett D'Amore * 19bdb9230aSGarrett D'Amore * CDDL HEADER END 20bdb9230aSGarrett D'Amore */ 21bdb9230aSGarrett D'Amore /* 2269b3e104SGarrett D'Amore * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 23bdb9230aSGarrett D'Amore * Use is subject to license terms. 24bdb9230aSGarrett D'Amore */ 25bdb9230aSGarrett D'Amore 26bdb9230aSGarrett D'Amore /* 27*5e8ade18SSteven Stallion * MII overrides for other PHYs. 28bdb9230aSGarrett D'Amore */ 29bdb9230aSGarrett D'Amore 30bdb9230aSGarrett D'Amore #include <sys/types.h> 31bdb9230aSGarrett D'Amore #include <sys/ddi.h> 32bdb9230aSGarrett D'Amore #include <sys/sunddi.h> 33bdb9230aSGarrett D'Amore #include <sys/mii.h> 34bdb9230aSGarrett D'Amore #include <sys/miiregs.h> 35bdb9230aSGarrett D'Amore #include "miipriv.h" 36bdb9230aSGarrett D'Amore 37bdb9230aSGarrett D'Amore #define OUI(MFG, VEND) { MII_OUI_##MFG, VEND } 38bdb9230aSGarrett D'Amore 39bdb9230aSGarrett D'Amore static const struct { 40bdb9230aSGarrett D'Amore uint32_t oui; 41bdb9230aSGarrett D'Amore const char *vendor; 42bdb9230aSGarrett D'Amore } other_vendors[] = { 43*5e8ade18SSteven Stallion OUI(ALTIMA, "Altima Communications"), 44bdb9230aSGarrett D'Amore OUI(AMD, "Advanced Micro Devices"), 45bdb9230aSGarrett D'Amore OUI(AMD_2, "Advanced Micro Devices"), 46015a6ef6SSaurabh Misra OUI(ATTANSIC, "Atheros/Attansic"), 47bdb9230aSGarrett D'Amore OUI(BROADCOM, "Broadcom Corporation"), 48bdb9230aSGarrett D'Amore OUI(BROADCOM_2, "Broadcom Corporation"), 49bdb9230aSGarrett D'Amore OUI(CICADA, "Cicada Semiconductor"), 50bdb9230aSGarrett D'Amore OUI(CICADA_2, "Cicada Semiconductor"), 51bdb9230aSGarrett D'Amore OUI(DAVICOM, "Davicom Semiconductor"), 52bdb9230aSGarrett D'Amore OUI(DAVICOM_2, "Davicom Semiconductor"), 53bdb9230aSGarrett D'Amore OUI(ICPLUS, "IC Plus Corp."), 54bdb9230aSGarrett D'Amore OUI(ICS, "Integrated Circuit Systems"), 5506673d9bSGarrett D'Amore OUI(LUCENT, "Lucent Technologies"), 56bdb9230aSGarrett D'Amore OUI(INTEL, "Intel"), 57bdb9230aSGarrett D'Amore OUI(MARVELL, "Marvell Technology"), 58bdb9230aSGarrett D'Amore OUI(NATIONAL_SEMI, "National Semiconductor"), 59bdb9230aSGarrett D'Amore OUI(NATIONAL_SEMI_2, "National Semiconductor"), 60bdb9230aSGarrett D'Amore OUI(QUALITY_SEMI, "Quality Semiconductor"), 61bdb9230aSGarrett D'Amore OUI(QUALITY_SEMI_2, "Quality Semiconductor"), 62bdb9230aSGarrett D'Amore { 0, NULL } 63bdb9230aSGarrett D'Amore }; 64bdb9230aSGarrett D'Amore 65bdb9230aSGarrett D'Amore #define ID(MFG, MODEL, DESC) \ 66bdb9230aSGarrett D'Amore { MII_OUI_##MFG, MII_MODEL_##MFG##_##MODEL, DESC } 67bdb9230aSGarrett D'Amore #define IDN(MFG, N, MODEL, DESC) \ 68bdb9230aSGarrett D'Amore { MII_OUI_##MFG##_##N, MII_MODEL_##MFG##_##MODEL, DESC } 69bdb9230aSGarrett D'Amore static const struct { 70bdb9230aSGarrett D'Amore uint32_t oui; 71bdb9230aSGarrett D'Amore uint32_t model; 72bdb9230aSGarrett D'Amore const char *desc; 73bdb9230aSGarrett D'Amore } other_phys[] = { 74bdb9230aSGarrett D'Amore 75bdb9230aSGarrett D'Amore /* 76*5e8ade18SSteven Stallion * Altima phys are standard compliant. 77*5e8ade18SSteven Stallion * AMD Am79C874 and Am79C875 phys are work-alikes. 78*5e8ade18SSteven Stallion */ 79*5e8ade18SSteven Stallion ID(ALTIMA, AC101, "AC101/Am79C874"), 80*5e8ade18SSteven Stallion ID(ALTIMA, AC101L, "AC101L"), 81*5e8ade18SSteven Stallion ID(ALTIMA, AM79C875, "Am79C875"), 82*5e8ade18SSteven Stallion 83*5e8ade18SSteven Stallion /* 84bdb9230aSGarrett D'Amore * AMD phys are pretty much standard. 85bdb9230aSGarrett D'Amore */ 86bdb9230aSGarrett D'Amore ID(AMD, AM79C901, "Am79C901"), 87bdb9230aSGarrett D'Amore ID(AMD, AM79C972, "Am79C792"), 88bdb9230aSGarrett D'Amore ID(AMD, AM79C973, "Am79C793"), 89bdb9230aSGarrett D'Amore IDN(AMD, 2, AM79C901, "Am79C901"), 90bdb9230aSGarrett D'Amore IDN(AMD, 2, AM79C972, "Am79C792"), 91bdb9230aSGarrett D'Amore IDN(AMD, 2, AM79C973, "Am79C793"), 92bdb9230aSGarrett D'Amore 93bdb9230aSGarrett D'Amore /* 94bdb9230aSGarrett D'Amore * Davicom phys are standard compliant. 95bdb9230aSGarrett D'Amore */ 96bdb9230aSGarrett D'Amore ID(DAVICOM, DM9101, "DM9101"), 97bdb9230aSGarrett D'Amore ID(DAVICOM, DM9102, "DM9102"), 98bdb9230aSGarrett D'Amore ID(DAVICOM, DM9161, "DM9161"), 99bdb9230aSGarrett D'Amore IDN(DAVICOM, 2, DM9101, "DM9101"), 100bdb9230aSGarrett D'Amore IDN(DAVICOM, 2, DM9102, "DM9102"), 101bdb9230aSGarrett D'Amore 102bdb9230aSGarrett D'Amore /* 103bdb9230aSGarrett D'Amore * IC Plus phy is standard compliant. 104bdb9230aSGarrett D'Amore */ 105bdb9230aSGarrett D'Amore ID(ICPLUS, IP101, "IP101"), 106bdb9230aSGarrett D'Amore 107bdb9230aSGarrett D'Amore /* 108bdb9230aSGarrett D'Amore * ICS phys need double read (bits are latched), have some 109bdb9230aSGarrett D'Amore * faster polling support, and support for automatic power down. 110bdb9230aSGarrett D'Amore * The framework deals with the first, we don't need the second, 111bdb9230aSGarrett D'Amore * and the third is set to default anyway, so we don't need to 112bdb9230aSGarrett D'Amore * use any special handling. 113bdb9230aSGarrett D'Amore */ 114bdb9230aSGarrett D'Amore ID(ICS, ICS1889, "ICS1889"), 115bdb9230aSGarrett D'Amore ID(ICS, ICS1890, "ICS1890"), 116bdb9230aSGarrett D'Amore ID(ICS, ICS1892, "ICS1892"), 117bdb9230aSGarrett D'Amore ID(ICS, ICS1893, "ICS1893"), 118bdb9230aSGarrett D'Amore 11906673d9bSGarrett D'Amore ID(LUCENT, LU6612, "LU6612"), 12006673d9bSGarrett D'Amore 121bdb9230aSGarrett D'Amore { 0, 0, NULL }, 122bdb9230aSGarrett D'Amore }; 123bdb9230aSGarrett D'Amore 124bdb9230aSGarrett D'Amore boolean_t 125bdb9230aSGarrett D'Amore phy_other_probe(phy_handle_t *ph) 126bdb9230aSGarrett D'Amore { 127bdb9230aSGarrett D'Amore uint32_t vid = MII_PHY_MFG(ph->phy_id); 128bdb9230aSGarrett D'Amore uint32_t pid = MII_PHY_MODEL(ph->phy_id); 129bdb9230aSGarrett D'Amore 13069b3e104SGarrett D'Amore if ((ph->phy_id == 0) || (ph->phy_id == 0xffffffffU)) { 13169b3e104SGarrett D'Amore /* 13269b3e104SGarrett D'Amore * IDs are technically optional, but all discrete PHYs 13369b3e104SGarrett D'Amore * should have them. 13469b3e104SGarrett D'Amore */ 13569b3e104SGarrett D'Amore ph->phy_vendor = "Internal"; 13669b3e104SGarrett D'Amore ph->phy_model = "PHY"; 13769b3e104SGarrett D'Amore } 138bdb9230aSGarrett D'Amore for (int i = 0; other_vendors[i].vendor; i++) { 139bdb9230aSGarrett D'Amore if (vid == other_vendors[i].oui) { 140bdb9230aSGarrett D'Amore ph->phy_vendor = other_vendors[i].vendor; 141bdb9230aSGarrett D'Amore 142bdb9230aSGarrett D'Amore for (int j = 0; other_phys[j].desc; j++) { 143bdb9230aSGarrett D'Amore if (vid == other_phys[j].oui && 144bdb9230aSGarrett D'Amore pid == other_phys[j].model) { 145bdb9230aSGarrett D'Amore ph->phy_model = other_phys[j].desc; 146bdb9230aSGarrett D'Amore return (B_TRUE); 147bdb9230aSGarrett D'Amore } 148bdb9230aSGarrett D'Amore } 149bdb9230aSGarrett D'Amore 150bdb9230aSGarrett D'Amore /* PHY from this vendor isn't known to us */ 151bdb9230aSGarrett D'Amore return (B_FALSE); 152bdb9230aSGarrett D'Amore } 153bdb9230aSGarrett D'Amore } 154bdb9230aSGarrett D'Amore return (B_FALSE); 155bdb9230aSGarrett D'Amore } 156