Lines Matching refs:ehci

25 static inline void ehci_qtd_init(struct ehci_hcd *ehci, struct ehci_qtd *qtd,  in ehci_qtd_init()  argument
30 qtd->hw_token = cpu_to_hc32(ehci, QTD_STS_HALT); in ehci_qtd_init()
31 qtd->hw_next = EHCI_LIST_END(ehci); in ehci_qtd_init()
32 qtd->hw_alt_next = EHCI_LIST_END(ehci); in ehci_qtd_init()
36 static struct ehci_qtd *ehci_qtd_alloc (struct ehci_hcd *ehci, gfp_t flags) in ehci_qtd_alloc() argument
41 qtd = dma_pool_alloc (ehci->qtd_pool, flags, &dma); in ehci_qtd_alloc()
43 ehci_qtd_init(ehci, qtd, dma); in ehci_qtd_alloc()
48 static inline void ehci_qtd_free (struct ehci_hcd *ehci, struct ehci_qtd *qtd) in ehci_qtd_free() argument
50 dma_pool_free (ehci->qtd_pool, qtd, qtd->qtd_dma); in ehci_qtd_free()
54 static void qh_destroy(struct ehci_hcd *ehci, struct ehci_qh *qh) in qh_destroy() argument
58 ehci_dbg (ehci, "unused qh not empty!\n"); in qh_destroy()
62 ehci_qtd_free (ehci, qh->dummy); in qh_destroy()
63 dma_pool_free(ehci->qh_pool, qh->hw, qh->qh_dma); in qh_destroy()
67 static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags) in ehci_qh_alloc() argument
76 dma_pool_zalloc(ehci->qh_pool, flags, &dma); in ehci_qh_alloc()
85 qh->dummy = ehci_qtd_alloc (ehci, flags); in ehci_qh_alloc()
87 ehci_dbg (ehci, "no dummy td\n"); in ehci_qh_alloc()
93 dma_pool_free(ehci->qh_pool, qh->hw, qh->qh_dma); in ehci_qh_alloc()
106 static void ehci_mem_cleanup (struct ehci_hcd *ehci) in ehci_mem_cleanup() argument
108 if (ehci->async) in ehci_mem_cleanup()
109 qh_destroy(ehci, ehci->async); in ehci_mem_cleanup()
110 ehci->async = NULL; in ehci_mem_cleanup()
112 if (ehci->dummy) in ehci_mem_cleanup()
113 qh_destroy(ehci, ehci->dummy); in ehci_mem_cleanup()
114 ehci->dummy = NULL; in ehci_mem_cleanup()
117 dma_pool_destroy(ehci->qtd_pool); in ehci_mem_cleanup()
118 ehci->qtd_pool = NULL; in ehci_mem_cleanup()
119 dma_pool_destroy(ehci->qh_pool); in ehci_mem_cleanup()
120 ehci->qh_pool = NULL; in ehci_mem_cleanup()
121 dma_pool_destroy(ehci->itd_pool); in ehci_mem_cleanup()
122 ehci->itd_pool = NULL; in ehci_mem_cleanup()
123 dma_pool_destroy(ehci->sitd_pool); in ehci_mem_cleanup()
124 ehci->sitd_pool = NULL; in ehci_mem_cleanup()
126 if (ehci->periodic) in ehci_mem_cleanup()
127 dma_free_coherent(ehci_to_hcd(ehci)->self.sysdev, in ehci_mem_cleanup()
128 ehci->periodic_size * sizeof (u32), in ehci_mem_cleanup()
129 ehci->periodic, ehci->periodic_dma); in ehci_mem_cleanup()
130 ehci->periodic = NULL; in ehci_mem_cleanup()
133 kfree(ehci->pshadow); in ehci_mem_cleanup()
134 ehci->pshadow = NULL; in ehci_mem_cleanup()
138 static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t flags) in ehci_mem_init() argument
143 ehci->qtd_pool = dma_pool_create ("ehci_qtd", in ehci_mem_init()
144 ehci_to_hcd(ehci)->self.sysdev, in ehci_mem_init()
148 if (!ehci->qtd_pool) { in ehci_mem_init()
153 ehci->qh_pool = dma_pool_create ("ehci_qh", in ehci_mem_init()
154 ehci_to_hcd(ehci)->self.sysdev, in ehci_mem_init()
158 if (!ehci->qh_pool) { in ehci_mem_init()
161 ehci->async = ehci_qh_alloc (ehci, flags); in ehci_mem_init()
162 if (!ehci->async) { in ehci_mem_init()
167 ehci->itd_pool = dma_pool_create ("ehci_itd", in ehci_mem_init()
168 ehci_to_hcd(ehci)->self.sysdev, in ehci_mem_init()
172 if (!ehci->itd_pool) { in ehci_mem_init()
177 ehci->sitd_pool = dma_pool_create ("ehci_sitd", in ehci_mem_init()
178 ehci_to_hcd(ehci)->self.sysdev, in ehci_mem_init()
182 if (!ehci->sitd_pool) { in ehci_mem_init()
187 ehci->periodic = (__le32 *) in ehci_mem_init()
188 dma_alloc_coherent(ehci_to_hcd(ehci)->self.sysdev, in ehci_mem_init()
189 ehci->periodic_size * sizeof(__le32), in ehci_mem_init()
190 &ehci->periodic_dma, flags); in ehci_mem_init()
191 if (ehci->periodic == NULL) { in ehci_mem_init()
195 if (ehci->use_dummy_qh) { in ehci_mem_init()
197 ehci->dummy = ehci_qh_alloc(ehci, flags); in ehci_mem_init()
198 if (!ehci->dummy) in ehci_mem_init()
201 hw = ehci->dummy->hw; in ehci_mem_init()
202 hw->hw_next = EHCI_LIST_END(ehci); in ehci_mem_init()
203 hw->hw_qtd_next = EHCI_LIST_END(ehci); in ehci_mem_init()
204 hw->hw_alt_next = EHCI_LIST_END(ehci); in ehci_mem_init()
205 ehci->dummy->hw = hw; in ehci_mem_init()
207 for (i = 0; i < ehci->periodic_size; i++) in ehci_mem_init()
208 ehci->periodic[i] = cpu_to_hc32(ehci, in ehci_mem_init()
209 ehci->dummy->qh_dma); in ehci_mem_init()
211 for (i = 0; i < ehci->periodic_size; i++) in ehci_mem_init()
212 ehci->periodic[i] = EHCI_LIST_END(ehci); in ehci_mem_init()
216 ehci->pshadow = kcalloc(ehci->periodic_size, sizeof(void *), flags); in ehci_mem_init()
217 if (ehci->pshadow != NULL) in ehci_mem_init()
221 ehci_dbg (ehci, "couldn't init memory\n"); in ehci_mem_init()
222 ehci_mem_cleanup (ehci); in ehci_mem_init()