\hypertarget{smscphy_8c_source}{}\doxysection{smscphy.\+c}
\label{smscphy_8c_source}\index{dev/mii/smscphy.c@{dev/mii/smscphy.c}}
\mbox{\hyperlink{smscphy_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00002}00002 \textcolor{comment}{ * SPDX-\/License-\/Identifier: BSD-\/2-\/Clause-\/FreeBSD}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00004}00004 \textcolor{comment}{ * Copyright (c) 2006 Benno Rice.  All rights reserved.}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00005}00005 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00006}00006 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00007}00007 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00008}00008 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00009}00009 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00010}00010 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00011}00011 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00012}00012 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00013}00013 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00014}00014 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00015}00015 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00016}00016 \textcolor{comment}{ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00017}00017 \textcolor{comment}{ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00018}00018 \textcolor{comment}{ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00019}00019 \textcolor{comment}{ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00020}00020 \textcolor{comment}{ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00021}00021 \textcolor{comment}{ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00022}00022 \textcolor{comment}{ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00023}00023 \textcolor{comment}{ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00024}00024 \textcolor{comment}{ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00025}00025 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00026}00026 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00027}00027 \textcolor{preprocessor}{\#include <sys/cdefs.h>}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00028}\mbox{\hyperlink{smscphy_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{00028}} \mbox{\hyperlink{smscphy_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{\_\_FBSDID}}(\textcolor{stringliteral}{"{}\$FreeBSD\$"{}});}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00029}00029 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00030}00030 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00031}00031 \textcolor{comment}{ * Driver for the SMSC LAN8710A}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00032}00032 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00033}00033 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00034}00034 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00035}00035 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00036}00036 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00037}00037 \textcolor{preprocessor}{\#include <sys/socket.h>}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <sys/errno.h>}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00039}00039 \textcolor{preprocessor}{\#include <sys/module.h>}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00040}00040 \textcolor{preprocessor}{\#include <sys/bus.h>}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00041}00041 \textcolor{preprocessor}{\#include <sys/malloc.h>}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00042}00042 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00043}00043 \textcolor{preprocessor}{\#include <machine/bus.h>}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00044}00044 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00045}00045 \textcolor{preprocessor}{\#include <net/if.h>}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00046}00046 \textcolor{preprocessor}{\#include <net/if\_media.h>}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00047}00047 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00048}00048 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{mii_8h}{dev/mii/mii.h}}>}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00049}00049 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{miivar_8h}{dev/mii/miivar.h}}>}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00050}00050 \textcolor{preprocessor}{\#include "{}miidevs.h"{}}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00051}00051 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00052}00052 \textcolor{preprocessor}{\#include "{}miibus\_if.h"{}}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00053}00053 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00054}00054 \textcolor{keyword}{static} \textcolor{keywordtype}{int}      \mbox{\hyperlink{smscphy_8c_a2a2de676acacb3ec683d1d7f2e839476}{smscphy\_probe}}(device\_t);}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00055}00055 \textcolor{keyword}{static} \textcolor{keywordtype}{int}      \mbox{\hyperlink{smscphy_8c_ae926714834e039e5ff1a0b09dc6355e4}{smscphy\_attach}}(device\_t);}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00056}00056 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00057}00057 \textcolor{keyword}{static} \textcolor{keywordtype}{int}      \mbox{\hyperlink{smscphy_8c_acb3c06e39c9622b10970aaf7fdb42e9a}{smscphy\_service}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmii__softc}{mii\_softc}} *, \textcolor{keyword}{struct} \mbox{\hyperlink{structmii__data}{mii\_data}} *, \textcolor{keywordtype}{int});}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00058}00058 \textcolor{keyword}{static} \textcolor{keywordtype}{void}     \mbox{\hyperlink{smscphy_8c_ac4367d71ae2723ef4de28c9b2a1e8988}{smscphy\_auto}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmii__softc}{mii\_softc}} *, \textcolor{keywordtype}{int});}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00059}00059 \textcolor{keyword}{static} \textcolor{keywordtype}{void}     \mbox{\hyperlink{smscphy_8c_aa25156fe76c422c71fb700acd219e5e1}{smscphy\_status}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmii__softc}{mii\_softc}} *);}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00060}00060 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00061}\mbox{\hyperlink{smscphy_8c_ae4c96d2e78af81b5e8584ad6e23ef90f}{00061}} \textcolor{keyword}{static} device\_method\_t \mbox{\hyperlink{smscphy_8c_ae4c96d2e78af81b5e8584ad6e23ef90f}{smscphy\_methods}}[] = \{}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00062}00062         \textcolor{comment}{/* device interface */}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00063}00063         DEVMETHOD(device\_probe,         \mbox{\hyperlink{smscphy_8c_a2a2de676acacb3ec683d1d7f2e839476}{smscphy\_probe}}),}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00064}00064         DEVMETHOD(device\_attach,        \mbox{\hyperlink{smscphy_8c_ae926714834e039e5ff1a0b09dc6355e4}{smscphy\_attach}}),}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00065}00065         DEVMETHOD(device\_detach,        \mbox{\hyperlink{mii__physubr_8c_af08a34e3932c19824be61fc41ee1083f}{mii\_phy\_detach}}),}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00066}00066         DEVMETHOD(device\_shutdown,      bus\_generic\_shutdown),}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00067}00067         DEVMETHOD\_END}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00068}00068 \};}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00069}00069 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00070}\mbox{\hyperlink{smscphy_8c_a8679bf6a56b30974de43c50ca323ba75}{00070}} \textcolor{keyword}{static} devclass\_t \mbox{\hyperlink{smscphy_8c_a8679bf6a56b30974de43c50ca323ba75}{smscphy\_devclass}};}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00071}00071 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00072}\mbox{\hyperlink{smscphy_8c_a819bd9b7618b051378d533e320b9d2f8}{00072}} \textcolor{keyword}{static} driver\_t \mbox{\hyperlink{smscphy_8c_a819bd9b7618b051378d533e320b9d2f8}{smscphy\_driver}} = \{}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00073}00073         \textcolor{stringliteral}{"{}smscphy"{}},}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00074}00074         \mbox{\hyperlink{smscphy_8c_ae4c96d2e78af81b5e8584ad6e23ef90f}{smscphy\_methods}},}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00075}00075         \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct }\mbox{\hyperlink{structmii__softc}{mii\_softc}})}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00076}00076 \};}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00077}00077 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00078}\mbox{\hyperlink{smscphy_8c_a0261d38c960971eba45a7b7780beefc2}{00078}} \mbox{\hyperlink{smscphy_8c_a0261d38c960971eba45a7b7780beefc2}{DRIVER\_MODULE}}(smscphy, \mbox{\hyperlink{miibus__if_8m_a4cbc1805319b363b9b338406a4b2a683}{miibus}}, \mbox{\hyperlink{smscphy_8c_a819bd9b7618b051378d533e320b9d2f8}{smscphy\_driver}}, \mbox{\hyperlink{smscphy_8c_a8679bf6a56b30974de43c50ca323ba75}{smscphy\_devclass}}, 0, 0);}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00079}00079 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00080}\mbox{\hyperlink{smscphy_8c_a7461804fbcb7620034b871889615504c}{00080}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structmii__phydesc}{mii\_phydesc}} \mbox{\hyperlink{smscphy_8c_a7461804fbcb7620034b871889615504c}{smscphys}}[] = \{}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00081}00081         \mbox{\hyperlink{miivar_8h_ae87ddbe9ffefd4caca54be68c7b281fc}{MII\_PHY\_DESC}}(SMC, LAN8710A),}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00082}00082         \mbox{\hyperlink{miivar_8h_ae87ddbe9ffefd4caca54be68c7b281fc}{MII\_PHY\_DESC}}(SMC, LAN8700),}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00083}00083         \mbox{\hyperlink{miivar_8h_a4cc657798701d214afbeff2b27c5083d}{MII\_PHY\_END}}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00084}00084 \};}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00085}00085 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00086}\mbox{\hyperlink{smscphy_8c_abbaa1594a2e5ae8d29018defb442b27a}{00086}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structmii__phy__funcs}{mii\_phy\_funcs}} \mbox{\hyperlink{smscphy_8c_abbaa1594a2e5ae8d29018defb442b27a}{smscphy\_funcs}} = \{}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00087}00087         \mbox{\hyperlink{smscphy_8c_acb3c06e39c9622b10970aaf7fdb42e9a}{smscphy\_service}},}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00088}00088         \mbox{\hyperlink{smscphy_8c_aa25156fe76c422c71fb700acd219e5e1}{smscphy\_status}},}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00089}00089         \mbox{\hyperlink{mii__physubr_8c_ac21db38f2acb040663be6eac5468eaa2}{mii\_phy\_reset}}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00090}00090 \};}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00091}00091 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00092}00092 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00093}\mbox{\hyperlink{smscphy_8c_a2a2de676acacb3ec683d1d7f2e839476}{00093}} \mbox{\hyperlink{smscphy_8c_a2a2de676acacb3ec683d1d7f2e839476}{smscphy\_probe}}(device\_t dev)}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00094}00094 \{}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00095}00095 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00096}00096         \textcolor{keywordflow}{return} (\mbox{\hyperlink{mii__physubr_8c_a6eae4dd21de85ca536b06467bf0a5f88}{mii\_phy\_dev\_probe}}(dev, \mbox{\hyperlink{smscphy_8c_a7461804fbcb7620034b871889615504c}{smscphys}}, BUS\_PROBE\_DEFAULT));}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00097}00097 \}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00098}00098 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00099}00099 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00100}\mbox{\hyperlink{smscphy_8c_ae926714834e039e5ff1a0b09dc6355e4}{00100}} \mbox{\hyperlink{smscphy_8c_ae926714834e039e5ff1a0b09dc6355e4}{smscphy\_attach}}(device\_t dev)}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00101}00101 \{}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00102}00102         \textcolor{keyword}{struct }\mbox{\hyperlink{structmii__softc}{mii\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00103}00103         \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structmii__phy__funcs}{mii\_phy\_funcs}} *mpf;}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00104}00104 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00105}00105         sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00106}00106         mpf = \&\mbox{\hyperlink{smscphy_8c_abbaa1594a2e5ae8d29018defb442b27a}{smscphy\_funcs}};}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00107}00107         \mbox{\hyperlink{mii__physubr_8c_a50acf7ba3fab73b23c13fe7da8c93f1d}{mii\_phy\_dev\_attach}}(dev, \mbox{\hyperlink{miivar_8h_ab5201dd2953a06a0ea2cd36a4332d82a}{MIIF\_NOISOLATE}} | \mbox{\hyperlink{miivar_8h_a8d2d38c2ee2b3eb2ccd1f0a3da5fed03}{MIIF\_NOMANPAUSE}}, mpf, 1);}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00108}00108         \mbox{\hyperlink{mii__physubr_8c_afac2ea5f0d036a16125e01fc48a41457}{mii\_phy\_setmedia}}(sc);}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00109}00109 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00110}00110         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00111}00111 \}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00112}00112 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00113}00113 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00114}\mbox{\hyperlink{smscphy_8c_acb3c06e39c9622b10970aaf7fdb42e9a}{00114}} \mbox{\hyperlink{smscphy_8c_acb3c06e39c9622b10970aaf7fdb42e9a}{smscphy\_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{smscphy_8c_source_l00115}00115 \{}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00116}00116         \textcolor{keyword}{struct  }ifmedia\_entry *ife;}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00117}00117         \textcolor{keywordtype}{int}     \mbox{\hyperlink{miibus__if_8m_aa391927e06832c3d8d2f4e89a25cdd81}{reg}};}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00118}00118 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00119}00119         ife = mii-\/>\mbox{\hyperlink{structmii__data_ac0e7ceb0ad8cc3eb2e55a6947d4c6fd0}{mii\_media}}.ifm\_cur;}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00120}00120 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00121}00121         \textcolor{keywordflow}{switch} (cmd) \{}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00122}00122         \textcolor{keywordflow}{case} \mbox{\hyperlink{miivar_8h_a5ee687df11441661206e4d2922ab5a52}{MII\_POLLSTAT}}:}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00123}00123                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00124}00124 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00125}00125         \textcolor{keywordflow}{case} \mbox{\hyperlink{miivar_8h_a6c5cb4a5233e6b1e8a8542636e8ba4c8}{MII\_MEDIACHG}}:}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00126}00126                 \textcolor{keywordflow}{switch} (IFM\_SUBTYPE(ife-\/>ifm\_media)) \{}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00127}00127                 \textcolor{keywordflow}{case} IFM\_AUTO:}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00128}00128                         \mbox{\hyperlink{smscphy_8c_ac4367d71ae2723ef4de28c9b2a1e8988}{smscphy\_auto}}(sc, ife-\/>ifm\_media);}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00129}00129                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00130}00130 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00131}00131                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00132}00132                         \mbox{\hyperlink{mii__physubr_8c_afac2ea5f0d036a16125e01fc48a41457}{mii\_phy\_setmedia}}(sc);}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00133}00133                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00134}00134                 \}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00135}00135 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00136}00136                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00137}00137 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00138}00138         \textcolor{keywordflow}{case} \mbox{\hyperlink{miivar_8h_a7aba758235b2d688fc41842a167187e5}{MII\_TICK}}:}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00139}00139                 \textcolor{keywordflow}{if} (IFM\_SUBTYPE(ife-\/>ifm\_media) != IFM\_AUTO) \{}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00140}00140                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00141}00141                 \}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00142}00142 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00143}00143                 \textcolor{comment}{/* I have no idea why BMCR\_ISO gets set. */}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00144}00144                 \mbox{\hyperlink{miibus__if_8m_aa391927e06832c3d8d2f4e89a25cdd81}{reg}} = \mbox{\hyperlink{miivar_8h_a4f9acdc044cd8d94bd80432e4f01bcd2}{PHY\_READ}}(sc, \mbox{\hyperlink{mii_8h_a9137acedc42ff140f244da7473cff29e}{MII\_BMCR}});}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00145}00145                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{miibus__if_8m_aa391927e06832c3d8d2f4e89a25cdd81}{reg}} \& \mbox{\hyperlink{mii_8h_a28b8dcb818bc18a079b39b5517c27e3a}{BMCR\_ISO}}) \{}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00146}00146                         \mbox{\hyperlink{miivar_8h_af302bd91f8177e3ca317b822f00680b5}{PHY\_WRITE}}(sc, \mbox{\hyperlink{mii_8h_a9137acedc42ff140f244da7473cff29e}{MII\_BMCR}}, \mbox{\hyperlink{miibus__if_8m_aa391927e06832c3d8d2f4e89a25cdd81}{reg}} \& \string~\mbox{\hyperlink{mii_8h_a28b8dcb818bc18a079b39b5517c27e3a}{BMCR\_ISO}});}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00147}00147                 \}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00148}00148 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00149}00149                 \mbox{\hyperlink{miibus__if_8m_aa391927e06832c3d8d2f4e89a25cdd81}{reg}} = \mbox{\hyperlink{miivar_8h_a4f9acdc044cd8d94bd80432e4f01bcd2}{PHY\_READ}}(sc, \mbox{\hyperlink{mii_8h_aa2f632686d6298a7c898b1c805586aab}{MII\_BMSR}}) | \mbox{\hyperlink{miivar_8h_a4f9acdc044cd8d94bd80432e4f01bcd2}{PHY\_READ}}(sc, \mbox{\hyperlink{mii_8h_aa2f632686d6298a7c898b1c805586aab}{MII\_BMSR}});}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00150}00150                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{miibus__if_8m_aa391927e06832c3d8d2f4e89a25cdd81}{reg}} \& \mbox{\hyperlink{mii_8h_aca42eb005e0fdbae038bd7c9f12a1035}{BMSR\_LINK}}) \{}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00151}00151                         sc-\/>\mbox{\hyperlink{structmii__softc_a4be7f594fccaa2de7950161135edb3eb}{mii\_ticks}} = 0;}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00152}00152                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00153}00153                 \}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00154}00154 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00155}00155                 \textcolor{keywordflow}{if} (++sc-\/>\mbox{\hyperlink{structmii__softc_a4be7f594fccaa2de7950161135edb3eb}{mii\_ticks}} <= \mbox{\hyperlink{miivar_8h_a42a72427970e47f6981f3725ad177d43}{MII\_ANEGTICKS}}) \{}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00156}00156                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00157}00157                 \}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00158}00158 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00159}00159                 sc-\/>\mbox{\hyperlink{structmii__softc_a4be7f594fccaa2de7950161135edb3eb}{mii\_ticks}} = 0;}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00160}00160                 \mbox{\hyperlink{miivar_8h_aa355e0359542ffc84e9060ab4556f4d8}{PHY\_RESET}}(sc);}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00161}00161                 \mbox{\hyperlink{smscphy_8c_ac4367d71ae2723ef4de28c9b2a1e8988}{smscphy\_auto}}(sc, ife-\/>ifm\_media);}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00162}00162                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00163}00163         \}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00164}00164 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00165}00165         \textcolor{comment}{/* Update the media status. */}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00166}00166         \mbox{\hyperlink{miivar_8h_a1c1cdb714bf40ba701256727dd6a73c5}{PHY\_STATUS}}(sc);}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00167}00167 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00168}00168         \textcolor{comment}{/* Callback if something changed. */}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00169}00169         \mbox{\hyperlink{mii__physubr_8c_ac5a93e41e086c93143a04d9d4548b251}{mii\_phy\_update}}(sc, cmd);}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00170}00170         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00171}00171 \}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00172}00172 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00173}00173 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00174}\mbox{\hyperlink{smscphy_8c_ac4367d71ae2723ef4de28c9b2a1e8988}{00174}} \mbox{\hyperlink{smscphy_8c_ac4367d71ae2723ef4de28c9b2a1e8988}{smscphy\_auto}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmii__softc}{mii\_softc}} *sc, \textcolor{keywordtype}{int} media)}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00175}00175 \{}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00176}00176         uint16\_t        anar;}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00177}00177 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00178}00178         anar = \mbox{\hyperlink{mii_8h_a3406eac06aaf4c12c4b46c8296400a94}{BMSR\_MEDIA\_TO\_ANAR}}(sc-\/>\mbox{\hyperlink{structmii__softc_ac3b545baf912e9bd14af8df8bb388050}{mii\_capabilities}}) | \mbox{\hyperlink{mii_8h_a890fc8f217d4396d1b0c65f1cefe9a2e}{ANAR\_CSMA}};}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00179}00179         \textcolor{keywordflow}{if} ((media \& IFM\_FLOW) != 0 || (sc-\/>\mbox{\hyperlink{structmii__softc_a99b489a558d699d0a69ffd5405db81aa}{mii\_flags}} \& \mbox{\hyperlink{miivar_8h_a16048a4e2a1da2f657f54b516df4b1fe}{MIIF\_FORCEPAUSE}}) != 0)}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00180}00180                 anar |= \mbox{\hyperlink{mii_8h_a238749af941282e3a074598b16e5442a}{ANAR\_FC}};}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00181}00181         \mbox{\hyperlink{miivar_8h_af302bd91f8177e3ca317b822f00680b5}{PHY\_WRITE}}(sc, \mbox{\hyperlink{mii_8h_aacb2ab0ea5579b5d9e30b075991add1d}{MII\_ANAR}}, anar);}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00182}00182         \textcolor{comment}{/* Apparently this helps. */}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00183}00183         anar = \mbox{\hyperlink{miivar_8h_a4f9acdc044cd8d94bd80432e4f01bcd2}{PHY\_READ}}(sc, \mbox{\hyperlink{mii_8h_aacb2ab0ea5579b5d9e30b075991add1d}{MII\_ANAR}});}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00184}00184         \mbox{\hyperlink{miivar_8h_af302bd91f8177e3ca317b822f00680b5}{PHY\_WRITE}}(sc, \mbox{\hyperlink{mii_8h_a9137acedc42ff140f244da7473cff29e}{MII\_BMCR}}, \mbox{\hyperlink{mii_8h_a8d92e7dc8997005e43add732fba16a0d}{BMCR\_AUTOEN}} | \mbox{\hyperlink{mii_8h_a2ed0562d5bde5bf56ec01a2e0b9a12a7}{BMCR\_STARTNEG}});}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00185}00185 \}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00186}00186 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00187}00187 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00188}\mbox{\hyperlink{smscphy_8c_aa25156fe76c422c71fb700acd219e5e1}{00188}} \mbox{\hyperlink{smscphy_8c_aa25156fe76c422c71fb700acd219e5e1}{smscphy\_status}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmii__softc}{mii\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00189}00189 \{}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00190}00190         \textcolor{keyword}{struct }\mbox{\hyperlink{structmii__data}{mii\_data}} *mii;}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00191}00191         uint32\_t bmcr, bmsr, status;}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00192}00192 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00193}00193         mii = sc-\/>\mbox{\hyperlink{structmii__softc_a12011aec864a92fb63b711b43e6b4356}{mii\_pdata}};}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00194}00194         mii-\/>\mbox{\hyperlink{structmii__data_a15c66b8658a144ac3294603a8146ac09}{mii\_media\_status}} = IFM\_AVALID;}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00195}00195         mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} = IFM\_ETHER;}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00196}00196 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00197}00197         bmsr = \mbox{\hyperlink{miivar_8h_a4f9acdc044cd8d94bd80432e4f01bcd2}{PHY\_READ}}(sc, \mbox{\hyperlink{mii_8h_aa2f632686d6298a7c898b1c805586aab}{MII\_BMSR}}) | \mbox{\hyperlink{miivar_8h_a4f9acdc044cd8d94bd80432e4f01bcd2}{PHY\_READ}}(sc, \mbox{\hyperlink{mii_8h_aa2f632686d6298a7c898b1c805586aab}{MII\_BMSR}});}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00198}00198         \textcolor{keywordflow}{if} ((bmsr \& \mbox{\hyperlink{mii_8h_aca42eb005e0fdbae038bd7c9f12a1035}{BMSR\_LINK}}) != 0)}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00199}00199                 mii-\/>\mbox{\hyperlink{structmii__data_a15c66b8658a144ac3294603a8146ac09}{mii\_media\_status}} |= IFM\_ACTIVE;}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00200}00200 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00201}00201         bmcr = \mbox{\hyperlink{miivar_8h_a4f9acdc044cd8d94bd80432e4f01bcd2}{PHY\_READ}}(sc, \mbox{\hyperlink{mii_8h_a9137acedc42ff140f244da7473cff29e}{MII\_BMCR}});}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00202}00202         \textcolor{keywordflow}{if} ((bmcr \& \mbox{\hyperlink{mii_8h_a28b8dcb818bc18a079b39b5517c27e3a}{BMCR\_ISO}}) != 0) \{}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00203}00203                 mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} |= IFM\_NONE;}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00204}00204                 mii-\/>\mbox{\hyperlink{structmii__data_a15c66b8658a144ac3294603a8146ac09}{mii\_media\_status}} = 0;}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00205}00205                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00206}00206         \}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00207}00207 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00208}00208         \textcolor{keywordflow}{if} ((bmcr \& \mbox{\hyperlink{mii_8h_aafd596a9125ddece08d5a9798dce42d6}{BMCR\_LOOP}}) != 0)}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00209}00209                 mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} |= IFM\_LOOP;}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00210}00210 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00211}00211         \textcolor{keywordflow}{if} ((bmcr \& \mbox{\hyperlink{mii_8h_a8d92e7dc8997005e43add732fba16a0d}{BMCR\_AUTOEN}}) != 0) \{}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00212}00212                 \textcolor{keywordflow}{if} ((bmsr \& \mbox{\hyperlink{mii_8h_aa602b8728f35b021f27e9db3b06a7e55}{BMSR\_ACOMP}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00213}00213                         \textcolor{comment}{/* Erg, still trying, I guess... */}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00214}00214                         mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} |= IFM\_NONE;}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00215}00215                         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00216}00216                 \}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00217}00217         \}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00218}00218 }
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00219}00219         status = \mbox{\hyperlink{miivar_8h_a4f9acdc044cd8d94bd80432e4f01bcd2}{PHY\_READ}}(sc, 0x1F);}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00220}00220         \textcolor{keywordflow}{if} (status \& 0x0008)}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00221}00221                 mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} |= IFM\_100\_TX;}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00222}00222         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00223}00223                 mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} |= IFM\_10\_T;}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00224}00224         \textcolor{keywordflow}{if} (status \& 0x0010)}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00225}00225                 mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} |= IFM\_FDX | \mbox{\hyperlink{mii__physubr_8c_a02a13013ccece7f7569fce9ab65424d3}{mii\_phy\_flowstatus}}(sc);}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00226}00226         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00227}00227                 mii-\/>\mbox{\hyperlink{structmii__data_a374b422968b2e4f40959161a1f6ed490}{mii\_media\_active}} |= IFM\_HDX;}
\DoxyCodeLine{\Hypertarget{smscphy_8c_source_l00228}00228 \}}

\end{DoxyCode}
