\hypertarget{usb__nop__xceiv_8c_source}{}\doxysection{usb\+\_\+nop\+\_\+xceiv.\+c}
\label{usb__nop__xceiv_8c_source}\index{dev/usb/controller/usb\_nop\_xceiv.c@{dev/usb/controller/usb\_nop\_xceiv.c}}
\mbox{\hyperlink{usb__nop__xceiv_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00002}00002 \textcolor{comment}{ * SPDX-\/License-\/Identifier: BSD-\/2-\/Clause-\/FreeBSD}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00004}00004 \textcolor{comment}{ * Copyright (c) 2019 Rubicon Communications, LLC (Netgate)}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00005}00005 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00006}00006 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00007}00007 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00008}00008 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00009}00009 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00010}00010 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00011}00011 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00012}00012 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00013}00013 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00014}00014 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00015}00015 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00016}00016 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00017}00017 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00018}00018 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00019}00019 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00020}00020 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00021}00021 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00022}00022 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00023}00023 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00024}00024 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00025}00025 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00026}00026 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00027}00027 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00028}00028 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00029}00029 \textcolor{preprocessor}{\#include <sys/cdefs.h>}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00030}\mbox{\hyperlink{usb__nop__xceiv_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{00030}} \mbox{\hyperlink{usb__nop__xceiv_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{\_\_FBSDID}}(\textcolor{stringliteral}{"{}\$FreeBSD\$"{}});}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00031}00031 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00032}00032 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00033}00033 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00034}00034 \textcolor{preprocessor}{\#include <sys/bus.h>}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00035}00035 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00036}00036 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00037}00037 \textcolor{preprocessor}{\#include <sys/module.h>}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <sys/rman.h>}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00039}00039 \textcolor{preprocessor}{\#include <sys/lock.h>}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00040}00040 \textcolor{preprocessor}{\#include <sys/mutex.h>}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00041}00041 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00042}00042 \textcolor{preprocessor}{\#include <machine/bus.h>}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00043}00043 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00044}00044 \textcolor{preprocessor}{\#include <dev/ofw/ofw\_bus.h>}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00045}00045 \textcolor{preprocessor}{\#include <dev/ofw/ofw\_bus\_subr.h>}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00046}00046 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00047}00047 \textcolor{preprocessor}{\#include <dev/extres/clk/clk.h>}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00048}00048 \textcolor{preprocessor}{\#include <dev/extres/regulator/regulator.h>}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00049}00049 \textcolor{preprocessor}{\#include <dev/extres/phy/phy\_usb.h>}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00050}00050 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00051}00051 \textcolor{preprocessor}{\#include "{}phynode\_if.h"{}}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00052}00052 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00053}\mbox{\hyperlink{structusb__nop__xceiv__softc}{00053}} \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__nop__xceiv__softc}{usb\_nop\_xceiv\_softc}} \{}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00054}\mbox{\hyperlink{structusb__nop__xceiv__softc_a0f27e1e1e1a77eea2a7771ef989f09ce}{00054}}         device\_t                \mbox{\hyperlink{structusb__nop__xceiv__softc_a0f27e1e1e1a77eea2a7771ef989f09ce}{dev}};}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00055}\mbox{\hyperlink{structusb__nop__xceiv__softc_a982e6f2e1387247fbe82a060226880de}{00055}}         regulator\_t             \mbox{\hyperlink{structusb__nop__xceiv__softc_a982e6f2e1387247fbe82a060226880de}{vcc\_supply}};}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00056}\mbox{\hyperlink{structusb__nop__xceiv__softc_a4b69da14db47f364c478d88e137f7cbf}{00056}}         clk\_t                   \mbox{\hyperlink{structusb__nop__xceiv__softc_a4b69da14db47f364c478d88e137f7cbf}{clk}};}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00057}\mbox{\hyperlink{structusb__nop__xceiv__softc_a03f26396daa824050dc3199c4961e4cd}{00057}}         uint32\_t                \mbox{\hyperlink{structusb__nop__xceiv__softc_a03f26396daa824050dc3199c4961e4cd}{clk\_freq}};}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00058}00058 \};}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00059}00059 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00060}\mbox{\hyperlink{usb__nop__xceiv_8c_ab1bb129b8c62d8033fbb3adf82f284a0}{00060}} \textcolor{keyword}{static} \textcolor{keyword}{struct }ofw\_compat\_data \mbox{\hyperlink{usb__nop__xceiv_8c_ab1bb129b8c62d8033fbb3adf82f284a0}{compat\_data}}[] = \{}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00061}00061         \{\textcolor{stringliteral}{"{}usb-\/nop-\/xceiv"{}}, 1\},}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00062}00062         \{NULL,            0\}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00063}00063 \};}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00064}00064 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00065}00065 \textcolor{comment}{/* Phy class and methods. */}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00066}00066 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{usb__nop__xceiv_8c_af0411c16cc9c9034d303ee8c8ea411b3}{usb\_nop\_xceiv\_phy\_enable}}(\textcolor{keyword}{struct} phynode *phy, \textcolor{keywordtype}{bool} enable);}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00067}\mbox{\hyperlink{usb__nop__xceiv_8c_aa7319d3e9b149339b2e5b7243d9e77d6}{00067}} \textcolor{keyword}{static} phynode\_usb\_method\_t \mbox{\hyperlink{usb__nop__xceiv_8c_aa7319d3e9b149339b2e5b7243d9e77d6}{usb\_nop\_xceiv\_phynode\_methods}}[] = \{}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00068}00068         PHYNODEMETHOD(phynode\_enable, \mbox{\hyperlink{usb__nop__xceiv_8c_af0411c16cc9c9034d303ee8c8ea411b3}{usb\_nop\_xceiv\_phy\_enable}}),}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00069}00069 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00070}00070         PHYNODEMETHOD\_END}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00071}00071 \};}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00072}\mbox{\hyperlink{usb__nop__xceiv_8c_a90a38d397dd4f8af2bf2721215898a7d}{00072}} \mbox{\hyperlink{usb__nop__xceiv_8c_a90a38d397dd4f8af2bf2721215898a7d}{DEFINE\_CLASS\_1}}(usb\_nop\_xceiv\_phynode, usb\_nop\_xceiv\_phynode\_class,}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00073}00073     \mbox{\hyperlink{usb__nop__xceiv_8c_aa7319d3e9b149339b2e5b7243d9e77d6}{usb\_nop\_xceiv\_phynode\_methods}},}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00074}00074     \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} phynode\_usb\_sc), phynode\_usb\_class);}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00075}00075 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00076}00076 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00077}\mbox{\hyperlink{usb__nop__xceiv_8c_af0411c16cc9c9034d303ee8c8ea411b3}{00077}} \mbox{\hyperlink{usb__nop__xceiv_8c_af0411c16cc9c9034d303ee8c8ea411b3}{usb\_nop\_xceiv\_phy\_enable}}(\textcolor{keyword}{struct} phynode *phynode, \textcolor{keywordtype}{bool} enable)}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00078}00078 \{}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00079}00079         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__nop__xceiv__softc}{usb\_nop\_xceiv\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00080}00080         device\_t \mbox{\hyperlink{structusb__nop__xceiv__softc_a0f27e1e1e1a77eea2a7771ef989f09ce}{dev}};}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00081}00081         intptr\_t phy;}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00082}00082         \textcolor{keywordtype}{int} \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}};}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00083}00083 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00084}00084         \mbox{\hyperlink{structusb__nop__xceiv__softc_a0f27e1e1e1a77eea2a7771ef989f09ce}{dev}} = phynode\_get\_device(phynode);}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00085}00085         phy = phynode\_get\_id(phynode);}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00086}00086         sc = device\_get\_softc(\mbox{\hyperlink{structusb__nop__xceiv__softc_a0f27e1e1e1a77eea2a7771ef989f09ce}{dev}});}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00087}00087 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00088}00088         \textcolor{keywordflow}{if} (phy != 0)}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00089}00089                 \textcolor{keywordflow}{return} (ERANGE);}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00090}00090 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00091}00091         \textcolor{comment}{/* Enable the phy clock */}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00092}00092         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structusb__nop__xceiv__softc_a03f26396daa824050dc3199c4961e4cd}{clk\_freq}} != 0) \{}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00093}00093                 \textcolor{keywordflow}{if} (enable) \{}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00094}00094                         \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} = clk\_set\_freq(sc-\/>\mbox{\hyperlink{structusb__nop__xceiv__softc_a4b69da14db47f364c478d88e137f7cbf}{clk}}, sc-\/>\mbox{\hyperlink{structusb__nop__xceiv__softc_a03f26396daa824050dc3199c4961e4cd}{clk\_freq}},}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00095}00095                           CLK\_SET\_ROUND\_ANY);}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00096}00096                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} != 0) \{}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00097}00097                                 device\_printf(\mbox{\hyperlink{structusb__nop__xceiv__softc_a0f27e1e1e1a77eea2a7771ef989f09ce}{dev}}, \textcolor{stringliteral}{"{}Cannot set clock to \%dMhz\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00098}00098                                   sc-\/>\mbox{\hyperlink{structusb__nop__xceiv__softc_a03f26396daa824050dc3199c4961e4cd}{clk\_freq}});}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00099}00099                                 \textcolor{keywordflow}{goto} \mbox{\hyperlink{if__runreg_8h_a041c8b8d78f50876bc74559cb40f00f4}{fail}};}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00100}00100                         \}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00101}00101 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00102}00102                         \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} = clk\_enable(sc-\/>\mbox{\hyperlink{structusb__nop__xceiv__softc_a4b69da14db47f364c478d88e137f7cbf}{clk}});}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00103}00103                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00104}00104                         \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} = clk\_disable(sc-\/>\mbox{\hyperlink{structusb__nop__xceiv__softc_a4b69da14db47f364c478d88e137f7cbf}{clk}});}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00105}00105 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00106}00106                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} != 0) \{}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00107}00107                         device\_printf(\mbox{\hyperlink{structusb__nop__xceiv__softc_a0f27e1e1e1a77eea2a7771ef989f09ce}{dev}}, \textcolor{stringliteral}{"{}Cannot \%sable the clock\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00108}00108                             enable ? \textcolor{stringliteral}{"{}En"{}} : \textcolor{stringliteral}{"{}Dis"{}});}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00109}00109                         \textcolor{keywordflow}{goto} \mbox{\hyperlink{if__runreg_8h_a041c8b8d78f50876bc74559cb40f00f4}{fail}};}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00110}00110                 \}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00111}00111         \}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00112}00112         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structusb__nop__xceiv__softc_a982e6f2e1387247fbe82a060226880de}{vcc\_supply}}) \{}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00113}00113                 \textcolor{keywordflow}{if} (enable)}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00114}00114                         \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} = regulator\_enable(sc-\/>\mbox{\hyperlink{structusb__nop__xceiv__softc_a982e6f2e1387247fbe82a060226880de}{vcc\_supply}});}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00115}00115                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00116}00116                         \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} = regulator\_disable(sc-\/>\mbox{\hyperlink{structusb__nop__xceiv__softc_a982e6f2e1387247fbe82a060226880de}{vcc\_supply}});}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00117}00117                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} != 0) \{}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00118}00118                         device\_printf(\mbox{\hyperlink{structusb__nop__xceiv__softc_a0f27e1e1e1a77eea2a7771ef989f09ce}{dev}}, \textcolor{stringliteral}{"{}Cannot \%sable the regulator\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00119}00119                             enable ? \textcolor{stringliteral}{"{}En"{}} : \textcolor{stringliteral}{"{}Dis"{}});}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00120}00120                         \textcolor{keywordflow}{goto} \mbox{\hyperlink{if__runreg_8h_a041c8b8d78f50876bc74559cb40f00f4}{fail}};}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00121}00121                 \}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00122}00122         \}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00123}00123 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00124}00124         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00125}00125 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00126}00126 \mbox{\hyperlink{if__runreg_8h_a041c8b8d78f50876bc74559cb40f00f4}{fail}}:}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00127}00127         \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00128}00128 \}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00129}00129 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00130}00130 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00131}\mbox{\hyperlink{usb__nop__xceiv_8c_af7832c9bab68ba4a181efc70dd19b440}{00131}} \mbox{\hyperlink{usb__nop__xceiv_8c_af7832c9bab68ba4a181efc70dd19b440}{usb\_nop\_xceiv\_probe}}(device\_t \mbox{\hyperlink{structusb__nop__xceiv__softc_a0f27e1e1e1a77eea2a7771ef989f09ce}{dev}})}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00132}00132 \{}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00133}00133 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00134}00134         \textcolor{keywordflow}{if} (!ofw\_bus\_status\_okay(\mbox{\hyperlink{structusb__nop__xceiv__softc_a0f27e1e1e1a77eea2a7771ef989f09ce}{dev}}))}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00135}00135                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00136}00136 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00137}00137         \textcolor{keywordflow}{if} (ofw\_bus\_search\_compatible(\mbox{\hyperlink{structusb__nop__xceiv__softc_a0f27e1e1e1a77eea2a7771ef989f09ce}{dev}}, \mbox{\hyperlink{usb__nop__xceiv_8c_ab1bb129b8c62d8033fbb3adf82f284a0}{compat\_data}})-\/>ocd\_data == 0)}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00138}00138                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00139}00139 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00140}00140         device\_set\_desc(\mbox{\hyperlink{structusb__nop__xceiv__softc_a0f27e1e1e1a77eea2a7771ef989f09ce}{dev}}, \textcolor{stringliteral}{"{}USB NOP PHY"{}});}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00141}00141         \textcolor{keywordflow}{return} (BUS\_PROBE\_DEFAULT);}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00142}00142 \}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00143}00143 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00144}00144 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00145}\mbox{\hyperlink{usb__nop__xceiv_8c_a3db6779b178d684f084b3659688fc983}{00145}} \mbox{\hyperlink{usb__nop__xceiv_8c_a3db6779b178d684f084b3659688fc983}{usb\_nop\_xceiv\_attach}}(device\_t \mbox{\hyperlink{structusb__nop__xceiv__softc_a0f27e1e1e1a77eea2a7771ef989f09ce}{dev}})}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00146}00146 \{}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00147}00147         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__nop__xceiv__softc}{usb\_nop\_xceiv\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00148}00148         \textcolor{keyword}{struct }phynode *phynode;}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00149}00149         \textcolor{keyword}{struct }phynode\_init\_def phy\_init;}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00150}00150         phandle\_t node;}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00151}00151         \textcolor{keywordtype}{int} \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}};}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00152}00152 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00153}00153         sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00154}00154         sc-\/>\mbox{\hyperlink{structusb__nop__xceiv__softc_a0f27e1e1e1a77eea2a7771ef989f09ce}{dev}} = dev;}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00155}00155         node = ofw\_bus\_get\_node(dev);}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00156}00156 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00157}00157         \textcolor{comment}{/* Parse the optional properties */}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00158}00158         OF\_getencprop(node, \textcolor{stringliteral}{"{}clock-\/frequency"{}}, \&sc-\/>\mbox{\hyperlink{structusb__nop__xceiv__softc_a03f26396daa824050dc3199c4961e4cd}{clk\_freq}}, \textcolor{keyword}{sizeof}(uint32\_t));}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00159}00159 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00160}00160         \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} = clk\_get\_by\_ofw\_name(dev, node, \textcolor{stringliteral}{"{}main\_clk"{}}, \&sc-\/>\mbox{\hyperlink{structusb__nop__xceiv__softc_a4b69da14db47f364c478d88e137f7cbf}{clk}});}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00161}00161         \textcolor{keywordflow}{if} (\mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} != 0 \&\& sc-\/>\mbox{\hyperlink{structusb__nop__xceiv__softc_a03f26396daa824050dc3199c4961e4cd}{clk\_freq}} != 0) \{}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00162}00162                 device\_printf(dev, \textcolor{stringliteral}{"{}clock property is mandatory if clock-\/frequency is present\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00163}00163                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00164}00164         \}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00165}00165 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00166}00166         regulator\_get\_by\_ofw\_property(dev, node, \textcolor{stringliteral}{"{}vcc-\/supply"{}}, \&sc-\/>\mbox{\hyperlink{structusb__nop__xceiv__softc_a982e6f2e1387247fbe82a060226880de}{vcc\_supply}});}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00167}00167 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00168}00168         phy\_init.id = 0;}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00169}00169         phy\_init.ofw\_node = node;}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00170}00170         phynode = phynode\_create(dev, \&usb\_nop\_xceiv\_phynode\_class,}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00171}00171             \&phy\_init);}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00172}00172         \textcolor{keywordflow}{if} (phynode == NULL) \{}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00173}00173                 device\_printf(dev, \textcolor{stringliteral}{"{}failed to create USB NOP PHY\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00174}00174                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00175}00175         \}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00176}00176         \textcolor{keywordflow}{if} (phynode\_register(phynode) == NULL) \{}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00177}00177                 device\_printf(dev, \textcolor{stringliteral}{"{}failed to create USB NOP PHY\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00178}00178                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00179}00179         \}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00180}00180 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00181}00181         OF\_device\_register\_xref(OF\_xref\_from\_node(node), dev);}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00182}00182 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00183}00183         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00184}00184 \}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00185}00185 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00186}00186 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00187}\mbox{\hyperlink{usb__nop__xceiv_8c_afc894a601b7cdd8d3d3f13ba23c6ccb2}{00187}} \mbox{\hyperlink{usb__nop__xceiv_8c_afc894a601b7cdd8d3d3f13ba23c6ccb2}{usb\_nop\_xceiv\_detach}}(device\_t dev)}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00188}00188 \{}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00189}00189 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00190}00190         \textcolor{keywordflow}{return} (EBUSY);}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00191}00191 \}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00192}00192 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00193}\mbox{\hyperlink{usb__nop__xceiv_8c_af00fdc9224017c4eae375f29d45c3e05}{00193}} \textcolor{keyword}{static} device\_method\_t \mbox{\hyperlink{usb__nop__xceiv_8c_af00fdc9224017c4eae375f29d45c3e05}{usb\_nop\_xceiv\_methods}}[] = \{}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00194}00194         \textcolor{comment}{/* Device interface */}}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00195}00195         DEVMETHOD(device\_probe, \mbox{\hyperlink{usb__nop__xceiv_8c_af7832c9bab68ba4a181efc70dd19b440}{usb\_nop\_xceiv\_probe}}),}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00196}00196         DEVMETHOD(device\_attach, \mbox{\hyperlink{usb__nop__xceiv_8c_a3db6779b178d684f084b3659688fc983}{usb\_nop\_xceiv\_attach}}),}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00197}00197         DEVMETHOD(device\_detach, \mbox{\hyperlink{usb__nop__xceiv_8c_afc894a601b7cdd8d3d3f13ba23c6ccb2}{usb\_nop\_xceiv\_detach}}),}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00198}00198 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00199}00199         DEVMETHOD\_END}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00200}00200 \};}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00201}00201 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00202}\mbox{\hyperlink{usb__nop__xceiv_8c_ae32cf6db501d4ebe2a9e3042bf925f81}{00202}} \textcolor{keyword}{static} devclass\_t \mbox{\hyperlink{usb__nop__xceiv_8c_ae32cf6db501d4ebe2a9e3042bf925f81}{usb\_nop\_xceiv\_devclass}};}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00203}00203 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00204}\mbox{\hyperlink{usb__nop__xceiv_8c_aa25dc9030bb745cef5e49889dbf6cc41}{00204}} \textcolor{keyword}{static} driver\_t \mbox{\hyperlink{usb__nop__xceiv_8c_aa25dc9030bb745cef5e49889dbf6cc41}{usb\_nop\_xceiv\_driver}} = \{}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00205}00205         \textcolor{stringliteral}{"{}usb\_nop\_xceiv"{}},}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00206}00206         \mbox{\hyperlink{usb__nop__xceiv_8c_af00fdc9224017c4eae375f29d45c3e05}{usb\_nop\_xceiv\_methods}},}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00207}00207         \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct }\mbox{\hyperlink{structusb__nop__xceiv__softc}{usb\_nop\_xceiv\_softc}}),}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00208}00208 \};}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00209}00209 }
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00210}\mbox{\hyperlink{usb__nop__xceiv_8c_a3f72ddb156f15d0ba6f3291250b4a3f2}{00210}} \mbox{\hyperlink{usb__nop__xceiv_8c_a3f72ddb156f15d0ba6f3291250b4a3f2}{EARLY\_DRIVER\_MODULE}}(usb\_nop\_xceiv, simplebus, \mbox{\hyperlink{usb__nop__xceiv_8c_aa25dc9030bb745cef5e49889dbf6cc41}{usb\_nop\_xceiv\_driver}},}
\DoxyCodeLine{\Hypertarget{usb__nop__xceiv_8c_source_l00211}00211     \mbox{\hyperlink{usb__nop__xceiv_8c_ae32cf6db501d4ebe2a9e3042bf925f81}{usb\_nop\_xceiv\_devclass}}, 0, 0, BUS\_PASS\_SUPPORTDEV + BUS\_PASS\_ORDER\_MIDDLE);}

\end{DoxyCode}
