Lines Matching refs:lch
67 static void omap_clear_dma(int lch);
91 static inline void disable_lnk(int lch);
92 static void omap_disable_channel_irq(int lch);
93 static inline void omap_enable_channel_irq(int lch);
124 void omap_set_dma_priority(int lch, int dst_port, int priority) in omap_set_dma_priority() argument
156 void omap_set_dma_priority(int lch, int dst_port, int priority) in omap_set_dma_priority() argument
160 ccr = p->dma_read(CCR, lch); in omap_set_dma_priority()
165 p->dma_write(ccr, CCR, lch); in omap_set_dma_priority()
170 void omap_set_dma_transfer_params(int lch, int data_type, int elem_count, in omap_set_dma_transfer_params() argument
176 l = p->dma_read(CSDP, lch); in omap_set_dma_transfer_params()
179 p->dma_write(l, CSDP, lch); in omap_set_dma_transfer_params()
184 ccr = p->dma_read(CCR, lch); in omap_set_dma_transfer_params()
188 p->dma_write(ccr, CCR, lch); in omap_set_dma_transfer_params()
190 ccr = p->dma_read(CCR2, lch); in omap_set_dma_transfer_params()
194 p->dma_write(ccr, CCR2, lch); in omap_set_dma_transfer_params()
200 val = p->dma_read(CCR, lch); in omap_set_dma_transfer_params()
225 p->dma_write(val, CCR, lch); in omap_set_dma_transfer_params()
228 p->dma_write(elem_count, CEN, lch); in omap_set_dma_transfer_params()
229 p->dma_write(frame_count, CFN, lch); in omap_set_dma_transfer_params()
233 void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode) in omap_set_dma_channel_mode() argument
238 l = p->dma_read(LCH_CTRL, lch); in omap_set_dma_channel_mode()
241 p->dma_write(l, LCH_CTRL, lch); in omap_set_dma_channel_mode()
247 void omap_set_dma_src_params(int lch, int src_port, int src_amode, in omap_set_dma_src_params() argument
256 w = p->dma_read(CSDP, lch); in omap_set_dma_src_params()
259 p->dma_write(w, CSDP, lch); in omap_set_dma_src_params()
262 l = p->dma_read(CCR, lch); in omap_set_dma_src_params()
265 p->dma_write(l, CCR, lch); in omap_set_dma_src_params()
267 p->dma_write(src_start, CSSA, lch); in omap_set_dma_src_params()
269 p->dma_write(src_ei, CSEI, lch); in omap_set_dma_src_params()
270 p->dma_write(src_fi, CSFI, lch); in omap_set_dma_src_params()
274 void omap_set_dma_src_data_pack(int lch, int enable) in omap_set_dma_src_data_pack() argument
278 l = p->dma_read(CSDP, lch); in omap_set_dma_src_data_pack()
282 p->dma_write(l, CSDP, lch); in omap_set_dma_src_data_pack()
286 void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode) in omap_set_dma_src_burst_mode() argument
291 l = p->dma_read(CSDP, lch); in omap_set_dma_src_burst_mode()
325 p->dma_write(l, CSDP, lch); in omap_set_dma_src_burst_mode()
330 void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode, in omap_set_dma_dest_params() argument
337 l = p->dma_read(CSDP, lch); in omap_set_dma_dest_params()
340 p->dma_write(l, CSDP, lch); in omap_set_dma_dest_params()
343 l = p->dma_read(CCR, lch); in omap_set_dma_dest_params()
346 p->dma_write(l, CCR, lch); in omap_set_dma_dest_params()
348 p->dma_write(dest_start, CDSA, lch); in omap_set_dma_dest_params()
350 p->dma_write(dst_ei, CDEI, lch); in omap_set_dma_dest_params()
351 p->dma_write(dst_fi, CDFI, lch); in omap_set_dma_dest_params()
355 void omap_set_dma_dest_data_pack(int lch, int enable) in omap_set_dma_dest_data_pack() argument
359 l = p->dma_read(CSDP, lch); in omap_set_dma_dest_data_pack()
363 p->dma_write(l, CSDP, lch); in omap_set_dma_dest_data_pack()
367 void omap_set_dma_dest_burst_mode(int lch, enum omap_dma_burst_mode burst_mode) in omap_set_dma_dest_burst_mode() argument
372 l = p->dma_read(CSDP, lch); in omap_set_dma_dest_burst_mode()
403 p->dma_write(l, CSDP, lch); in omap_set_dma_dest_burst_mode()
407 static inline void omap_enable_channel_irq(int lch) in omap_enable_channel_irq() argument
411 p->dma_read(CSR, lch); in omap_enable_channel_irq()
413 p->dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR, lch); in omap_enable_channel_irq()
416 p->dma_write(dma_chan[lch].enabled_irqs, CICR, lch); in omap_enable_channel_irq()
419 static inline void omap_disable_channel_irq(int lch) in omap_disable_channel_irq() argument
422 p->dma_write(0, CICR, lch); in omap_disable_channel_irq()
425 p->dma_read(CSR, lch); in omap_disable_channel_irq()
427 p->dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR, lch); in omap_disable_channel_irq()
430 void omap_disable_dma_irq(int lch, u16 bits) in omap_disable_dma_irq() argument
432 dma_chan[lch].enabled_irqs &= ~bits; in omap_disable_dma_irq()
436 static inline void enable_lnk(int lch) in enable_lnk() argument
440 l = p->dma_read(CLNK_CTRL, lch); in enable_lnk()
446 if (dma_chan[lch].next_lch != -1) in enable_lnk()
447 l = dma_chan[lch].next_lch | (1 << 15); in enable_lnk()
449 p->dma_write(l, CLNK_CTRL, lch); in enable_lnk()
452 static inline void disable_lnk(int lch) in disable_lnk() argument
456 l = p->dma_read(CLNK_CTRL, lch); in disable_lnk()
459 omap_disable_channel_irq(lch); in disable_lnk()
471 p->dma_write(l, CLNK_CTRL, lch); in disable_lnk()
472 dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE; in disable_lnk()
476 void (*callback)(int lch, u16 ch_status, void *data), in omap_request_dma() argument
536 void omap_free_dma(int lch) in omap_free_dma() argument
540 if (dma_chan[lch].dev_id == -1) { in omap_free_dma()
542 lch); in omap_free_dma()
547 omap_disable_channel_irq(lch); in omap_free_dma()
550 p->dma_write(0, CCR, lch); in omap_free_dma()
553 dma_chan[lch].dev_id = -1; in omap_free_dma()
554 dma_chan[lch].next_lch = -1; in omap_free_dma()
555 dma_chan[lch].callback = NULL; in omap_free_dma()
564 static void omap_clear_dma(int lch) in omap_clear_dma() argument
569 p->clear_dma(lch); in omap_clear_dma()
573 void omap_start_dma(int lch) in omap_start_dma() argument
582 p->dma_write(0, CPC, lch); in omap_start_dma()
584 p->dma_write(0, CDAC, lch); in omap_start_dma()
586 if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) { in omap_start_dma()
591 enable_lnk(lch); in omap_start_dma()
594 dma_chan_link_map[lch] = 1; in omap_start_dma()
596 cur_lch = dma_chan[lch].next_lch; in omap_start_dma()
612 p->dma_write(lch, CLNK_CTRL, lch); in omap_start_dma()
614 omap_enable_channel_irq(lch); in omap_start_dma()
616 l = p->dma_read(CCR, lch); in omap_start_dma()
629 p->dma_write(l, CCR, lch); in omap_start_dma()
631 dma_chan[lch].flags |= OMAP_DMA_ACTIVE; in omap_start_dma()
635 void omap_stop_dma(int lch) in omap_stop_dma() argument
640 omap_disable_channel_irq(lch); in omap_stop_dma()
642 l = p->dma_read(CCR, lch); in omap_stop_dma()
649 l = p->dma_read(OCP_SYSCONFIG, lch); in omap_stop_dma()
655 l = p->dma_read(CCR, lch); in omap_stop_dma()
657 p->dma_write(l, CCR, lch); in omap_stop_dma()
660 l = p->dma_read(CCR, lch); in omap_stop_dma()
665 l = p->dma_read(CCR, lch); in omap_stop_dma()
668 pr_err("DMA drain did not complete on lch %d\n", lch); in omap_stop_dma()
670 p->dma_write(sys_cf, OCP_SYSCONFIG, lch); in omap_stop_dma()
673 p->dma_write(l, CCR, lch); in omap_stop_dma()
683 if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) { in omap_stop_dma()
684 int next_lch, cur_lch = lch; in omap_stop_dma()
702 dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE; in omap_stop_dma()
718 dma_addr_t omap_get_dma_src_pos(int lch) in omap_get_dma_src_pos() argument
723 offset = p->dma_read(CPC, lch); in omap_get_dma_src_pos()
725 offset = p->dma_read(CSAC, lch); in omap_get_dma_src_pos()
728 offset = p->dma_read(CSAC, lch); in omap_get_dma_src_pos()
736 if (likely(p->dma_read(CDAC, lch))) in omap_get_dma_src_pos()
737 offset = p->dma_read(CSAC, lch); in omap_get_dma_src_pos()
739 offset = p->dma_read(CSSA, lch); in omap_get_dma_src_pos()
743 offset |= (p->dma_read(CSSA, lch) & 0xFFFF0000); in omap_get_dma_src_pos()
757 dma_addr_t omap_get_dma_dst_pos(int lch) in omap_get_dma_dst_pos() argument
762 offset = p->dma_read(CPC, lch); in omap_get_dma_dst_pos()
764 offset = p->dma_read(CDAC, lch); in omap_get_dma_dst_pos()
771 offset = p->dma_read(CDAC, lch); in omap_get_dma_dst_pos()
778 offset = p->dma_read(CDSA, lch); in omap_get_dma_dst_pos()
782 offset |= (p->dma_read(CDSA, lch) & 0xFFFF0000); in omap_get_dma_dst_pos()
788 int omap_get_dma_active_status(int lch) in omap_get_dma_active_status() argument
790 return (p->dma_read(CCR, lch) & OMAP_DMA_CCR_EN) != 0; in omap_get_dma_active_status()
796 int lch; in omap_dma_running() local
802 for (lch = 0; lch < dma_chan_count; lch++) in omap_dma_running()
803 if (p->dma_read(CCR, lch) & OMAP_DMA_CCR_EN) in omap_dma_running()