.. | .. |
---|
49 | 49 | * generic hardware linkage |
---|
50 | 50 | */ |
---|
51 | 51 | .irq = ohci_irq, |
---|
52 | | - .flags = HCD_USB11 | HCD_MEMORY | HCD_LOCAL_MEM, |
---|
| 52 | + .flags = HCD_USB11 | HCD_MEMORY, |
---|
53 | 53 | |
---|
54 | 54 | /* |
---|
55 | 55 | * basic lifecycle operations |
---|
.. | .. |
---|
110 | 110 | goto err0; |
---|
111 | 111 | } |
---|
112 | 112 | |
---|
113 | | - /* The sm501 chip is equipped with local memory that may be used |
---|
114 | | - * by on-chip devices such as the video controller and the usb host. |
---|
115 | | - * This driver uses dma_declare_coherent_memory() to make sure |
---|
116 | | - * usb allocations with dma_alloc_coherent() allocate from |
---|
117 | | - * this local memory. The dma_handle returned by dma_alloc_coherent() |
---|
118 | | - * will be an offset starting from 0 for the first local memory byte. |
---|
119 | | - * |
---|
120 | | - * So as long as data is allocated using dma_alloc_coherent() all is |
---|
121 | | - * fine. This is however not always the case - buffers may be allocated |
---|
122 | | - * using kmalloc() - so the usb core needs to be told that it must copy |
---|
123 | | - * data into our local memory if the buffers happen to be placed in |
---|
124 | | - * regular memory. The HCD_LOCAL_MEM flag does just that. |
---|
125 | | - */ |
---|
126 | | - |
---|
127 | | - retval = dma_declare_coherent_memory(dev, mem->start, |
---|
128 | | - mem->start - mem->parent->start, |
---|
129 | | - resource_size(mem), |
---|
130 | | - DMA_MEMORY_EXCLUSIVE); |
---|
131 | | - if (retval) { |
---|
132 | | - dev_err(dev, "cannot declare coherent memory\n"); |
---|
133 | | - goto err1; |
---|
134 | | - } |
---|
135 | | - |
---|
136 | 113 | /* allocate, reserve and remap resources for registers */ |
---|
137 | 114 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
---|
138 | 115 | if (res == NULL) { |
---|
139 | 116 | dev_err(dev, "no resource definition for registers\n"); |
---|
140 | 117 | retval = -ENOENT; |
---|
141 | | - goto err2; |
---|
| 118 | + goto err1; |
---|
142 | 119 | } |
---|
143 | 120 | |
---|
144 | 121 | hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); |
---|
145 | 122 | if (!hcd) { |
---|
146 | 123 | retval = -ENOMEM; |
---|
147 | | - goto err2; |
---|
| 124 | + goto err1; |
---|
148 | 125 | } |
---|
149 | 126 | |
---|
150 | 127 | hcd->rsrc_start = res->start; |
---|
.. | .. |
---|
165 | 142 | |
---|
166 | 143 | ohci_hcd_init(hcd_to_ohci(hcd)); |
---|
167 | 144 | |
---|
| 145 | + /* The sm501 chip is equipped with local memory that may be used |
---|
| 146 | + * by on-chip devices such as the video controller and the usb host. |
---|
| 147 | + * This driver uses genalloc so that usb allocations with |
---|
| 148 | + * gen_pool_dma_alloc() allocate from this local memory. The dma_handle |
---|
| 149 | + * returned by gen_pool_dma_alloc() will be an offset starting from 0 |
---|
| 150 | + * for the first local memory byte. |
---|
| 151 | + * |
---|
| 152 | + * So as long as data is allocated using gen_pool_dma_alloc() all is |
---|
| 153 | + * fine. This is however not always the case - buffers may be allocated |
---|
| 154 | + * using kmalloc() - so the usb core needs to be told that it must copy |
---|
| 155 | + * data into our local memory if the buffers happen to be placed in |
---|
| 156 | + * regular memory. A non-null hcd->localmem_pool initialized by the |
---|
| 157 | + * the call to usb_hcd_setup_local_mem() below does just that. |
---|
| 158 | + */ |
---|
| 159 | + |
---|
| 160 | + retval = usb_hcd_setup_local_mem(hcd, mem->start, |
---|
| 161 | + mem->start - mem->parent->start, |
---|
| 162 | + resource_size(mem)); |
---|
| 163 | + if (retval < 0) |
---|
| 164 | + goto err5; |
---|
168 | 165 | retval = usb_add_hcd(hcd, irq, IRQF_SHARED); |
---|
169 | 166 | if (retval) |
---|
170 | 167 | goto err5; |
---|
.. | .. |
---|
182 | 179 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); |
---|
183 | 180 | err3: |
---|
184 | 181 | usb_put_hcd(hcd); |
---|
185 | | -err2: |
---|
186 | | - dma_release_declared_memory(dev); |
---|
187 | 182 | err1: |
---|
188 | 183 | release_mem_region(mem->start, resource_size(mem)); |
---|
189 | 184 | err0: |
---|
.. | .. |
---|
199 | 194 | iounmap(hcd->regs); |
---|
200 | 195 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); |
---|
201 | 196 | usb_put_hcd(hcd); |
---|
202 | | - dma_release_declared_memory(&pdev->dev); |
---|
203 | 197 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
---|
204 | 198 | if (mem) |
---|
205 | 199 | release_mem_region(mem->start, resource_size(mem)); |
---|