\hypertarget{tdkphy_8c_source}{}\doxysection{tdkphy.\+c}
\label{tdkphy_8c_source}\index{dev/mii/tdkphy.c@{dev/mii/tdkphy.c}}
\mbox{\hyperlink{tdkphy_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00002}00002 \textcolor{comment}{ * SPDX-\/License-\/Identifier: BSD-\/2-\/Clause-\/FreeBSD}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00004}00004 \textcolor{comment}{ * Copyright (c) 2000,2001 Jonathan Chen.}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00005}00005 \textcolor{comment}{ * All rights reserved.}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00006}00006 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00007}00007 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00008}00008 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00009}00009 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00010}00010 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00011}00011 \textcolor{comment}{ *    notice, this list of conditions, and the following disclaimer,}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00012}00012 \textcolor{comment}{ *    without modification, immediately at the beginning of the file.}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00013}00013 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00014}00014 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00015}00015 \textcolor{comment}{ *    the documentation and/or other materials provided with the}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00016}00016 \textcolor{comment}{ *    distribution.}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00017}00017 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00018}00018 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00019}00019 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00020}00020 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00021}00021 \textcolor{comment}{ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00022}00022 \textcolor{comment}{ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00023}00023 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00024}00024 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00025}00025 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00026}00026 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00027}00027 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00028}00028 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00029}00029 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00030}00030 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00031}00031 \textcolor{preprocessor}{\#include <sys/cdefs.h>}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00032}\mbox{\hyperlink{tdkphy_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{00032}} \mbox{\hyperlink{tdkphy_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{\_\_FBSDID}}(\textcolor{stringliteral}{"{}\$FreeBSD\$"{}});}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00033}00033 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00034}00034 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00035}00035 \textcolor{comment}{ * Driver for the TDK 78Q2120 MII}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00036}00036 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00037}00037 \textcolor{comment}{ * References:}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00038}00038 \textcolor{comment}{ *   Datasheet for the 78Q2120 -\/ http://www.tsc.tdk.com/lan/78q2120.pdf}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00039}00039 \textcolor{comment}{ *   Most of this code stolen from ukphy.c}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00040}00040 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00041}00041 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00042}00042 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00043}00043 \textcolor{comment}{ * The TDK 78Q2120 is found on some Xircom X3201 based CardBus cards,}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00044}00044 \textcolor{comment}{ * also spotted on some 3C575 cards.  It's just like any other normal}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00045}00045 \textcolor{comment}{ * phy, except it does auto negotiation in a different way.}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00046}00046 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00047}00047 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00048}00048 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00049}00049 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00050}00050 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00051}00051 \textcolor{preprocessor}{\#include <sys/socket.h>}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00052}00052 \textcolor{preprocessor}{\#include <sys/errno.h>}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00053}00053 \textcolor{preprocessor}{\#include <sys/module.h>}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00054}00054 \textcolor{preprocessor}{\#include <sys/bus.h>}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00055}00055 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00056}00056 \textcolor{preprocessor}{\#include <net/if.h>}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00057}00057 \textcolor{preprocessor}{\#include <net/if\_media.h>}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00058}00058 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00059}00059 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{mii_8h}{dev/mii/mii.h}}>}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00060}00060 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{miivar_8h}{dev/mii/miivar.h}}>}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00061}00061 \textcolor{preprocessor}{\#include "{}miidevs.h"{}}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00062}00062 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00063}00063 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{tdkphyreg_8h}{dev/mii/tdkphyreg.h}}>}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00064}00064 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00065}00065 \textcolor{preprocessor}{\#include "{}miibus\_if.h"{}}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00066}00066 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00067}00067 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{tdkphy_8c_ae2a08e5428db9380ba5b7d826c9cd591}{tdkphy\_probe}}(device\_t);}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00068}00068 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{tdkphy_8c_a991263150cabd8200326cbe572b2c275}{tdkphy\_attach}}(device\_t);}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00069}00069 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00070}\mbox{\hyperlink{tdkphy_8c_aebc0d6ab812056e505f6a2a73864790f}{00070}} \textcolor{keyword}{static} device\_method\_t \mbox{\hyperlink{tdkphy_8c_aebc0d6ab812056e505f6a2a73864790f}{tdkphy\_methods}}[] = \{}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00071}00071         \textcolor{comment}{/* device interface */}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00072}00072         DEVMETHOD(device\_probe,         \mbox{\hyperlink{tdkphy_8c_ae2a08e5428db9380ba5b7d826c9cd591}{tdkphy\_probe}}),}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00073}00073         DEVMETHOD(device\_attach,        \mbox{\hyperlink{tdkphy_8c_a991263150cabd8200326cbe572b2c275}{tdkphy\_attach}}),}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00074}00074         DEVMETHOD(device\_detach,        \mbox{\hyperlink{mii__physubr_8c_af08a34e3932c19824be61fc41ee1083f}{mii\_phy\_detach}}),}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00075}00075         DEVMETHOD(device\_shutdown,      bus\_generic\_shutdown),}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00076}00076         DEVMETHOD\_END}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00077}00077 \};}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00078}00078 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00079}\mbox{\hyperlink{tdkphy_8c_a2ee5b9cd505e90956b9921fcc956e892}{00079}} \textcolor{keyword}{static} devclass\_t \mbox{\hyperlink{tdkphy_8c_a2ee5b9cd505e90956b9921fcc956e892}{tdkphy\_devclass}};}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00080}00080 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00081}\mbox{\hyperlink{tdkphy_8c_af43a08c7797d0010a44d0084e71e7113}{00081}} \textcolor{keyword}{static} driver\_t \mbox{\hyperlink{tdkphy_8c_af43a08c7797d0010a44d0084e71e7113}{tdkphy\_driver}} = \{}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00082}00082         \textcolor{stringliteral}{"{}tdkphy"{}},}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00083}00083         \mbox{\hyperlink{tdkphy_8c_aebc0d6ab812056e505f6a2a73864790f}{tdkphy\_methods}},}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00084}00084         \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct }\mbox{\hyperlink{structmii__softc}{mii\_softc}})}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00085}00085 \};}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00086}00086 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00087}\mbox{\hyperlink{tdkphy_8c_a5a71990b0c9658a3de8e35e8e7c33154}{00087}} \mbox{\hyperlink{tdkphy_8c_a5a71990b0c9658a3de8e35e8e7c33154}{DRIVER\_MODULE}}(tdkphy, \mbox{\hyperlink{miibus__if_8m_a4cbc1805319b363b9b338406a4b2a683}{miibus}}, \mbox{\hyperlink{tdkphy_8c_af43a08c7797d0010a44d0084e71e7113}{tdkphy\_driver}}, \mbox{\hyperlink{tdkphy_8c_a2ee5b9cd505e90956b9921fcc956e892}{tdkphy\_devclass}}, 0, 0);}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00088}00088 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00089}00089 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{tdkphy_8c_a5199c002e433980217b16c456764f773}{tdkphy\_service}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmii__softc}{mii\_softc}} *, \textcolor{keyword}{struct} \mbox{\hyperlink{structmii__data}{mii\_data}} *, \textcolor{keywordtype}{int});}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00090}00090 \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{tdkphy_8c_a874856e0e6495bc79ac5bebe793a6fae}{tdkphy\_status}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmii__softc}{mii\_softc}} *);}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00091}00091 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00092}\mbox{\hyperlink{tdkphy_8c_a3ea4553cec6ac256c6274f72039f2093}{00092}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structmii__phydesc}{mii\_phydesc}} \mbox{\hyperlink{tdkphy_8c_a3ea4553cec6ac256c6274f72039f2093}{tdkphys}}[] = \{}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00093}00093         \mbox{\hyperlink{miivar_8h_ae87ddbe9ffefd4caca54be68c7b281fc}{MII\_PHY\_DESC}}(xxTSC, 78Q2120),}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00094}00094         \mbox{\hyperlink{miivar_8h_a4cc657798701d214afbeff2b27c5083d}{MII\_PHY\_END}}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00095}00095 \};}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00096}00096 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00097}\mbox{\hyperlink{tdkphy_8c_a9ac8e9fc662ff6c584fe406e242f14d7}{00097}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structmii__phy__funcs}{mii\_phy\_funcs}} \mbox{\hyperlink{tdkphy_8c_a9ac8e9fc662ff6c584fe406e242f14d7}{tdkphy\_funcs}} = \{}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00098}00098         \mbox{\hyperlink{tdkphy_8c_a5199c002e433980217b16c456764f773}{tdkphy\_service}},}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00099}00099         \mbox{\hyperlink{tdkphy_8c_a874856e0e6495bc79ac5bebe793a6fae}{tdkphy\_status}},}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00100}00100         \mbox{\hyperlink{mii__physubr_8c_ac21db38f2acb040663be6eac5468eaa2}{mii\_phy\_reset}}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00101}00101 \};}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00102}00102 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00103}00103 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00104}\mbox{\hyperlink{tdkphy_8c_ae2a08e5428db9380ba5b7d826c9cd591}{00104}} \mbox{\hyperlink{tdkphy_8c_ae2a08e5428db9380ba5b7d826c9cd591}{tdkphy\_probe}}(device\_t dev)}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00105}00105 \{}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00106}00106 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00107}00107         \textcolor{keywordflow}{return} (\mbox{\hyperlink{mii__physubr_8c_a6eae4dd21de85ca536b06467bf0a5f88}{mii\_phy\_dev\_probe}}(dev, \mbox{\hyperlink{tdkphy_8c_a3ea4553cec6ac256c6274f72039f2093}{tdkphys}}, BUS\_PROBE\_DEFAULT));}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00108}00108 \}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00109}00109 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00110}00110 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00111}\mbox{\hyperlink{tdkphy_8c_a991263150cabd8200326cbe572b2c275}{00111}} \mbox{\hyperlink{tdkphy_8c_a991263150cabd8200326cbe572b2c275}{tdkphy\_attach}}(device\_t dev)}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00112}00112 \{}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00113}00113 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00114}00114         \mbox{\hyperlink{mii__physubr_8c_a50acf7ba3fab73b23c13fe7da8c93f1d}{mii\_phy\_dev\_attach}}(dev, \mbox{\hyperlink{miivar_8h_a8d2d38c2ee2b3eb2ccd1f0a3da5fed03}{MIIF\_NOMANPAUSE}}, \&\mbox{\hyperlink{tdkphy_8c_a9ac8e9fc662ff6c584fe406e242f14d7}{tdkphy\_funcs}}, 1);}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00115}00115         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00116}00116 \}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00117}00117 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00118}00118 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00119}\mbox{\hyperlink{tdkphy_8c_a5199c002e433980217b16c456764f773}{00119}} \mbox{\hyperlink{tdkphy_8c_a5199c002e433980217b16c456764f773}{tdkphy\_service}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmii__softc}{mii\_softc}} *sc, \textcolor{keyword}{struct} \mbox{\hyperlink{structmii__data}{mii\_data}} *mii, \textcolor{keywordtype}{int} cmd)}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00120}00120 \{}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00121}00121 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00122}00122         \textcolor{keywordflow}{switch} (cmd) \{}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00123}00123         \textcolor{keywordflow}{case} \mbox{\hyperlink{miivar_8h_a5ee687df11441661206e4d2922ab5a52}{MII\_POLLSTAT}}:}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00124}00124                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00125}00125 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00126}00126         \textcolor{keywordflow}{case} \mbox{\hyperlink{miivar_8h_a6c5cb4a5233e6b1e8a8542636e8ba4c8}{MII\_MEDIACHG}}:}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00127}00127                 \mbox{\hyperlink{mii__physubr_8c_afac2ea5f0d036a16125e01fc48a41457}{mii\_phy\_setmedia}}(sc);}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00128}00128                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00129}00129 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00130}00130         \textcolor{keywordflow}{case} \mbox{\hyperlink{miivar_8h_a7aba758235b2d688fc41842a167187e5}{MII\_TICK}}:}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00131}00131                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{mii__physubr_8c_aee0c2c158db70e66816d5c1269e83290}{mii\_phy\_tick}}(sc) == EJUSTRETURN)}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00132}00132                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00133}00133                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00134}00134         \}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00135}00135 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00136}00136         \textcolor{comment}{/* Update the media status. */}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00137}00137         \mbox{\hyperlink{miivar_8h_a1c1cdb714bf40ba701256727dd6a73c5}{PHY\_STATUS}}(sc);}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00138}00138         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structmii__softc_a12011aec864a92fb63b711b43e6b4356}{mii\_pdata}}-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} \& IFM\_FDX)}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00139}00139                 \mbox{\hyperlink{miivar_8h_af302bd91f8177e3ca317b822f00680b5}{PHY\_WRITE}}(sc, \mbox{\hyperlink{mii_8h_a9137acedc42ff140f244da7473cff29e}{MII\_BMCR}}, \mbox{\hyperlink{miivar_8h_a4f9acdc044cd8d94bd80432e4f01bcd2}{PHY\_READ}}(sc, \mbox{\hyperlink{mii_8h_a9137acedc42ff140f244da7473cff29e}{MII\_BMCR}}) | \mbox{\hyperlink{mii_8h_a2a3179867c3b6168c8b8647cc768b44d}{BMCR\_FDX}});}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00140}00140         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00141}00141                 \mbox{\hyperlink{miivar_8h_af302bd91f8177e3ca317b822f00680b5}{PHY\_WRITE}}(sc, \mbox{\hyperlink{mii_8h_a9137acedc42ff140f244da7473cff29e}{MII\_BMCR}}, \mbox{\hyperlink{miivar_8h_a4f9acdc044cd8d94bd80432e4f01bcd2}{PHY\_READ}}(sc, \mbox{\hyperlink{mii_8h_a9137acedc42ff140f244da7473cff29e}{MII\_BMCR}}) \& \string~\mbox{\hyperlink{mii_8h_a2a3179867c3b6168c8b8647cc768b44d}{BMCR\_FDX}});}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00142}00142 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00143}00143         \textcolor{comment}{/* Callback if something changed. */}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00144}00144         \mbox{\hyperlink{mii__physubr_8c_ac5a93e41e086c93143a04d9d4548b251}{mii\_phy\_update}}(sc, cmd);}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00145}00145         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00146}00146 \}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00147}00147 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00148}00148 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00149}\mbox{\hyperlink{tdkphy_8c_a874856e0e6495bc79ac5bebe793a6fae}{00149}} \mbox{\hyperlink{tdkphy_8c_a874856e0e6495bc79ac5bebe793a6fae}{tdkphy\_status}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmii__softc}{mii\_softc}} *\mbox{\hyperlink{miibus__if_8m_a5a9bb95881c089e261771c35775eeaf9}{phy}})}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00150}00150 \{}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00151}00151         \textcolor{keyword}{struct }\mbox{\hyperlink{structmii__data}{mii\_data}} *mii = \mbox{\hyperlink{miibus__if_8m_a5a9bb95881c089e261771c35775eeaf9}{phy}}-\/>mii\_pdata;}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00152}00152         \textcolor{keyword}{struct }ifmedia\_entry *ife = mii-\/>\mbox{\hyperlink{structmii__data_ac0e7ceb0ad8cc3eb2e55a6947d4c6fd0}{mii\_media}}.ifm\_cur;}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00153}00153         \textcolor{keywordtype}{int} bmsr, bmcr, anlpar, diag;}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00154}00154 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00155}00155         mii-\/>\mbox{\hyperlink{structmii__data_a15c66b8658a144ac3294603a8146ac09}{mii\_media\_status}} = IFM\_AVALID;}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00156}00156         mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} = IFM\_ETHER;}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00157}00157 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00158}00158         bmsr = \mbox{\hyperlink{miivar_8h_a4f9acdc044cd8d94bd80432e4f01bcd2}{PHY\_READ}}(\mbox{\hyperlink{miibus__if_8m_a5a9bb95881c089e261771c35775eeaf9}{phy}}, \mbox{\hyperlink{mii_8h_aa2f632686d6298a7c898b1c805586aab}{MII\_BMSR}}) | \mbox{\hyperlink{miivar_8h_a4f9acdc044cd8d94bd80432e4f01bcd2}{PHY\_READ}}(\mbox{\hyperlink{miibus__if_8m_a5a9bb95881c089e261771c35775eeaf9}{phy}}, \mbox{\hyperlink{mii_8h_aa2f632686d6298a7c898b1c805586aab}{MII\_BMSR}});}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00159}00159         \textcolor{keywordflow}{if} (bmsr \& \mbox{\hyperlink{mii_8h_aca42eb005e0fdbae038bd7c9f12a1035}{BMSR\_LINK}})}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00160}00160                 mii-\/>\mbox{\hyperlink{structmii__data_a15c66b8658a144ac3294603a8146ac09}{mii\_media\_status}} |= IFM\_ACTIVE;}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00161}00161 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00162}00162         bmcr = \mbox{\hyperlink{miivar_8h_a4f9acdc044cd8d94bd80432e4f01bcd2}{PHY\_READ}}(\mbox{\hyperlink{miibus__if_8m_a5a9bb95881c089e261771c35775eeaf9}{phy}}, \mbox{\hyperlink{mii_8h_a9137acedc42ff140f244da7473cff29e}{MII\_BMCR}});}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00163}00163         \textcolor{keywordflow}{if} (bmcr \& \mbox{\hyperlink{mii_8h_a28b8dcb818bc18a079b39b5517c27e3a}{BMCR\_ISO}}) \{}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00164}00164                 mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} |= IFM\_NONE;}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00165}00165                 mii-\/>\mbox{\hyperlink{structmii__data_a15c66b8658a144ac3294603a8146ac09}{mii\_media\_status}} = 0;}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00166}00166                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00167}00167         \}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00168}00168 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00169}00169         \textcolor{keywordflow}{if} (bmcr \& \mbox{\hyperlink{mii_8h_aafd596a9125ddece08d5a9798dce42d6}{BMCR\_LOOP}})}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00170}00170                 mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} |= IFM\_LOOP;}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00171}00171 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00172}00172         \textcolor{keywordflow}{if} (bmcr \& \mbox{\hyperlink{mii_8h_a8d92e7dc8997005e43add732fba16a0d}{BMCR\_AUTOEN}}) \{}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00173}00173                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00174}00174 \textcolor{comment}{                 * NWay autonegotiation takes the highest-\/order common}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00175}00175 \textcolor{comment}{                 * bit of the ANAR and ANLPAR (i.e. best media advertised}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00176}00176 \textcolor{comment}{                 * both by us and our link partner).}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00177}00177 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00178}00178                 \textcolor{keywordflow}{if} ((bmsr \& \mbox{\hyperlink{mii_8h_aa602b8728f35b021f27e9db3b06a7e55}{BMSR\_ACOMP}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00179}00179                         \textcolor{comment}{/* Erg, still trying, I guess... */}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00180}00180                         mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} |= IFM\_NONE;}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00181}00181                         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00182}00182                 \}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00183}00183 }
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00184}00184                 anlpar = \mbox{\hyperlink{miivar_8h_a4f9acdc044cd8d94bd80432e4f01bcd2}{PHY\_READ}}(\mbox{\hyperlink{miibus__if_8m_a5a9bb95881c089e261771c35775eeaf9}{phy}}, \mbox{\hyperlink{mii_8h_aacb2ab0ea5579b5d9e30b075991add1d}{MII\_ANAR}}) \& \mbox{\hyperlink{miivar_8h_a4f9acdc044cd8d94bd80432e4f01bcd2}{PHY\_READ}}(\mbox{\hyperlink{miibus__if_8m_a5a9bb95881c089e261771c35775eeaf9}{phy}}, \mbox{\hyperlink{mii_8h_a445e8381a9ea9724054bfacc10bb4c81}{MII\_ANLPAR}});}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00185}00185                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00186}00186 \textcolor{comment}{                 * ANLPAR doesn't get set on my card, but we check it anyway,}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00187}00187 \textcolor{comment}{                 * since it is mentioned in the 78Q2120 specs.}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00188}00188 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00189}00189                 \textcolor{keywordflow}{if} (anlpar \& \mbox{\hyperlink{mii_8h_afed6c4132ca2f6712fbc773549bb950f}{ANLPAR\_TX\_FD}})}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00190}00190                         mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} |= IFM\_100\_TX|IFM\_FDX;}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00191}00191                 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (anlpar \& \mbox{\hyperlink{mii_8h_a56e31c4268bc062a0c70dead5951fee4}{ANLPAR\_T4}})}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00192}00192                         mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} |= IFM\_100\_T4|IFM\_HDX;}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00193}00193                 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (anlpar \& \mbox{\hyperlink{mii_8h_a6a5ed387031b7f1754b0d6ccd7e7af60}{ANLPAR\_TX}})}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00194}00194                         mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} |= IFM\_100\_TX|IFM\_HDX;}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00195}00195                 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (anlpar \& \mbox{\hyperlink{mii_8h_aa8b1fa07c5222efe44ab300818410867}{ANLPAR\_10\_FD}})}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00196}00196                         mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} |= IFM\_10\_T|IFM\_FDX;}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00197}00197                 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (anlpar \& \mbox{\hyperlink{mii_8h_acdff237c9d804e262e2b68f413748e30}{ANLPAR\_10}})}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00198}00198                         mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} |= IFM\_10\_T|IFM\_HDX;}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00199}00199                 \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00200}00200                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00201}00201 \textcolor{comment}{                         * ANLPAR isn't set, which leaves two possibilities:}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00202}00202 \textcolor{comment}{                         * 1) Auto negotiation failed}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00203}00203 \textcolor{comment}{                         * 2) Auto negotiation completed, but the card forgot}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00204}00204 \textcolor{comment}{                         *    to set ANLPAR.}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00205}00205 \textcolor{comment}{                         * So we check the MII\_DIAG(18) register...}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00206}00206 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00207}00207                         diag = \mbox{\hyperlink{miivar_8h_a4f9acdc044cd8d94bd80432e4f01bcd2}{PHY\_READ}}(\mbox{\hyperlink{miibus__if_8m_a5a9bb95881c089e261771c35775eeaf9}{phy}}, \mbox{\hyperlink{tdkphyreg_8h_abd5b42786e6fa297c3ff6ab3f0f39d8d}{MII\_DIAG}});}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00208}00208                         \textcolor{keywordflow}{if} (diag \& \mbox{\hyperlink{tdkphyreg_8h_a33f521194844432824da928a544825ac}{DIAG\_NEGFAIL}}) \textcolor{comment}{/* assume 10baseT if no neg */}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00209}00209                                 mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} |= IFM\_10\_T|IFM\_HDX;}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00210}00210                         \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00211}00211                                 \textcolor{keywordflow}{if} (diag \& \mbox{\hyperlink{tdkphyreg_8h_a50184319bc3cf1dd95c1706223e5c93a}{DIAG\_DUPLEX}})}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00212}00212                                         mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} |= IFM\_FDX;}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00213}00213                                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00214}00214                                         mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} |= IFM\_HDX;}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00215}00215                                 \textcolor{keywordflow}{if} (diag \& \mbox{\hyperlink{tdkphyreg_8h_a81b5665ae9f50adfbca9700387d3d80b}{DIAG\_RATE\_100}})}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00216}00216                                         mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} |= IFM\_100\_TX;}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00217}00217                                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00218}00218                                         mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} |= IFM\_10\_T;}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00219}00219                         \}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00220}00220                 \}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00221}00221                 \textcolor{keywordflow}{if} ((mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} \& IFM\_FDX) != 0)}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00222}00222                         mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} |= \mbox{\hyperlink{mii__physubr_8c_a02a13013ccece7f7569fce9ab65424d3}{mii\_phy\_flowstatus}}(\mbox{\hyperlink{miibus__if_8m_a5a9bb95881c089e261771c35775eeaf9}{phy}});}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00223}00223         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00224}00224                 mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} = ife-\/>ifm\_media;}
\DoxyCodeLine{\Hypertarget{tdkphy_8c_source_l00225}00225 \}}

\end{DoxyCode}
