\hypertarget{generic__ehci__fdt_8c_source}{}\doxysection{generic\+\_\+ehci\+\_\+fdt.\+c}
\label{generic__ehci__fdt_8c_source}\index{dev/usb/controller/generic\_ehci\_fdt.c@{dev/usb/controller/generic\_ehci\_fdt.c}}
\mbox{\hyperlink{generic__ehci__fdt_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00002}00002 \textcolor{comment}{ * Copyright (c) 2012 Ganbold Tsagaankhuu <ganbold@freebsd.org>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00003}00003 \textcolor{comment}{ * Copyright (c) 2016 The FreeBSD Foundation}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00004}00004 \textcolor{comment}{ * All rights reserved.}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00005}00005 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00006}00006 \textcolor{comment}{ * This software was developed by Andrew Turner under}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00007}00007 \textcolor{comment}{ * sponsorship from the FreeBSD Foundation.}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00008}00008 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00009}00009 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00010}00010 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00011}00011 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00012}00012 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00013}00013 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00014}00014 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00015}00015 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00016}00016 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00017}00017 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00018}00018 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00019}00019 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00020}00020 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00021}00021 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00022}00022 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00023}00023 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00024}00024 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00025}00025 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00026}00026 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00027}00027 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00028}00028 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00029}00029 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00030}00030 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00031}00031 \textcolor{preprocessor}{\#include <sys/cdefs.h>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00032}\mbox{\hyperlink{generic__ehci__fdt_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{00032}} \mbox{\hyperlink{generic__ehci__fdt_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{\_\_FBSDID}}(\textcolor{stringliteral}{"{}\$FreeBSD\$"{}});}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00033}00033 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00034}00034 \textcolor{preprocessor}{\#include "{}opt\_bus.h"{}}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00035}00035 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00036}00036 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00037}00037 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <sys/bus.h>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00039}00039 \textcolor{preprocessor}{\#include <sys/condvar.h>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00040}00040 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00041}00041 \textcolor{preprocessor}{\#include <sys/module.h>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00042}00042 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00043}00043 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb_8h}{dev/usb/usb.h}}>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00044}00044 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usbdi_8h}{dev/usb/usbdi.h}}>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00045}00045 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00046}00046 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__core_8h}{dev/usb/usb\_core.h}}>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00047}00047 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__busdma_8h}{dev/usb/usb\_busdma.h}}>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00048}00048 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__process_8h}{dev/usb/usb\_process.h}}>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00049}00049 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00050}00050 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__controller_8h}{dev/usb/usb\_controller.h}}>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00051}00051 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__bus_8h}{dev/usb/usb\_bus.h}}>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00052}00052 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ehci_8h}{dev/usb/controller/ehci.h}}>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00053}00053 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00054}00054 \textcolor{preprocessor}{\#include <dev/fdt/fdt\_common.h>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00055}00055 \textcolor{preprocessor}{\#include <dev/ofw/openfirm.h>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00056}00056 \textcolor{preprocessor}{\#include <dev/ofw/ofw\_bus.h>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00057}00057 \textcolor{preprocessor}{\#include <dev/ofw/ofw\_bus\_subr.h>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00058}00058 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00059}00059 \textcolor{preprocessor}{\#include <dev/extres/clk/clk.h>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00060}00060 \textcolor{preprocessor}{\#include <dev/extres/hwreset/hwreset.h>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00061}00061 \textcolor{preprocessor}{\#include <dev/extres/phy/phy.h>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00062}00062 \textcolor{preprocessor}{\#include <dev/extres/phy/phy\_usb.h>}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00063}00063 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00064}00064 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{generic__ehci_8h}{generic\_ehci.h}}"{}}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00065}00065 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00066}\mbox{\hyperlink{structclk__list}{00066}} \textcolor{keyword}{struct }\mbox{\hyperlink{structclk__list}{clk\_list}} \{}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00067}00067         TAILQ\_ENTRY(\mbox{\hyperlink{structclk__list}{clk\_list}})   \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}};}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00068}00068         clk\_t                   clk;}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00069}00069 \};}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00070}00070 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00071}\mbox{\hyperlink{structhwrst__list}{00071}} \textcolor{keyword}{struct }\mbox{\hyperlink{structhwrst__list}{hwrst\_list}} \{}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00072}00072         TAILQ\_ENTRY(\mbox{\hyperlink{structhwrst__list}{hwrst\_list}})       \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}};}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00073}00073         hwreset\_t               rst;}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00074}00074 \};}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00075}00075 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00076}\mbox{\hyperlink{structphy__list}{00076}} \textcolor{keyword}{struct }\mbox{\hyperlink{structphy__list}{phy\_list}} \{}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00077}00077         TAILQ\_ENTRY(\mbox{\hyperlink{structphy__list}{phy\_list}})   \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}};}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00078}00078         phy\_t                   phy;}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00079}00079 \};}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00080}00080 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00081}\mbox{\hyperlink{structgeneric__ehci__fdt__softc}{00081}} \textcolor{keyword}{struct }\mbox{\hyperlink{structgeneric__ehci__fdt__softc}{generic\_ehci\_fdt\_softc}} \{}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00082}\mbox{\hyperlink{structgeneric__ehci__fdt__softc_a93a26c34270bfe3e7a77c765720d6c46}{00082}}         \mbox{\hyperlink{structehci__softc}{ehci\_softc\_t}}        \mbox{\hyperlink{structgeneric__ehci__fdt__softc_a93a26c34270bfe3e7a77c765720d6c46}{ehci\_sc}};}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00083}00083 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00084}00084         \mbox{\hyperlink{usb__device_8h_a1ab0778486582cd95b8a0bfa9739ae87}{TAILQ\_HEAD}}(, \mbox{\hyperlink{structclk__list}{clk\_list}})        \mbox{\hyperlink{structclk__list}{clk\_list}};}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00085}00085         \mbox{\hyperlink{usb__device_8h_a1ab0778486582cd95b8a0bfa9739ae87}{TAILQ\_HEAD}}(, \mbox{\hyperlink{structhwrst__list}{hwrst\_list}})    rst\_list;}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00086}00086         \mbox{\hyperlink{usb__device_8h_a1ab0778486582cd95b8a0bfa9739ae87}{TAILQ\_HEAD}}(, \mbox{\hyperlink{structphy__list}{phy\_list}})                \mbox{\hyperlink{structphy__list}{phy\_list}};}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00087}00087 \};}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00088}00088 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00089}\mbox{\hyperlink{generic__ehci__fdt_8c_a73537d57ee730dcf24e07717f674ddcc}{00089}} \textcolor{keyword}{static} device\_probe\_t \mbox{\hyperlink{generic__ehci__fdt_8c_a73537d57ee730dcf24e07717f674ddcc}{generic\_ehci\_fdt\_probe}};}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00090}\mbox{\hyperlink{generic__ehci__fdt_8c_ae32b764fc08b6cf8ec4d5c0975ebe969}{00090}} \textcolor{keyword}{static} device\_attach\_t \mbox{\hyperlink{generic__ehci__fdt_8c_ae32b764fc08b6cf8ec4d5c0975ebe969}{generic\_ehci\_fdt\_attach}};}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00091}\mbox{\hyperlink{generic__ehci__fdt_8c_a5b42215885a3f51a6637433c788d81fc}{00091}} \textcolor{keyword}{static} device\_detach\_t \mbox{\hyperlink{generic__ehci__fdt_8c_a5b42215885a3f51a6637433c788d81fc}{generic\_ehci\_fdt\_detach}};}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00092}00092 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00093}00093 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00094}\mbox{\hyperlink{generic__ehci__fdt_8c_ab581f1cc425a0b7619cbbde84dffd8f4}{00094}} \mbox{\hyperlink{generic__ehci__fdt_8c_a73537d57ee730dcf24e07717f674ddcc}{generic\_ehci\_fdt\_probe}}(device\_t self)}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00095}00095 \{}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00096}00096 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00097}00097         \textcolor{keywordflow}{if} (!ofw\_bus\_status\_okay(self))}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00098}00098                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00099}00099 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00100}00100         \textcolor{keywordflow}{if} (!ofw\_bus\_is\_compatible(self, \textcolor{stringliteral}{"{}generic-\/ehci"{}}))}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00101}00101                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00102}00102 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00103}00103         device\_set\_desc(self, \textcolor{stringliteral}{"{}Generic EHCI Controller"{}});}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00104}00104         \textcolor{keywordflow}{return} (BUS\_PROBE\_DEFAULT);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00105}00105 \}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00106}00106 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00107}00107 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00108}\mbox{\hyperlink{generic__ehci__fdt_8c_a7807362cb4ebf65f20f3710c39d395ea}{00108}} \mbox{\hyperlink{generic__ehci__fdt_8c_ae32b764fc08b6cf8ec4d5c0975ebe969}{generic\_ehci\_fdt\_attach}}(device\_t dev)}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00109}00109 \{}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00110}00110         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00111}00111         \textcolor{keyword}{struct }\mbox{\hyperlink{structgeneric__ehci__fdt__softc}{generic\_ehci\_fdt\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00112}00112         \textcolor{keyword}{struct }\mbox{\hyperlink{structclk__list}{clk\_list}} *clkp;}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00113}00113         clk\_t clk;}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00114}00114         \textcolor{keyword}{struct }\mbox{\hyperlink{structhwrst__list}{hwrst\_list}} *rstp;}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00115}00115         hwreset\_t rst;}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00116}00116         \textcolor{keyword}{struct }\mbox{\hyperlink{structphy__list}{phy\_list}} *phyp;}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00117}00117         phy\_t phy;}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00118}00118         \textcolor{keywordtype}{int} off;}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00119}00119 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00120}00120         sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00121}00121 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00122}00122         TAILQ\_INIT(\&sc-\/>clk\_list);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00123}00123         \textcolor{comment}{/* Enable clock */}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00124}00124         \textcolor{keywordflow}{for} (off = 0; clk\_get\_by\_ofw\_index(dev, 0, off, \&clk) == 0; off++) \{}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00125}00125                 err = clk\_enable(clk);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00126}00126                 \textcolor{keywordflow}{if} (err != 0) \{}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00127}00127                         device\_printf(dev, \textcolor{stringliteral}{"{}Could not enable clock \%s\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00128}00128                             clk\_get\_name(clk));}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00129}00129                         \textcolor{keywordflow}{goto} \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}};}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00130}00130                 \}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00131}00131                 clkp = malloc(\textcolor{keyword}{sizeof}(*clkp), M\_DEVBUF, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00132}00132                 clkp-\/>clk = clk;}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00133}00133                 TAILQ\_INSERT\_TAIL(\&sc-\/>clk\_list, clkp, \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}});}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00134}00134         \}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00135}00135 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00136}00136         \textcolor{comment}{/* De-\/assert reset */}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00137}00137         TAILQ\_INIT(\&sc-\/>rst\_list);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00138}00138         \textcolor{keywordflow}{for} (off = 0; hwreset\_get\_by\_ofw\_idx(dev, 0, off, \&rst) == 0; off++) \{}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00139}00139                 err = hwreset\_deassert(rst);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00140}00140                 \textcolor{keywordflow}{if} (err != 0) \{}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00141}00141                         device\_printf(dev, \textcolor{stringliteral}{"{}Could not de-\/assert reset\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00142}00142                         \textcolor{keywordflow}{goto} \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}};}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00143}00143                 \}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00144}00144                 rstp = malloc(\textcolor{keyword}{sizeof}(*rstp), M\_DEVBUF, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00145}00145                 rstp-\/>rst = rst;}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00146}00146                 TAILQ\_INSERT\_TAIL(\&sc-\/>rst\_list, rstp, \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}});}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00147}00147         \}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00148}00148 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00149}00149         \textcolor{comment}{/* Enable USB PHY */}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00150}00150         TAILQ\_INIT(\&sc-\/>phy\_list);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00151}00151         \textcolor{keywordflow}{for} (off = 0; phy\_get\_by\_ofw\_idx(dev, 0, off, \&phy) == 0; off++) \{}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00152}00152                 err = phy\_usb\_set\_mode(phy, PHY\_USB\_MODE\_HOST);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00153}00153                 \textcolor{keywordflow}{if} (err != 0) \{}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00154}00154                         device\_printf(dev, \textcolor{stringliteral}{"{}Could not set phy to host mode\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00155}00155                         \textcolor{keywordflow}{goto} \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}};}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00156}00156                 \}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00157}00157                 err = phy\_enable(phy);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00158}00158                 \textcolor{keywordflow}{if} (err != 0) \{}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00159}00159                         device\_printf(dev, \textcolor{stringliteral}{"{}Could not enable phy\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00160}00160                         \textcolor{keywordflow}{goto} \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}};}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00161}00161                 \}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00162}00162                 phyp = malloc(\textcolor{keyword}{sizeof}(*phyp), M\_DEVBUF, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00163}00163                 phyp-\/>phy = phy;}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00164}00164                 TAILQ\_INSERT\_TAIL(\&sc-\/>phy\_list, phyp, \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}});}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00165}00165         \}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00166}00166 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00167}00167         err = \mbox{\hyperlink{generic__ehci_8h_a89a62ae9100a4b7829992727c4509069}{generic\_ehci\_attach}}(dev);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00168}00168         \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00169}00169                 \textcolor{keywordflow}{goto} \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}};}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00170}00170 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00171}00171         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00172}00172 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00173}00173 \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}}:}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00174}00174         \mbox{\hyperlink{generic__ehci__fdt_8c_a5b42215885a3f51a6637433c788d81fc}{generic\_ehci\_fdt\_detach}}(dev);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00175}00175         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00176}00176 \}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00177}00177 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00178}00178 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00179}\mbox{\hyperlink{generic__ehci__fdt_8c_a3831b5198a27be524dc3a6dbd2b73ab8}{00179}} \mbox{\hyperlink{generic__ehci__fdt_8c_a5b42215885a3f51a6637433c788d81fc}{generic\_ehci\_fdt\_detach}}(device\_t dev)}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00180}00180 \{}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00181}00181         \textcolor{keyword}{struct }\mbox{\hyperlink{structgeneric__ehci__fdt__softc}{generic\_ehci\_fdt\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00182}00182         \textcolor{keyword}{struct }\mbox{\hyperlink{structclk__list}{clk\_list}} *clk, *clk\_tmp;}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00183}00183         \textcolor{keyword}{struct }\mbox{\hyperlink{structhwrst__list}{hwrst\_list}} *rst, *rst\_tmp;}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00184}00184         \textcolor{keyword}{struct }\mbox{\hyperlink{structphy__list}{phy\_list}} *phy, *phy\_tmp;}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00185}00185         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00186}00186 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00187}00187         err = \mbox{\hyperlink{generic__ehci_8h_a2f53a8fc37394a17079bafca2668a38e}{generic\_ehci\_detach}}(dev);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00188}00188         \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00189}00189                 \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00190}00190 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00191}00191         sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00192}00192 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00193}00193         \textcolor{comment}{/* Disable clock */}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00194}00194         TAILQ\_FOREACH\_SAFE(clk, \&sc-\/>clk\_list, \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}}, clk\_tmp) \{}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00195}00195                 err = clk\_disable(clk-\/>clk);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00196}00196                 \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00197}00197                         device\_printf(dev, \textcolor{stringliteral}{"{}Could not disable clock \%s\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00198}00198                             clk\_get\_name(clk-\/>clk));}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00199}00199                 err = clk\_release(clk-\/>clk);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00200}00200                 \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00201}00201                         device\_printf(dev, \textcolor{stringliteral}{"{}Could not release clock \%s\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00202}00202                             clk\_get\_name(clk-\/>clk));}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00203}00203                 TAILQ\_REMOVE(\&sc-\/>clk\_list, clk, \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}});}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00204}00204                 free(clk, M\_DEVBUF);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00205}00205         \}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00206}00206 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00207}00207         \textcolor{comment}{/* Assert reset */}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00208}00208         TAILQ\_FOREACH\_SAFE(rst, \&sc-\/>rst\_list, \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}}, rst\_tmp) \{}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00209}00209                 hwreset\_assert(rst-\/>rst);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00210}00210                 hwreset\_release(rst-\/>rst);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00211}00211                 TAILQ\_REMOVE(\&sc-\/>rst\_list, rst, \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}});}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00212}00212                 free(rst, M\_DEVBUF);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00213}00213         \}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00214}00214 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00215}00215         \textcolor{comment}{/* Disable phys */}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00216}00216         TAILQ\_FOREACH\_SAFE(phy, \&sc-\/>phy\_list, \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}}, phy\_tmp) \{}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00217}00217                 err = phy\_disable(phy-\/>phy);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00218}00218                 \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00219}00219                         device\_printf(dev, \textcolor{stringliteral}{"{}Could not disable phy\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00220}00220                 phy\_release(phy-\/>phy);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00221}00221                 TAILQ\_REMOVE(\&sc-\/>phy\_list, phy, \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}});}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00222}00222                 free(phy, M\_DEVBUF);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00223}00223         \}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00224}00224 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00225}00225         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00226}00226 \}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00227}00227 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00228}\mbox{\hyperlink{generic__ehci__fdt_8c_a425d575111825845545fed590d4f6ae5}{00228}} \textcolor{keyword}{static} device\_method\_t \mbox{\hyperlink{generic__ehci__fdt_8c_a425d575111825845545fed590d4f6ae5}{ehci\_fdt\_methods}}[] = \{}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00229}00229         \textcolor{comment}{/* Device interface */}}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00230}00230         DEVMETHOD(device\_probe,         \mbox{\hyperlink{generic__ehci__fdt_8c_a73537d57ee730dcf24e07717f674ddcc}{generic\_ehci\_fdt\_probe}}),}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00231}00231         DEVMETHOD(device\_attach,        \mbox{\hyperlink{generic__ehci__fdt_8c_ae32b764fc08b6cf8ec4d5c0975ebe969}{generic\_ehci\_fdt\_attach}}),}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00232}00232         DEVMETHOD(device\_detach,        \mbox{\hyperlink{generic__ehci__fdt_8c_a5b42215885a3f51a6637433c788d81fc}{generic\_ehci\_fdt\_detach}}),}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00233}00233 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00234}00234         DEVMETHOD\_END}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00235}00235 \};}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00236}00236 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00237}\mbox{\hyperlink{generic__ehci__fdt_8c_a47e9292142add055e6f55eac66856af9}{00237}} \mbox{\hyperlink{generic__ehci__fdt_8c_a47e9292142add055e6f55eac66856af9}{DEFINE\_CLASS\_1}}(ehci, ehci\_fdt\_driver, \mbox{\hyperlink{generic__ehci__fdt_8c_a425d575111825845545fed590d4f6ae5}{ehci\_fdt\_methods}},}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00238}00238     \textcolor{keyword}{sizeof}(\mbox{\hyperlink{structehci__softc}{ehci\_softc\_t}}), \mbox{\hyperlink{generic__ehci_8c_aa62cc89e133382a274c6dcfd4ae45d64}{generic\_ehci\_driver}});}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00239}00239 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00240}\mbox{\hyperlink{generic__ehci__fdt_8c_af736a0b613467bd5719440d7900a5004}{00240}} \textcolor{keyword}{static} devclass\_t \mbox{\hyperlink{generic__ehci__fdt_8c_af736a0b613467bd5719440d7900a5004}{ehci\_fdt\_devclass}};}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00241}00241 }
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00242}\mbox{\hyperlink{generic__ehci__fdt_8c_a2118b9e212687bd97b8715e24b2598fc}{00242}} \mbox{\hyperlink{generic__ehci__fdt_8c_a2118b9e212687bd97b8715e24b2598fc}{DRIVER\_MODULE}}(generic\_ehci, simplebus, ehci\_fdt\_driver, \mbox{\hyperlink{generic__ehci__fdt_8c_af736a0b613467bd5719440d7900a5004}{ehci\_fdt\_devclass}}, 0, 0);}
\DoxyCodeLine{\Hypertarget{generic__ehci__fdt_8c_source_l00243}\mbox{\hyperlink{generic__ehci__fdt_8c_a7962b5d36985da91d53aa68385f651cd}{00243}} \mbox{\hyperlink{generic__ehci__fdt_8c_a7962b5d36985da91d53aa68385f651cd}{MODULE\_DEPEND}}(generic\_ehci, \mbox{\hyperlink{usb__if_8m_adfa3f6da9c4881e494b180c4ebb06470}{usb}}, 1, 1, 1);}

\end{DoxyCode}
