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