Lines Matching full:dma

3  * Thunderbolt DMA configuration based mailbox support
48 * struct tb_dma_port - DMA control port
49 * @sw: Switch the DMA port belongs to
50 * @port: Switch port number where DMA capability is found
174 * The DMA (NHI) port is either 3, 5 or 7 depending on the in dma_find_port()
191 * dma_port_alloc() - Finds DMA control port from a switch pointed by route
192 * @sw: Switch from where find the DMA port
194 * Function checks if the switch NHI port supports DMA configuration
196 * DMA port structure. Returns %NULL if the capabity was not found.
198 * The DMA control port is functional also when the switch is in safe
203 struct tb_dma_port *dma; in dma_port_alloc() local
210 dma = kzalloc(sizeof(*dma), GFP_KERNEL); in dma_port_alloc()
211 if (!dma) in dma_port_alloc()
214 dma->buf = kmalloc_array(MAIL_DATA_DWORDS, sizeof(u32), GFP_KERNEL); in dma_port_alloc()
215 if (!dma->buf) { in dma_port_alloc()
216 kfree(dma); in dma_port_alloc()
220 dma->sw = sw; in dma_port_alloc()
221 dma->port = port; in dma_port_alloc()
222 dma->base = DMA_PORT_CAP; in dma_port_alloc()
224 return dma; in dma_port_alloc()
228 * dma_port_free() - Release DMA control port structure
229 * @dma: DMA control port
231 void dma_port_free(struct tb_dma_port *dma) in dma_port_free() argument
233 if (dma) { in dma_port_free()
234 kfree(dma->buf); in dma_port_free()
235 kfree(dma); in dma_port_free()
239 static int dma_port_wait_for_completion(struct tb_dma_port *dma, in dma_port_wait_for_completion() argument
243 struct tb_switch *sw = dma->sw; in dma_port_wait_for_completion()
249 ret = dma_port_read(sw->tb->ctl, &in, tb_route(sw), dma->port, in dma_port_wait_for_completion()
250 dma->base + MAIL_IN, 1, 50); in dma_port_wait_for_completion()
278 static int dma_port_request(struct tb_dma_port *dma, u32 in, in dma_port_request() argument
281 struct tb_switch *sw = dma->sw; in dma_port_request()
285 ret = dma_port_write(sw->tb->ctl, &in, tb_route(sw), dma->port, in dma_port_request()
286 dma->base + MAIL_IN, 1, DMA_PORT_TIMEOUT); in dma_port_request()
290 ret = dma_port_wait_for_completion(dma, timeout); in dma_port_request()
294 ret = dma_port_read(sw->tb->ctl, &out, tb_route(sw), dma->port, in dma_port_request()
295 dma->base + MAIL_OUT, 1, DMA_PORT_TIMEOUT); in dma_port_request()
305 struct tb_dma_port *dma = data; in dma_port_flash_read_block() local
306 struct tb_switch *sw = dma->sw; in dma_port_flash_read_block()
316 ret = dma_port_request(dma, in, DMA_PORT_TIMEOUT); in dma_port_flash_read_block()
320 return dma_port_read(sw->tb->ctl, buf, tb_route(sw), dma->port, in dma_port_flash_read_block()
321 dma->base + MAIL_DATA, dwords, DMA_PORT_TIMEOUT); in dma_port_flash_read_block()
327 struct tb_dma_port *dma = data; in dma_port_flash_write_block() local
328 struct tb_switch *sw = dma->sw; in dma_port_flash_write_block()
333 ret = dma_port_write(sw->tb->ctl, buf, tb_route(sw), dma->port, in dma_port_flash_write_block()
334 dma->base + MAIL_DATA, dwords, DMA_PORT_TIMEOUT); in dma_port_flash_write_block()
348 return dma_port_request(dma, in, DMA_PORT_TIMEOUT); in dma_port_flash_write_block()
353 * @dma: DMA control port
358 int dma_port_flash_read(struct tb_dma_port *dma, unsigned int address, in dma_port_flash_read() argument
362 dma_port_flash_read_block, dma); in dma_port_flash_read()
367 * @dma: DMA control port
376 int dma_port_flash_write(struct tb_dma_port *dma, unsigned int address, in dma_port_flash_write() argument
383 dma_port_flash_write_block, dma); in dma_port_flash_write()
388 * @dma: DMA control port
397 int dma_port_flash_update_auth(struct tb_dma_port *dma) in dma_port_flash_update_auth() argument
404 return dma_port_request(dma, in, 150); in dma_port_flash_update_auth()
409 * @dma: DMA control port
420 int dma_port_flash_update_auth_status(struct tb_dma_port *dma, u32 *status) in dma_port_flash_update_auth_status() argument
422 struct tb_switch *sw = dma->sw; in dma_port_flash_update_auth_status()
426 ret = dma_port_read(sw->tb->ctl, &out, tb_route(sw), dma->port, in dma_port_flash_update_auth_status()
427 dma->base + MAIL_OUT, 1, DMA_PORT_TIMEOUT); in dma_port_flash_update_auth_status()
446 * @dma: DMA control port
450 int dma_port_power_cycle(struct tb_dma_port *dma) in dma_port_power_cycle() argument
457 return dma_port_request(dma, in, 150); in dma_port_power_cycle()