Lines Matching refs:chan

27 static unsigned long dma_find_base(unsigned int chan)  in dma_find_base()  argument
32 if (chan >= 6) in dma_find_base()
39 static unsigned long dma_base_addr(unsigned int chan) in dma_base_addr() argument
41 unsigned long base = dma_find_base(chan); in dma_base_addr()
44 if (chan >= 9) in dma_base_addr()
45 chan -= 6; in dma_base_addr()
46 if (chan >= 4) in dma_base_addr()
49 return base + (chan * 0x10); in dma_base_addr()
53 static inline unsigned int get_dmte_irq(unsigned int chan) in get_dmte_irq() argument
55 return chan >= 6 ? DMTE6_IRQ : DMTE0_IRQ; in get_dmte_irq()
75 static inline unsigned int get_dmte_irq(unsigned int chan) in get_dmte_irq() argument
77 return dmte_irq_map[chan]; in get_dmte_irq()
91 static inline unsigned int calc_xmit_shift(struct dma_channel *chan) in calc_xmit_shift() argument
93 u32 chcr = __raw_readl(dma_base_addr(chan->chan) + CHCR); in calc_xmit_shift()
108 struct dma_channel *chan = dev_id; in dma_tei() local
111 chcr = __raw_readl(dma_base_addr(chan->chan) + CHCR); in dma_tei()
117 __raw_writel(chcr, (dma_base_addr(chan->chan) + CHCR)); in dma_tei()
119 wake_up(&chan->wait_queue); in dma_tei()
124 static int sh_dmac_request_dma(struct dma_channel *chan) in sh_dmac_request_dma() argument
126 if (unlikely(!(chan->flags & DMA_TEI_CAPABLE))) in sh_dmac_request_dma()
129 return request_irq(get_dmte_irq(chan->chan), dma_tei, IRQF_SHARED, in sh_dmac_request_dma()
130 chan->dev_id, chan); in sh_dmac_request_dma()
133 static void sh_dmac_free_dma(struct dma_channel *chan) in sh_dmac_free_dma() argument
135 free_irq(get_dmte_irq(chan->chan), chan); in sh_dmac_free_dma()
139 sh_dmac_configure_channel(struct dma_channel *chan, unsigned long chcr) in sh_dmac_configure_channel() argument
146 chan->flags |= DMA_TEI_CAPABLE; in sh_dmac_configure_channel()
148 chan->flags &= ~DMA_TEI_CAPABLE; in sh_dmac_configure_channel()
151 __raw_writel(chcr, (dma_base_addr(chan->chan) + CHCR)); in sh_dmac_configure_channel()
153 chan->flags |= DMA_CONFIGURED; in sh_dmac_configure_channel()
157 static void sh_dmac_enable_dma(struct dma_channel *chan) in sh_dmac_enable_dma() argument
162 chcr = __raw_readl(dma_base_addr(chan->chan) + CHCR); in sh_dmac_enable_dma()
165 if (chan->flags & DMA_TEI_CAPABLE) in sh_dmac_enable_dma()
168 __raw_writel(chcr, (dma_base_addr(chan->chan) + CHCR)); in sh_dmac_enable_dma()
170 if (chan->flags & DMA_TEI_CAPABLE) { in sh_dmac_enable_dma()
171 irq = get_dmte_irq(chan->chan); in sh_dmac_enable_dma()
176 static void sh_dmac_disable_dma(struct dma_channel *chan) in sh_dmac_disable_dma() argument
181 if (chan->flags & DMA_TEI_CAPABLE) { in sh_dmac_disable_dma()
182 irq = get_dmte_irq(chan->chan); in sh_dmac_disable_dma()
186 chcr = __raw_readl(dma_base_addr(chan->chan) + CHCR); in sh_dmac_disable_dma()
188 __raw_writel(chcr, (dma_base_addr(chan->chan) + CHCR)); in sh_dmac_disable_dma()
191 static int sh_dmac_xfer_dma(struct dma_channel *chan) in sh_dmac_xfer_dma() argument
197 if (unlikely(!(chan->flags & DMA_CONFIGURED))) in sh_dmac_xfer_dma()
198 sh_dmac_configure_channel(chan, 0); in sh_dmac_xfer_dma()
200 sh_dmac_disable_dma(chan); in sh_dmac_xfer_dma()
217 if (chan->sar || (mach_is_dreamcast() && in sh_dmac_xfer_dma()
218 chan->chan == PVR2_CASCADE_CHAN)) in sh_dmac_xfer_dma()
219 __raw_writel(chan->sar, (dma_base_addr(chan->chan) + SAR)); in sh_dmac_xfer_dma()
220 if (chan->dar || (mach_is_dreamcast() && in sh_dmac_xfer_dma()
221 chan->chan == PVR2_CASCADE_CHAN)) in sh_dmac_xfer_dma()
222 __raw_writel(chan->dar, (dma_base_addr(chan->chan) + DAR)); in sh_dmac_xfer_dma()
224 __raw_writel(chan->count >> calc_xmit_shift(chan), in sh_dmac_xfer_dma()
225 (dma_base_addr(chan->chan) + TCR)); in sh_dmac_xfer_dma()
227 sh_dmac_enable_dma(chan); in sh_dmac_xfer_dma()
232 static int sh_dmac_get_dma_residue(struct dma_channel *chan) in sh_dmac_get_dma_residue() argument
234 if (!(__raw_readl(dma_base_addr(chan->chan) + CHCR) & CHCR_DE)) in sh_dmac_get_dma_residue()
237 return __raw_readl(dma_base_addr(chan->chan) + TCR) in sh_dmac_get_dma_residue()
238 << calc_xmit_shift(chan); in sh_dmac_get_dma_residue()