Lines Matching refs:ehci

38 static inline void ehci_qtd_init(struct ehci_hcd *ehci, struct ehci_qtd *qtd,  in ehci_qtd_init()  argument
43 qtd->hw_token = cpu_to_hc32(ehci, QTD_STS_HALT); in ehci_qtd_init()
44 qtd->hw_next = EHCI_LIST_END(ehci); in ehci_qtd_init()
45 qtd->hw_alt_next = EHCI_LIST_END(ehci); in ehci_qtd_init()
49 static struct ehci_qtd *ehci_qtd_alloc (struct ehci_hcd *ehci, gfp_t flags) in ehci_qtd_alloc() argument
54 qtd = dma_pool_alloc (ehci->qtd_pool, flags, &dma); in ehci_qtd_alloc()
56 ehci_qtd_init(ehci, qtd, dma); in ehci_qtd_alloc()
61 static inline void ehci_qtd_free (struct ehci_hcd *ehci, struct ehci_qtd *qtd) in ehci_qtd_free() argument
63 dma_pool_free (ehci->qtd_pool, qtd, qtd->qtd_dma); in ehci_qtd_free()
69 struct ehci_hcd *ehci = qh->ehci; in qh_destroy() local
73 ehci_dbg (ehci, "unused qh not empty!\n"); in qh_destroy()
77 ehci_qtd_free (ehci, qh->dummy); in qh_destroy()
78 dma_pool_free(ehci->qh_pool, qh->hw, qh->qh_dma); in qh_destroy()
82 static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags) in ehci_qh_alloc() argument
91 dma_pool_alloc(ehci->qh_pool, flags, &dma); in ehci_qh_alloc()
96 qh->ehci = ehci; in ehci_qh_alloc()
102 qh->dummy = ehci_qtd_alloc (ehci, flags); in ehci_qh_alloc()
104 ehci_dbg (ehci, "no dummy td\n"); in ehci_qh_alloc()
110 dma_pool_free(ehci->qh_pool, qh->hw, qh->qh_dma); in ehci_qh_alloc()
137 static void ehci_mem_cleanup (struct ehci_hcd *ehci) in ehci_mem_cleanup() argument
139 free_cached_lists(ehci); in ehci_mem_cleanup()
140 if (ehci->async) in ehci_mem_cleanup()
141 qh_put (ehci->async); in ehci_mem_cleanup()
142 ehci->async = NULL; in ehci_mem_cleanup()
144 if (ehci->dummy) in ehci_mem_cleanup()
145 qh_put(ehci->dummy); in ehci_mem_cleanup()
146 ehci->dummy = NULL; in ehci_mem_cleanup()
149 if (ehci->qtd_pool) in ehci_mem_cleanup()
150 dma_pool_destroy (ehci->qtd_pool); in ehci_mem_cleanup()
151 ehci->qtd_pool = NULL; in ehci_mem_cleanup()
153 if (ehci->qh_pool) { in ehci_mem_cleanup()
154 dma_pool_destroy (ehci->qh_pool); in ehci_mem_cleanup()
155 ehci->qh_pool = NULL; in ehci_mem_cleanup()
158 if (ehci->itd_pool) in ehci_mem_cleanup()
159 dma_pool_destroy (ehci->itd_pool); in ehci_mem_cleanup()
160 ehci->itd_pool = NULL; in ehci_mem_cleanup()
162 if (ehci->sitd_pool) in ehci_mem_cleanup()
163 dma_pool_destroy (ehci->sitd_pool); in ehci_mem_cleanup()
164 ehci->sitd_pool = NULL; in ehci_mem_cleanup()
166 if (ehci->periodic) in ehci_mem_cleanup()
167 dma_free_coherent (ehci_to_hcd(ehci)->self.controller, in ehci_mem_cleanup()
168 ehci->periodic_size * sizeof (u32), in ehci_mem_cleanup()
169 ehci->periodic, ehci->periodic_dma); in ehci_mem_cleanup()
170 ehci->periodic = NULL; in ehci_mem_cleanup()
173 kfree(ehci->pshadow); in ehci_mem_cleanup()
174 ehci->pshadow = NULL; in ehci_mem_cleanup()
178 static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t flags) in ehci_mem_init() argument
183 ehci->qtd_pool = dma_pool_create ("ehci_qtd", in ehci_mem_init()
184 ehci_to_hcd(ehci)->self.controller, in ehci_mem_init()
188 if (!ehci->qtd_pool) { in ehci_mem_init()
193 ehci->qh_pool = dma_pool_create ("ehci_qh", in ehci_mem_init()
194 ehci_to_hcd(ehci)->self.controller, in ehci_mem_init()
198 if (!ehci->qh_pool) { in ehci_mem_init()
201 ehci->async = ehci_qh_alloc (ehci, flags); in ehci_mem_init()
202 if (!ehci->async) { in ehci_mem_init()
207 ehci->itd_pool = dma_pool_create ("ehci_itd", in ehci_mem_init()
208 ehci_to_hcd(ehci)->self.controller, in ehci_mem_init()
212 if (!ehci->itd_pool) { in ehci_mem_init()
217 ehci->sitd_pool = dma_pool_create ("ehci_sitd", in ehci_mem_init()
218 ehci_to_hcd(ehci)->self.controller, in ehci_mem_init()
222 if (!ehci->sitd_pool) { in ehci_mem_init()
227 ehci->periodic = (__le32 *) in ehci_mem_init()
228 dma_alloc_coherent (ehci_to_hcd(ehci)->self.controller, in ehci_mem_init()
229 ehci->periodic_size * sizeof(__le32), in ehci_mem_init()
230 &ehci->periodic_dma, 0); in ehci_mem_init()
231 if (ehci->periodic == NULL) { in ehci_mem_init()
235 if (ehci->use_dummy_qh) { in ehci_mem_init()
237 ehci->dummy = ehci_qh_alloc(ehci, flags); in ehci_mem_init()
238 if (!ehci->dummy) in ehci_mem_init()
241 hw = ehci->dummy->hw; in ehci_mem_init()
242 hw->hw_next = EHCI_LIST_END(ehci); in ehci_mem_init()
243 hw->hw_qtd_next = EHCI_LIST_END(ehci); in ehci_mem_init()
244 hw->hw_alt_next = EHCI_LIST_END(ehci); in ehci_mem_init()
246 ehci->dummy->hw = hw; in ehci_mem_init()
248 for (i = 0; i < ehci->periodic_size; i++) in ehci_mem_init()
249 ehci->periodic[i] = ehci->dummy->qh_dma; in ehci_mem_init()
251 for (i = 0; i < ehci->periodic_size; i++) in ehci_mem_init()
252 ehci->periodic[i] = EHCI_LIST_END(ehci); in ehci_mem_init()
256 ehci->pshadow = kcalloc(ehci->periodic_size, sizeof(void *), flags); in ehci_mem_init()
257 if (ehci->pshadow != NULL) in ehci_mem_init()
261 ehci_dbg (ehci, "couldn't init memory\n"); in ehci_mem_init()
262 ehci_mem_cleanup (ehci); in ehci_mem_init()