\hypertarget{generic__ohci_8c_source}{}\doxysection{generic\+\_\+ohci.\+c}
\label{generic__ohci_8c_source}\index{dev/usb/controller/generic\_ohci.c@{dev/usb/controller/generic\_ohci.c}}
\mbox{\hyperlink{generic__ohci_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00002}00002 \textcolor{comment}{ * Copyright (c) 2016 Emmanuel Vadot <manu@freebsd.org> All rights reserved.}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00003}00003 \textcolor{comment}{ * Copyright (c) 2006 M. Warner Losh <imp@FreeBSD.org>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00004}00004 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00005}00005 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00006}00006 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00007}00007 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00008}00008 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00009}00009 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00010}00010 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00011}00011 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00012}00012 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00013}00013 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00014}00014 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00015}00015 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00016}00016 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00017}00017 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00018}00018 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00019}00019 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00020}00020 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00021}00021 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00022}00022 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00023}00023 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00024}00024 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00025}00025 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00026}00026 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00027}00027 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00028}00028 \textcolor{comment}{ * Generic OHCI driver based on AT91 OHCI}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00029}00029 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00030}00030 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00031}00031 \textcolor{preprocessor}{\#include <sys/cdefs.h>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00032}\mbox{\hyperlink{generic__ohci_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{00032}} \mbox{\hyperlink{generic__ohci_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{\_\_FBSDID}}(\textcolor{stringliteral}{"{}\$FreeBSD\$"{}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00033}00033 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00034}00034 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00035}00035 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00036}00036 \textcolor{preprocessor}{\#include <sys/bus.h>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00037}00037 \textcolor{preprocessor}{\#include <sys/rman.h>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <sys/condvar.h>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00039}00039 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00040}00040 \textcolor{preprocessor}{\#include <sys/module.h>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00041}00041 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00042}00042 \textcolor{preprocessor}{\#include <machine/bus.h>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00043}00043 \textcolor{preprocessor}{\#include <dev/ofw/ofw\_bus.h>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00044}00044 \textcolor{preprocessor}{\#include <dev/ofw/ofw\_bus\_subr.h>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00045}00045 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00046}00046 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb_8h}{dev/usb/usb.h}}>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00047}00047 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usbdi_8h}{dev/usb/usbdi.h}}>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00048}00048 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00049}00049 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__core_8h}{dev/usb/usb\_core.h}}>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00050}00050 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__busdma_8h}{dev/usb/usb\_busdma.h}}>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00051}00051 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__process_8h}{dev/usb/usb\_process.h}}>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00052}00052 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__util_8h}{dev/usb/usb\_util.h}}>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00053}00053 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00054}00054 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__controller_8h}{dev/usb/usb\_controller.h}}>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00055}00055 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__bus_8h}{dev/usb/usb\_bus.h}}>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00056}00056 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ohci_8h}{dev/usb/controller/ohci.h}}>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00057}00057 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ohcireg_8h}{dev/usb/controller/ohcireg.h}}>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00058}00058 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00059}00059 \textcolor{preprocessor}{\#include <dev/extres/clk/clk.h>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00060}00060 \textcolor{preprocessor}{\#include <dev/extres/hwreset/hwreset.h>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00061}00061 \textcolor{preprocessor}{\#include <dev/extres/phy/phy.h>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00062}00062 \textcolor{preprocessor}{\#include <dev/extres/phy/phy\_usb.h>}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00063}00063 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00064}00064 \textcolor{preprocessor}{\#include "{}generic\_usb\_if.h"{}}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00065}00065 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00066}00066 \textcolor{keyword}{struct }\mbox{\hyperlink{structclk__list}{clk\_list}} \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00067}00067         TAILQ\_ENTRY(\mbox{\hyperlink{structclk__list}{clk\_list}})   \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00068}00068         clk\_t                   clk;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00069}00069 \};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00070}00070 \textcolor{keyword}{struct }\mbox{\hyperlink{structphy__list}{phy\_list}} \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00071}00071         TAILQ\_ENTRY(\mbox{\hyperlink{structphy__list}{phy\_list}})   \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00072}00072         phy\_t                   phy;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00073}00073 \};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00074}00074 \textcolor{keyword}{struct }\mbox{\hyperlink{structhwrst__list}{hwrst\_list}} \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00075}00075         TAILQ\_ENTRY(\mbox{\hyperlink{structhwrst__list}{hwrst\_list}})       \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00076}00076         hwreset\_t               rst;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00077}00077 \};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00078}00078 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00079}\mbox{\hyperlink{structgeneric__ohci__softc}{00079}} \textcolor{keyword}{struct }\mbox{\hyperlink{structgeneric__ohci__softc}{generic\_ohci\_softc}} \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00080}\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{00080}}         \mbox{\hyperlink{structohci__softc}{ohci\_softc\_t}}        \mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00081}00081 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00082}00082         \mbox{\hyperlink{usb__device_8h_a1ab0778486582cd95b8a0bfa9739ae87}{TAILQ\_HEAD}}(, \mbox{\hyperlink{structclk__list}{clk\_list}})                \mbox{\hyperlink{structclk__list}{clk\_list}};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00083}00083         \mbox{\hyperlink{usb__device_8h_a1ab0778486582cd95b8a0bfa9739ae87}{TAILQ\_HEAD}}(, \mbox{\hyperlink{structphy__list}{phy\_list}})                \mbox{\hyperlink{structphy__list}{phy\_list}};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00084}00084         \mbox{\hyperlink{usb__device_8h_a1ab0778486582cd95b8a0bfa9739ae87}{TAILQ\_HEAD}}(, \mbox{\hyperlink{structhwrst__list}{hwrst\_list}})    rst\_list;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00085}00085 \};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00086}00086 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00087}00087 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{generic__ohci_8c_a83562ba1ef741407cadd20de3ecc9571}{generic\_ohci\_detach}}(device\_t);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00088}00088 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00089}00089 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00090}\mbox{\hyperlink{generic__ohci_8c_a9a2a7a25fa05c28b8ea246c2c5b5fafb}{00090}} \mbox{\hyperlink{generic__ohci_8c_a9a2a7a25fa05c28b8ea246c2c5b5fafb}{generic\_ohci\_probe}}(device\_t dev)}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00091}00091 \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00092}00092 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00093}00093         \textcolor{keywordflow}{if} (!ofw\_bus\_status\_okay(dev))}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00094}00094                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00095}00095 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00096}00096         \textcolor{keywordflow}{if} (!ofw\_bus\_is\_compatible(dev, \textcolor{stringliteral}{"{}generic-\/ohci"{}}))}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00097}00097                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00098}00098 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00099}00099         device\_set\_desc(dev, \textcolor{stringliteral}{"{}Generic OHCI Controller"{}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00100}00100 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00101}00101         \textcolor{keywordflow}{return} (BUS\_PROBE\_DEFAULT);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00102}00102 \}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00103}00103 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00104}00104 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00105}\mbox{\hyperlink{generic__ohci_8c_ab1033c131673ad0550807f8a8508bcd0}{00105}} \mbox{\hyperlink{generic__ohci_8c_ab1033c131673ad0550807f8a8508bcd0}{generic\_ohci\_attach}}(device\_t dev)}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00106}00106 \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00107}00107         \textcolor{keyword}{struct }\mbox{\hyperlink{structgeneric__ohci__softc}{generic\_ohci\_softc}} *sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00108}00108         \textcolor{keywordtype}{int} err, rid;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00109}00109         \textcolor{keywordtype}{int} off;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00110}00110         \textcolor{keyword}{struct }\mbox{\hyperlink{structclk__list}{clk\_list}} *clkp;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00111}00111         \textcolor{keyword}{struct }\mbox{\hyperlink{structphy__list}{phy\_list}} *phyp;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00112}00112         \textcolor{keyword}{struct }\mbox{\hyperlink{structhwrst__list}{hwrst\_list}} *rstp;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00113}00113         clk\_t clk;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00114}00114         phy\_t phy;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00115}00115         hwreset\_t rst;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00116}00116 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00117}00117         sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_a67ec2816f2e71f7198ffca089a706ee4}{sc\_bus}}.\mbox{\hyperlink{structusb__bus_a7855a7fc5c4b3f5289323c7743c6a975}{parent}} = dev;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00118}00118         sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_a67ec2816f2e71f7198ffca089a706ee4}{sc\_bus}}.\mbox{\hyperlink{structusb__bus_a9412f3e10804046f19d5e8ab00a38b59}{devices}} = sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_a754414df0573417a970551c1194a2607}{sc\_devices}};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00119}00119         sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_a67ec2816f2e71f7198ffca089a706ee4}{sc\_bus}}.\mbox{\hyperlink{structusb__bus_ac665d059dd509782705e2eb35fdc9c58}{devices\_max}} = \mbox{\hyperlink{ohci_8h_a0a8b5388709ddff77cf7d25c84bcbc6d}{OHCI\_MAX\_DEVICES}};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00120}00120         sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_a67ec2816f2e71f7198ffca089a706ee4}{sc\_bus}}.\mbox{\hyperlink{structusb__bus_af7cf6d04a3d928e28be8825b637fab68}{dma\_bits}} = 32;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00121}00121 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00122}00122         \textcolor{comment}{/* get all DMA memory */}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00123}00123         \textcolor{keywordflow}{if} (\mbox{\hyperlink{usb__controller_8c_a736f5aa67bd8014944a1dc24fbf3fbb5}{usb\_bus\_mem\_alloc\_all}}(\&sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_a67ec2816f2e71f7198ffca089a706ee4}{sc\_bus}},}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00124}00124             \mbox{\hyperlink{usb__busdma_8h_acec0356df4d4a6905c59303652de41ad}{USB\_GET\_DMA\_TAG}}(dev), \&\mbox{\hyperlink{ohci_8h_a49ee4d3775d14eeab9e3e81e80aa90a7}{ohci\_iterate\_hw\_softc}})) \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00125}00125                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00126}00126         \}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00127}00127 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00128}00128         rid = 0;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00129}00129         sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_ac7cc92dc07c129e713bda1c499e64dbe}{sc\_io\_res}} = bus\_alloc\_resource\_any(dev, SYS\_RES\_MEMORY,}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00130}00130             \&rid, RF\_ACTIVE);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00131}00131         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_ac7cc92dc07c129e713bda1c499e64dbe}{sc\_io\_res}} == 0) \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00132}00132                 err = ENOMEM;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00133}00133                 \textcolor{keywordflow}{goto} \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00134}00134         \}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00135}00135 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00136}00136         sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_a33a00d895a22de600f31b2d59a279068}{sc\_io\_tag}} = rman\_get\_bustag(sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_ac7cc92dc07c129e713bda1c499e64dbe}{sc\_io\_res}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00137}00137         sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_ae2be03b620d4308379eb06f5e02a9cd6}{sc\_io\_hdl}} = rman\_get\_bushandle(sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_ac7cc92dc07c129e713bda1c499e64dbe}{sc\_io\_res}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00138}00138         sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_ac0f7c61430f942248973f66ef40cfa6a}{sc\_io\_size}} = rman\_get\_size(sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_ac7cc92dc07c129e713bda1c499e64dbe}{sc\_io\_res}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00139}00139 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00140}00140         rid = 0;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00141}00141         sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_ab5af37410f3b3d4e714b1399c6d5f47b}{sc\_irq\_res}} = bus\_alloc\_resource\_any(dev, SYS\_RES\_IRQ, \&rid,}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00142}00142             RF\_ACTIVE);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00143}00143         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_ab5af37410f3b3d4e714b1399c6d5f47b}{sc\_irq\_res}} == 0) \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00144}00144                 err = ENXIO;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00145}00145                 \textcolor{keywordflow}{goto} \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00146}00146         \}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00147}00147         sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_a67ec2816f2e71f7198ffca089a706ee4}{sc\_bus}}.\mbox{\hyperlink{structusb__bus_a50629655e638e1f775df1ed160d3c533}{bdev}} = device\_add\_child(dev, \textcolor{stringliteral}{"{}usbus"{}}, -\/1);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00148}00148         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_a67ec2816f2e71f7198ffca089a706ee4}{sc\_bus}}.\mbox{\hyperlink{structusb__bus_a50629655e638e1f775df1ed160d3c533}{bdev}} == 0) \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00149}00149                 err = ENXIO;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00150}00150                 \textcolor{keywordflow}{goto} \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00151}00151         \}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00152}00152         device\_set\_ivars(sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_a67ec2816f2e71f7198ffca089a706ee4}{sc\_bus}}.\mbox{\hyperlink{structusb__bus_a50629655e638e1f775df1ed160d3c533}{bdev}}, \&sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_a67ec2816f2e71f7198ffca089a706ee4}{sc\_bus}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00153}00153 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00154}00154         strlcpy(sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_ae0c7ea2895a9e2bc556adec7d8c2af13}{sc\_vendor}}, \textcolor{stringliteral}{"{}Generic"{}},}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00155}00155             \textcolor{keyword}{sizeof}(sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_ae0c7ea2895a9e2bc556adec7d8c2af13}{sc\_vendor}}));}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00156}00156 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00157}00157         err = bus\_setup\_intr(dev, sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_ab5af37410f3b3d4e714b1399c6d5f47b}{sc\_irq\_res}},}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00158}00158             INTR\_TYPE\_BIO | INTR\_MPSAFE, NULL,}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00159}00159             (driver\_intr\_t *)\mbox{\hyperlink{ohci_8c_a3191a1ba1d568e50c49b2942a74d4a8f}{ohci\_interrupt}}, sc, \&sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_aff50a32edebe58a34787f9d8aaeb4e89}{sc\_intr\_hdl}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00160}00160         \textcolor{keywordflow}{if} (err) \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00161}00161                 sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_aff50a32edebe58a34787f9d8aaeb4e89}{sc\_intr\_hdl}} = NULL;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00162}00162                 \textcolor{keywordflow}{goto} \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00163}00163         \}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00164}00164 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00165}00165         TAILQ\_INIT(\&sc-\/>clk\_list);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00166}00166         \textcolor{comment}{/* Enable clock */}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00167}00167         \textcolor{keywordflow}{for} (off = 0; clk\_get\_by\_ofw\_index(dev, 0, off, \&clk) == 0; off++) \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00168}00168                 err = clk\_enable(clk);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00169}00169                 \textcolor{keywordflow}{if} (err != 0) \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00170}00170                         device\_printf(dev, \textcolor{stringliteral}{"{}Could not enable clock \%s\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00171}00171                             clk\_get\_name(clk));}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00172}00172                         \textcolor{keywordflow}{goto} \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00173}00173                 \}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00174}00174                 clkp = malloc(\textcolor{keyword}{sizeof}(*clkp), M\_DEVBUF, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00175}00175                 clkp-\/>clk = clk;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00176}00176                 TAILQ\_INSERT\_TAIL(\&sc-\/>clk\_list, clkp, \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00177}00177         \}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00178}00178 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00179}00179         \textcolor{comment}{/* De-\/assert reset */}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00180}00180         TAILQ\_INIT(\&sc-\/>rst\_list);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00181}00181         \textcolor{keywordflow}{for} (off = 0; hwreset\_get\_by\_ofw\_idx(dev, 0, off, \&rst) == 0; off++) \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00182}00182                 err = hwreset\_deassert(rst);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00183}00183                 \textcolor{keywordflow}{if} (err != 0) \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00184}00184                         device\_printf(dev, \textcolor{stringliteral}{"{}Could not de-\/assert reset\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00185}00185                         \textcolor{keywordflow}{goto} \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00186}00186                 \}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00187}00187                 rstp = malloc(\textcolor{keyword}{sizeof}(*rstp), M\_DEVBUF, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00188}00188                 rstp-\/>rst = rst;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00189}00189                 TAILQ\_INSERT\_TAIL(\&sc-\/>rst\_list, rstp, \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00190}00190         \}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00191}00191 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00192}00192         \textcolor{comment}{/* Enable phy */}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00193}00193         TAILQ\_INIT(\&sc-\/>phy\_list);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00194}00194         \textcolor{keywordflow}{for} (off = 0; phy\_get\_by\_ofw\_idx(dev, 0, off, \&phy) == 0; off++) \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00195}00195                 err = phy\_usb\_set\_mode(phy, PHY\_USB\_MODE\_HOST);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00196}00196                 \textcolor{keywordflow}{if} (err != 0) \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00197}00197                         device\_printf(dev, \textcolor{stringliteral}{"{}Could not set phy to host mode\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00198}00198                         \textcolor{keywordflow}{goto} \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00199}00199                 \}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00200}00200                 err = phy\_enable(phy);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00201}00201                 \textcolor{keywordflow}{if} (err != 0) \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00202}00202                         device\_printf(dev, \textcolor{stringliteral}{"{}Could not enable phy\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00203}00203                         \textcolor{keywordflow}{goto} \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00204}00204                 \}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00205}00205                 phyp = malloc(\textcolor{keyword}{sizeof}(*phyp), M\_DEVBUF, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00206}00206                 phyp-\/>phy = phy;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00207}00207                 TAILQ\_INSERT\_TAIL(\&sc-\/>phy\_list, phyp, \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00208}00208         \}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00209}00209 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00210}00210         \textcolor{keywordflow}{if} (GENERIC\_USB\_INIT(dev) != 0) \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00211}00211                 err = ENXIO;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00212}00212                 \textcolor{keywordflow}{goto} \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00213}00213         \}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00214}00214 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00215}00215         err = \mbox{\hyperlink{ohci_8c_a93b8badc0d7ab137739c89471848b2db}{ohci\_init}}(\&sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00216}00216         \textcolor{keywordflow}{if} (err == 0)}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00217}00217                 err = device\_probe\_and\_attach(sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_a67ec2816f2e71f7198ffca089a706ee4}{sc\_bus}}.\mbox{\hyperlink{structusb__bus_a50629655e638e1f775df1ed160d3c533}{bdev}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00218}00218         \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00219}00219                 \textcolor{keywordflow}{goto} \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00220}00220 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00221}00221         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00222}00222 \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}}:}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00223}00223         \mbox{\hyperlink{generic__ohci_8c_a83562ba1ef741407cadd20de3ecc9571}{generic\_ohci\_detach}}(dev);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00224}00224         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00225}00225 \}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00226}00226 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00227}00227 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00228}\mbox{\hyperlink{generic__ohci_8c_a83562ba1ef741407cadd20de3ecc9571}{00228}} \mbox{\hyperlink{generic__ohci_8c_a83562ba1ef741407cadd20de3ecc9571}{generic\_ohci\_detach}}(device\_t dev)}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00229}00229 \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00230}00230         \textcolor{keyword}{struct }\mbox{\hyperlink{structgeneric__ohci__softc}{generic\_ohci\_softc}} *sc = device\_get\_softc(dev);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00231}00231         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00232}00232         \textcolor{keyword}{struct }\mbox{\hyperlink{structclk__list}{clk\_list}} *clk, *clk\_tmp;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00233}00233         \textcolor{keyword}{struct }\mbox{\hyperlink{structphy__list}{phy\_list}} *phy, *phy\_tmp;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00234}00234         \textcolor{keyword}{struct }\mbox{\hyperlink{structhwrst__list}{hwrst\_list}} *rst, *rst\_tmp;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00235}00235 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00236}00236         \textcolor{comment}{/* during module unload there are lots of children leftover */}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00237}00237         device\_delete\_children(dev);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00238}00238 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00239}00239         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00240}00240 \textcolor{comment}{         * Put the controller into reset, then disable clocks and do}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00241}00241 \textcolor{comment}{         * the MI tear down.  We have to disable the clocks/hardware}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00242}00242 \textcolor{comment}{         * after we do the rest of the teardown.  We also disable the}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00243}00243 \textcolor{comment}{         * clocks in the opposite order we acquire them, but that}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00244}00244 \textcolor{comment}{         * doesn't seem to be absolutely necessary.  We free up the}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00245}00245 \textcolor{comment}{         * clocks after we disable them, so the system could, in}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00246}00246 \textcolor{comment}{         * theory, reuse them.}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00247}00247 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00248}00248         bus\_space\_write\_4(sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_a33a00d895a22de600f31b2d59a279068}{sc\_io\_tag}}, sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_ae2be03b620d4308379eb06f5e02a9cd6}{sc\_io\_hdl}},}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00249}00249             \mbox{\hyperlink{ohcireg_8h_acad81621a618420e42d30b5db0a090e7}{OHCI\_CONTROL}}, 0);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00250}00250 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00251}00251         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_ab5af37410f3b3d4e714b1399c6d5f47b}{sc\_irq\_res}} \&\& sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_aff50a32edebe58a34787f9d8aaeb4e89}{sc\_intr\_hdl}}) \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00252}00252                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00253}00253 \textcolor{comment}{                 * only call ohci\_detach() after ohci\_init()}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00254}00254 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00255}00255                 \mbox{\hyperlink{ohci_8c_a4549f67f576c3e40510ba3fbbcab93f6}{ohci\_detach}}(\&sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00256}00256 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00257}00257                 err = bus\_teardown\_intr(dev, sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_ab5af37410f3b3d4e714b1399c6d5f47b}{sc\_irq\_res}},}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00258}00258                     sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_aff50a32edebe58a34787f9d8aaeb4e89}{sc\_intr\_hdl}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00259}00259                 sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_aff50a32edebe58a34787f9d8aaeb4e89}{sc\_intr\_hdl}} = NULL;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00260}00260         \}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00261}00261         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_ab5af37410f3b3d4e714b1399c6d5f47b}{sc\_irq\_res}}) \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00262}00262                 bus\_release\_resource(dev, SYS\_RES\_IRQ, 0,}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00263}00263                     sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_ab5af37410f3b3d4e714b1399c6d5f47b}{sc\_irq\_res}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00264}00264                 sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_ab5af37410f3b3d4e714b1399c6d5f47b}{sc\_irq\_res}} = NULL;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00265}00265         \}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00266}00266         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_ac7cc92dc07c129e713bda1c499e64dbe}{sc\_io\_res}}) \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00267}00267                 bus\_release\_resource(dev, SYS\_RES\_MEMORY, 0,}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00268}00268                     sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_ac7cc92dc07c129e713bda1c499e64dbe}{sc\_io\_res}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00269}00269                 sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_ac7cc92dc07c129e713bda1c499e64dbe}{sc\_io\_res}} = NULL;}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00270}00270         \}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00271}00271         \mbox{\hyperlink{usb__controller_8c_a0a85a587a062a4af3f1df6fc298a02b2}{usb\_bus\_mem\_free\_all}}(\&sc-\/>\mbox{\hyperlink{structgeneric__ohci__softc_aae6e4a6a7b045270d259bcfb5b722af2}{ohci\_sc}}.\mbox{\hyperlink{structohci__softc_a67ec2816f2e71f7198ffca089a706ee4}{sc\_bus}}, \&\mbox{\hyperlink{ohci_8h_a49ee4d3775d14eeab9e3e81e80aa90a7}{ohci\_iterate\_hw\_softc}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00272}00272 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00273}00273         \textcolor{comment}{/* Disable phy */}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00274}00274         TAILQ\_FOREACH\_SAFE(phy, \&sc-\/>phy\_list, \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}}, phy\_tmp) \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00275}00275                 err = phy\_disable(phy-\/>phy);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00276}00276                 \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00277}00277                         device\_printf(dev, \textcolor{stringliteral}{"{}Could not disable phy\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00278}00278                 phy\_release(phy-\/>phy);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00279}00279                 TAILQ\_REMOVE(\&sc-\/>phy\_list, phy, \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00280}00280                 free(phy, M\_DEVBUF);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00281}00281         \}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00282}00282 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00283}00283         \textcolor{comment}{/* Assert reset */}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00284}00284         TAILQ\_FOREACH\_SAFE(rst, \&sc-\/>rst\_list, \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}}, rst\_tmp) \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00285}00285                 hwreset\_assert(rst-\/>rst);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00286}00286                 hwreset\_release(rst-\/>rst);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00287}00287                 TAILQ\_REMOVE(\&sc-\/>rst\_list, rst, \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00288}00288                 free(rst, M\_DEVBUF);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00289}00289         \}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00290}00290 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00291}00291         \textcolor{comment}{/* Disable clock */}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00292}00292         TAILQ\_FOREACH\_SAFE(clk, \&sc-\/>clk\_list, \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}}, clk\_tmp) \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00293}00293                 err = clk\_disable(clk-\/>clk);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00294}00294                 \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00295}00295                         device\_printf(dev, \textcolor{stringliteral}{"{}Could not disable clock \%s\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00296}00296                             clk\_get\_name(clk-\/>clk));}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00297}00297                 err = clk\_release(clk-\/>clk);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00298}00298                 \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00299}00299                         device\_printf(dev, \textcolor{stringliteral}{"{}Could not release clock \%s\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00300}00300                             clk\_get\_name(clk-\/>clk));}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00301}00301                 TAILQ\_REMOVE(\&sc-\/>clk\_list, clk, \mbox{\hyperlink{ehci_8h_a37d1073c5e1d321bdce7cddeaf65a02f}{next}});}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00302}00302                 free(clk, M\_DEVBUF);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00303}00303         \}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00304}00304 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00305}00305         \textcolor{keywordflow}{if} (GENERIC\_USB\_DEINIT(dev) != 0)}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00306}00306                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00307}00307 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00308}00308         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00309}00309 \}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00310}00310 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00311}\mbox{\hyperlink{generic__ohci_8c_a0763497ee361365c5b658cdf38df8620}{00311}} \textcolor{keyword}{static} device\_method\_t \mbox{\hyperlink{generic__ohci_8c_a0763497ee361365c5b658cdf38df8620}{generic\_ohci\_methods}}[] = \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00312}00312         \textcolor{comment}{/* Device interface */}}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00313}00313         DEVMETHOD(device\_probe, \mbox{\hyperlink{generic__ohci_8c_a9a2a7a25fa05c28b8ea246c2c5b5fafb}{generic\_ohci\_probe}}),}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00314}00314         DEVMETHOD(device\_attach, \mbox{\hyperlink{generic__ohci_8c_ab1033c131673ad0550807f8a8508bcd0}{generic\_ohci\_attach}}),}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00315}00315         DEVMETHOD(device\_detach, \mbox{\hyperlink{generic__ohci_8c_a83562ba1ef741407cadd20de3ecc9571}{generic\_ohci\_detach}}),}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00316}00316 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00317}00317         DEVMETHOD(device\_suspend, bus\_generic\_suspend),}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00318}00318         DEVMETHOD(device\_resume, bus\_generic\_resume),}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00319}00319         DEVMETHOD(device\_shutdown, bus\_generic\_shutdown),}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00320}00320 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00321}00321         DEVMETHOD\_END}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00322}00322 \};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00323}00323 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00324}\mbox{\hyperlink{generic__ohci_8c_a64ecde3560f52a4eb2e717b0c403a453}{00324}} driver\_t \mbox{\hyperlink{generic__ohci_8c_a64ecde3560f52a4eb2e717b0c403a453}{generic\_ohci\_driver}} = \{}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00325}00325         .name = \textcolor{stringliteral}{"{}ohci"{}},}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00326}00326         .methods = \mbox{\hyperlink{generic__ohci_8c_a0763497ee361365c5b658cdf38df8620}{generic\_ohci\_methods}},}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00327}00327         .size = \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct }\mbox{\hyperlink{structgeneric__ohci__softc}{generic\_ohci\_softc}}),}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00328}00328 \};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00329}00329 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00330}\mbox{\hyperlink{generic__ohci_8c_a4394a26b59b085148b7942870f458020}{00330}} \textcolor{keyword}{static} devclass\_t \mbox{\hyperlink{generic__ohci_8c_a4394a26b59b085148b7942870f458020}{generic\_ohci\_devclass}};}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00331}00331 }
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00332}\mbox{\hyperlink{generic__ohci_8c_a8cf5f00f3eb664f8d234e3172d36c12f}{00332}} \mbox{\hyperlink{generic__ohci_8c_a8cf5f00f3eb664f8d234e3172d36c12f}{DRIVER\_MODULE}}(ohci, simplebus, \mbox{\hyperlink{generic__ohci_8c_a64ecde3560f52a4eb2e717b0c403a453}{generic\_ohci\_driver}},}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00333}00333     \mbox{\hyperlink{generic__ohci_8c_a4394a26b59b085148b7942870f458020}{generic\_ohci\_devclass}}, 0, 0);}
\DoxyCodeLine{\Hypertarget{generic__ohci_8c_source_l00334}\mbox{\hyperlink{generic__ohci_8c_a40cbf082d04c685c2803922969178279}{00334}} \mbox{\hyperlink{generic__ohci_8c_a40cbf082d04c685c2803922969178279}{MODULE\_DEPEND}}(ohci, \mbox{\hyperlink{usb__if_8m_adfa3f6da9c4881e494b180c4ebb06470}{usb}}, 1, 1, 1);}

\end{DoxyCode}
