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()
67 static void qh_destroy(struct ehci_hcd *ehci, struct ehci_qh *qh) in qh_destroy() argument
71 ehci_dbg (ehci, "unused qh not empty!\n"); in qh_destroy()
75 ehci_qtd_free (ehci, qh->dummy); in qh_destroy()
76 dma_pool_free(ehci->qh_pool, qh->hw, qh->qh_dma); in qh_destroy()
80 static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags) in ehci_qh_alloc() argument
89 dma_pool_alloc(ehci->qh_pool, flags, &dma); in ehci_qh_alloc()
99 qh->dummy = ehci_qtd_alloc (ehci, flags); in ehci_qh_alloc()
101 ehci_dbg (ehci, "no dummy td\n"); in ehci_qh_alloc()
107 dma_pool_free(ehci->qh_pool, qh->hw, qh->qh_dma); in ehci_qh_alloc()
120 static void ehci_mem_cleanup (struct ehci_hcd *ehci) in ehci_mem_cleanup() argument
122 if (ehci->async) in ehci_mem_cleanup()
123 qh_destroy(ehci, ehci->async); in ehci_mem_cleanup()
124 ehci->async = NULL; in ehci_mem_cleanup()
126 if (ehci->dummy) in ehci_mem_cleanup()
127 qh_destroy(ehci, ehci->dummy); in ehci_mem_cleanup()
128 ehci->dummy = NULL; in ehci_mem_cleanup()
131 if (ehci->qtd_pool) in ehci_mem_cleanup()
132 dma_pool_destroy (ehci->qtd_pool); in ehci_mem_cleanup()
133 ehci->qtd_pool = NULL; in ehci_mem_cleanup()
135 if (ehci->qh_pool) { in ehci_mem_cleanup()
136 dma_pool_destroy (ehci->qh_pool); in ehci_mem_cleanup()
137 ehci->qh_pool = NULL; in ehci_mem_cleanup()
140 if (ehci->itd_pool) in ehci_mem_cleanup()
141 dma_pool_destroy (ehci->itd_pool); in ehci_mem_cleanup()
142 ehci->itd_pool = NULL; in ehci_mem_cleanup()
144 if (ehci->sitd_pool) in ehci_mem_cleanup()
145 dma_pool_destroy (ehci->sitd_pool); in ehci_mem_cleanup()
146 ehci->sitd_pool = NULL; in ehci_mem_cleanup()
148 if (ehci->periodic) in ehci_mem_cleanup()
149 dma_free_coherent (ehci_to_hcd(ehci)->self.controller, in ehci_mem_cleanup()
150 ehci->periodic_size * sizeof (u32), in ehci_mem_cleanup()
151 ehci->periodic, ehci->periodic_dma); in ehci_mem_cleanup()
152 ehci->periodic = NULL; in ehci_mem_cleanup()
155 kfree(ehci->pshadow); in ehci_mem_cleanup()
156 ehci->pshadow = NULL; in ehci_mem_cleanup()
160 static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t flags) in ehci_mem_init() argument
165 ehci->qtd_pool = dma_pool_create ("ehci_qtd", in ehci_mem_init()
166 ehci_to_hcd(ehci)->self.controller, in ehci_mem_init()
170 if (!ehci->qtd_pool) { in ehci_mem_init()
175 ehci->qh_pool = dma_pool_create ("ehci_qh", in ehci_mem_init()
176 ehci_to_hcd(ehci)->self.controller, in ehci_mem_init()
180 if (!ehci->qh_pool) { in ehci_mem_init()
183 ehci->async = ehci_qh_alloc (ehci, flags); in ehci_mem_init()
184 if (!ehci->async) { in ehci_mem_init()
189 ehci->itd_pool = dma_pool_create ("ehci_itd", in ehci_mem_init()
190 ehci_to_hcd(ehci)->self.controller, in ehci_mem_init()
194 if (!ehci->itd_pool) { in ehci_mem_init()
199 ehci->sitd_pool = dma_pool_create ("ehci_sitd", in ehci_mem_init()
200 ehci_to_hcd(ehci)->self.controller, in ehci_mem_init()
204 if (!ehci->sitd_pool) { in ehci_mem_init()
209 ehci->periodic = (__le32 *) in ehci_mem_init()
210 dma_alloc_coherent (ehci_to_hcd(ehci)->self.controller, in ehci_mem_init()
211 ehci->periodic_size * sizeof(__le32), in ehci_mem_init()
212 &ehci->periodic_dma, flags); in ehci_mem_init()
213 if (ehci->periodic == NULL) { in ehci_mem_init()
217 if (ehci->use_dummy_qh) { in ehci_mem_init()
219 ehci->dummy = ehci_qh_alloc(ehci, flags); in ehci_mem_init()
220 if (!ehci->dummy) in ehci_mem_init()
223 hw = ehci->dummy->hw; in ehci_mem_init()
224 hw->hw_next = EHCI_LIST_END(ehci); in ehci_mem_init()
225 hw->hw_qtd_next = EHCI_LIST_END(ehci); in ehci_mem_init()
226 hw->hw_alt_next = EHCI_LIST_END(ehci); in ehci_mem_init()
227 ehci->dummy->hw = hw; in ehci_mem_init()
229 for (i = 0; i < ehci->periodic_size; i++) in ehci_mem_init()
230 ehci->periodic[i] = cpu_to_hc32(ehci, in ehci_mem_init()
231 ehci->dummy->qh_dma); in ehci_mem_init()
233 for (i = 0; i < ehci->periodic_size; i++) in ehci_mem_init()
234 ehci->periodic[i] = EHCI_LIST_END(ehci); in ehci_mem_init()
238 ehci->pshadow = kcalloc(ehci->periodic_size, sizeof(void *), flags); in ehci_mem_init()
239 if (ehci->pshadow != NULL) in ehci_mem_init()
243 ehci_dbg (ehci, "couldn't init memory\n"); in ehci_mem_init()
244 ehci_mem_cleanup (ehci); in ehci_mem_init()