Lines Matching +full:single +full:- +full:shot

1 // SPDX-License-Identifier: GPL-2.0+
6 /* this file is part of ehci-hcd.c */
8 /*-------------------------------------------------------------------------*/
12 * - data used only by the HCD ... kmalloc is fine
13 * - async and periodic schedules, shared by HC and HCD ... these
15 * - driver buffers, read/written by HC ... single shot DMA mapped
21 /*-------------------------------------------------------------------------*/
29 qtd->qtd_dma = dma; in ehci_qtd_init()
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()
33 INIT_LIST_HEAD (&qtd->qtd_list); in ehci_qtd_init()
41 qtd = dma_pool_alloc (ehci->qtd_pool, flags, &dma); in ehci_qtd_alloc()
50 dma_pool_free (ehci->qtd_pool, qtd, qtd->qtd_dma); in ehci_qtd_free()
57 if (!list_empty (&qh->qtd_list) || qh->qh_next.ptr) { in qh_destroy()
61 if (qh->dummy) 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()
75 qh->hw = (struct ehci_qh_hw *) in ehci_qh_alloc()
76 dma_pool_zalloc(ehci->qh_pool, flags, &dma); in ehci_qh_alloc()
77 if (!qh->hw) in ehci_qh_alloc()
79 qh->qh_dma = dma; in ehci_qh_alloc()
80 // INIT_LIST_HEAD (&qh->qh_list); in ehci_qh_alloc()
81 INIT_LIST_HEAD (&qh->qtd_list); in ehci_qh_alloc()
82 INIT_LIST_HEAD(&qh->unlink_node); in ehci_qh_alloc()
85 qh->dummy = ehci_qtd_alloc (ehci, flags); in ehci_qh_alloc()
86 if (qh->dummy == NULL) { in ehci_qh_alloc()
93 dma_pool_free(ehci->qh_pool, qh->hw, qh->qh_dma); in ehci_qh_alloc()
99 /*-------------------------------------------------------------------------*/
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()
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()
223 return -ENOMEM; in ehci_mem_init()