Lines Matching +full:omap +full:- +full:sdma

1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/arch/arm/plat-omap/dma.c
5 * Copyright (C) 2003 - 2008 Nokia Corporation
10 * OMAP2/3 support Copyright (C) 2004-2007 Texas Instruments, Inc.
12 * Some functions based on earlier dma-omap.c Copyright (C) 2001 RidgeRun, Inc.
15 * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
17 * Support functions for the OMAP internal DMA channels.
19 * Copyright (C) 2010 Texas Instruments Incorporated - https://www.ti.com/
21 * - G, Manjunath Kondaiah <manjugk@ti.com>
35 #include <linux/omap-dma.h>
37 #include <linux/soc/ti/omap1-io.h>
38 #include <linux/soc/ti/omap1-soc.h>
44 * channels that an instance of the SDMA IP block can support. Used
46 * than this -- for example, OMAP1 SDMA instances only support 17 logical
72 p->dma_write(0, CICR, lch); in omap_disable_channel_irq()
74 p->dma_read(CSR, lch); in omap_disable_channel_irq()
79 u32 reg = OMAP_FUNC_MUX_ARM_BASE + ((req - 1) / 5) * 4; in set_gdma_dev()
80 int shift = ((req - 1) % 5) * 6; in set_gdma_dev()
85 l |= (dev - 1) << shift; in set_gdma_dev()
124 /* Returns 1 if the DMA module is in OMAP1510-compatible mode, 0 otherwise */
140 l = p->dma_read(CSDP, lch); in omap_set_dma_transfer_params()
143 p->dma_write(l, CSDP, lch); in omap_set_dma_transfer_params()
145 ccr = p->dma_read(CCR, lch); in omap_set_dma_transfer_params()
149 p->dma_write(ccr, CCR, lch); in omap_set_dma_transfer_params()
151 ccr = p->dma_read(CCR2, lch); in omap_set_dma_transfer_params()
155 p->dma_write(ccr, CCR2, lch); in omap_set_dma_transfer_params()
156 p->dma_write(elem_count, CEN, lch); in omap_set_dma_transfer_params()
157 p->dma_write(frame_count, CFN, lch); in omap_set_dma_transfer_params()
166 l = p->dma_read(LCH_CTRL, lch); in omap_set_dma_channel_mode()
169 p->dma_write(l, LCH_CTRL, lch); in omap_set_dma_channel_mode()
182 w = p->dma_read(CSDP, lch); in omap_set_dma_src_params()
185 p->dma_write(w, CSDP, lch); in omap_set_dma_src_params()
187 l = p->dma_read(CCR, lch); in omap_set_dma_src_params()
190 p->dma_write(l, CCR, lch); in omap_set_dma_src_params()
192 p->dma_write(src_start, CSSA, lch); in omap_set_dma_src_params()
194 p->dma_write(src_ei, CSEI, lch); in omap_set_dma_src_params()
195 p->dma_write(src_fi, CSFI, lch); in omap_set_dma_src_params()
203 l = p->dma_read(CSDP, lch); in omap_set_dma_src_data_pack()
207 p->dma_write(l, CSDP, lch); in omap_set_dma_src_data_pack()
216 l = p->dma_read(CSDP, lch); in omap_set_dma_src_burst_mode()
239 p->dma_write(l, CSDP, lch); in omap_set_dma_src_burst_mode()
250 l = p->dma_read(CSDP, lch); in omap_set_dma_dest_params()
253 p->dma_write(l, CSDP, lch); in omap_set_dma_dest_params()
255 l = p->dma_read(CCR, lch); in omap_set_dma_dest_params()
258 p->dma_write(l, CCR, lch); in omap_set_dma_dest_params()
260 p->dma_write(dest_start, CDSA, lch); in omap_set_dma_dest_params()
262 p->dma_write(dst_ei, CDEI, lch); in omap_set_dma_dest_params()
263 p->dma_write(dst_fi, CDFI, lch); in omap_set_dma_dest_params()
271 l = p->dma_read(CSDP, lch); in omap_set_dma_dest_data_pack()
275 p->dma_write(l, CSDP, lch); in omap_set_dma_dest_data_pack()
284 l = p->dma_read(CSDP, lch); in omap_set_dma_dest_burst_mode()
305 p->dma_write(l, CSDP, lch); in omap_set_dma_dest_burst_mode()
312 p->dma_read(CSR, lch); in omap_enable_channel_irq()
315 p->dma_write(dma_chan[lch].enabled_irqs, CICR, lch); in omap_enable_channel_irq()
328 l = p->dma_read(CLNK_CTRL, lch); in enable_lnk()
333 if (dma_chan[lch].next_lch != -1) in enable_lnk()
336 p->dma_write(l, CLNK_CTRL, lch); in enable_lnk()
343 l = p->dma_read(CLNK_CTRL, lch); in disable_lnk()
351 p->dma_write(l, CLNK_CTRL, lch); in disable_lnk()
360 int ch, free_ch = -1; in omap_request_dma()
364 …WARN(strcmp(dev_name, "DMA engine"), "Using deprecated platform DMA API - please update to DMA eng… in omap_request_dma()
368 if (free_ch == -1 && dma_chan[ch].dev_id == -1) { in omap_request_dma()
374 if (free_ch == -1) { in omap_request_dma()
376 return -EBUSY; in omap_request_dma()
379 chan->dev_id = dev_id; in omap_request_dma()
381 if (p->clear_lch_regs) in omap_request_dma()
382 p->clear_lch_regs(free_ch); in omap_request_dma()
386 chan->dev_name = dev_name; in omap_request_dma()
387 chan->callback = callback; in omap_request_dma()
388 chan->data = data; in omap_request_dma()
389 chan->flags = 0; in omap_request_dma()
391 chan->enabled_irqs = OMAP_DMA_DROP_IRQ | OMAP_DMA_BLOCK_IRQ; in omap_request_dma()
393 chan->enabled_irqs |= OMAP1_DMA_TOUT_IRQ; in omap_request_dma()
405 p->dma_write(dev_id | (1 << 10), CCR, free_ch); in omap_request_dma()
407 p->dma_write(dev_id, CCR, free_ch); in omap_request_dma()
420 if (dma_chan[lch].dev_id == -1) { in omap_free_dma()
430 p->dma_write(0, CCR, lch); in omap_free_dma()
433 dma_chan[lch].dev_id = -1; in omap_free_dma()
434 dma_chan[lch].next_lch = -1; in omap_free_dma()
449 p->clear_dma(lch); in omap_clear_dma()
463 p->dma_write(0, CPC, lch); in omap_start_dma()
465 p->dma_write(0, CDAC, lch); in omap_start_dma()
467 if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) { in omap_start_dma()
491 } while (next_lch != -1); in omap_start_dma()
493 p->dma_write(lch, CLNK_CTRL, lch); in omap_start_dma()
497 l = p->dma_read(CCR, lch); in omap_start_dma()
510 p->dma_write(l, CCR, lch); in omap_start_dma()
523 l = p->dma_read(CCR, lch); in omap_stop_dma()
529 /* Configure No-Standby */ in omap_stop_dma()
530 l = p->dma_read(OCP_SYSCONFIG, lch); in omap_stop_dma()
534 p->dma_write(l , OCP_SYSCONFIG, 0); in omap_stop_dma()
536 l = p->dma_read(CCR, lch); in omap_stop_dma()
538 p->dma_write(l, CCR, lch); in omap_stop_dma()
540 /* Wait for sDMA FIFO drain */ in omap_stop_dma()
541 l = p->dma_read(CCR, lch); in omap_stop_dma()
546 l = p->dma_read(CCR, lch); in omap_stop_dma()
551 p->dma_write(sys_cf, OCP_SYSCONFIG, lch); in omap_stop_dma()
554 p->dma_write(l, CCR, lch); in omap_stop_dma()
564 if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) { in omap_stop_dma()
580 } while (next_lch != -1); in omap_stop_dma()
594 * this function and process the returned value before re-enabling interrupt to
604 offset = p->dma_read(CPC, lch); in omap_get_dma_src_pos()
606 offset = p->dma_read(CSAC, lch); in omap_get_dma_src_pos()
609 offset = p->dma_read(CSAC, lch); in omap_get_dma_src_pos()
617 if (likely(p->dma_read(CDAC, lch))) in omap_get_dma_src_pos()
618 offset = p->dma_read(CSAC, lch); in omap_get_dma_src_pos()
620 offset = p->dma_read(CSSA, lch); in omap_get_dma_src_pos()
623 offset |= (p->dma_read(CSSA, lch) & 0xFFFF0000); in omap_get_dma_src_pos()
632 * this function and process the returned value before re-enabling interrupt to
642 offset = p->dma_read(CPC, lch); in omap_get_dma_dst_pos()
644 offset = p->dma_read(CDAC, lch); in omap_get_dma_dst_pos()
647 * omap 3.2/3.3 erratum: sometimes 0 is returned if CSAC/CDAC is in omap_get_dma_dst_pos()
651 offset = p->dma_read(CDAC, lch); in omap_get_dma_dst_pos()
658 offset = p->dma_read(CDSA, lch); in omap_get_dma_dst_pos()
661 offset |= (p->dma_read(CDSA, lch) & 0xFFFF0000); in omap_get_dma_dst_pos()
669 return (p->dma_read(CCR, lch) & OMAP_DMA_CCR_EN) != 0; in omap_get_dma_active_status()
682 if (p->dma_read(CCR, lch) & OMAP_DMA_CCR_EN) in omap_dma_running()
688 /*----------------------------------------------------------------------------*/
698 csr = p->dma_read(CSR, ch); in omap1_dma_handle_ch()
705 if (unlikely(dma_chan[ch].dev_id == -1)) { in omap1_dma_handle_ch()
725 int ch = ((int) dev_id) - 1; in omap1_dma_irq_handler()
754 p = pdev->dev.platform_data; in omap_system_dma_probe()
756 dev_err(&pdev->dev, in omap_system_dma_probe()
759 return -EINVAL; in omap_system_dma_probe()
762 d = p->dma_attr; in omap_system_dma_probe()
763 errata = p->errata; in omap_system_dma_probe()
765 if ((d->dev_caps & RESERVE_CHANNEL) && omap_dma_reserve_channels in omap_system_dma_probe()
766 && (omap_dma_reserve_channels < d->lch_count)) in omap_system_dma_probe()
767 d->lch_count = omap_dma_reserve_channels; in omap_system_dma_probe()
769 dma_lch_count = d->lch_count; in omap_system_dma_probe()
771 enable_1510_mode = d->dev_caps & ENABLE_1510_MODE; in omap_system_dma_probe()
773 dma_chan = devm_kcalloc(&pdev->dev, dma_lch_count, in omap_system_dma_probe()
776 return -ENOMEM; in omap_system_dma_probe()
781 dma_chan[ch].dev_id = -1; in omap_system_dma_probe()
782 dma_chan[ch].next_lch = -1; in omap_system_dma_probe()
811 if (d->dev_caps & HS_CHANNELS_RESERVED) { in omap_system_dma_probe()
816 p->show_dma_caps(); in omap_system_dma_probe()
852 MODULE_DESCRIPTION("OMAP SYSTEM DMA DRIVER");
857 * Reserve the omap SDMA channels using cmdline bootarg