Lines Matching refs:ehci
6 /* this file is part of ehci-hcd.c */
25 static inline void ehci_qtd_init(struct ehci_hcd *ehci, struct ehci_qtd *qtd,
30 qtd->hw_token = cpu_to_hc32(ehci, QTD_STS_HALT);
31 qtd->hw_next = EHCI_LIST_END(ehci);
32 qtd->hw_alt_next = EHCI_LIST_END(ehci);
36 static struct ehci_qtd *ehci_qtd_alloc (struct ehci_hcd *ehci, gfp_t flags)
41 qtd = dma_pool_alloc (ehci->qtd_pool, flags, &dma);
43 ehci_qtd_init(ehci, qtd, dma);
48 static inline void ehci_qtd_free (struct ehci_hcd *ehci, struct ehci_qtd *qtd)
50 dma_pool_free (ehci->qtd_pool, qtd, qtd->qtd_dma);
54 static void qh_destroy(struct ehci_hcd *ehci, struct ehci_qh *qh)
58 ehci_dbg (ehci, "unused qh not empty!\n");
62 ehci_qtd_free (ehci, qh->dummy);
63 dma_pool_free(ehci->qh_pool, qh->hw, qh->qh_dma);
67 static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags)
76 dma_pool_alloc(ehci->qh_pool, flags, &dma);
86 qh->dummy = ehci_qtd_alloc (ehci, flags);
88 ehci_dbg (ehci, "no dummy td\n");
94 dma_pool_free(ehci->qh_pool, qh->hw, qh->qh_dma);
107 static void ehci_mem_cleanup (struct ehci_hcd *ehci)
109 if (ehci->async)
110 qh_destroy(ehci, ehci->async);
111 ehci->async = NULL;
113 if (ehci->dummy)
114 qh_destroy(ehci, ehci->dummy);
115 ehci->dummy = NULL;
118 dma_pool_destroy(ehci->qtd_pool);
119 ehci->qtd_pool = NULL;
120 dma_pool_destroy(ehci->qh_pool);
121 ehci->qh_pool = NULL;
122 dma_pool_destroy(ehci->itd_pool);
123 ehci->itd_pool = NULL;
124 dma_pool_destroy(ehci->sitd_pool);
125 ehci->sitd_pool = NULL;
127 if (ehci->periodic)
128 dma_free_coherent(ehci_to_hcd(ehci)->self.sysdev,
129 ehci->periodic_size * sizeof (u32),
130 ehci->periodic, ehci->periodic_dma);
131 ehci->periodic = NULL;
134 kfree(ehci->pshadow);
135 ehci->pshadow = NULL;
139 static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t flags)
144 ehci->qtd_pool = dma_pool_create ("ehci_qtd",
145 ehci_to_hcd(ehci)->self.sysdev,
149 if (!ehci->qtd_pool) {
154 ehci->qh_pool = dma_pool_create ("ehci_qh",
155 ehci_to_hcd(ehci)->self.sysdev,
159 if (!ehci->qh_pool) {
162 ehci->async = ehci_qh_alloc (ehci, flags);
163 if (!ehci->async) {
168 ehci->itd_pool = dma_pool_create ("ehci_itd",
169 ehci_to_hcd(ehci)->self.sysdev,
173 if (!ehci->itd_pool) {
178 ehci->sitd_pool = dma_pool_create ("ehci_sitd",
179 ehci_to_hcd(ehci)->self.sysdev,
183 if (!ehci->sitd_pool) {
188 ehci->periodic = (__le32 *)
189 dma_alloc_coherent(ehci_to_hcd(ehci)->self.sysdev,
190 ehci->periodic_size * sizeof(__le32),
191 &ehci->periodic_dma, flags);
192 if (ehci->periodic == NULL) {
196 if (ehci->use_dummy_qh) {
198 ehci->dummy = ehci_qh_alloc(ehci, flags);
199 if (!ehci->dummy)
202 hw = ehci->dummy->hw;
203 hw->hw_next = EHCI_LIST_END(ehci);
204 hw->hw_qtd_next = EHCI_LIST_END(ehci);
205 hw->hw_alt_next = EHCI_LIST_END(ehci);
206 ehci->dummy->hw = hw;
208 for (i = 0; i < ehci->periodic_size; i++)
209 ehci->periodic[i] = cpu_to_hc32(ehci,
210 ehci->dummy->qh_dma);
212 for (i = 0; i < ehci->periodic_size; i++)
213 ehci->periodic[i] = EHCI_LIST_END(ehci);
217 ehci->pshadow = kcalloc(ehci->periodic_size, sizeof(void *), flags);
218 if (ehci->pshadow != NULL)
222 ehci_dbg (ehci, "couldn't init memory\n");
223 ehci_mem_cleanup (ehci);