From: Tony Lindgren Date: Fri, 28 Oct 2005 01:21:38 +0000 (+0300) Subject: ARM: OMAP: Change DMA interface to allow adding 24xx DMA support X-Git-Tag: v2.6.15-omap2~124 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=a298194691ad4a3cdfa2c64ed076e319da12f83c;p=linux-2.6-omap-h63xx.git ARM: OMAP: Change DMA interface to allow adding 24xx DMA support Change DMA interface to allow adding 24xx DMA support. Note that this interface will change again after the 24xx DMA support has been merged. --- diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c index d86719d9fb6..26b14fb32d1 100644 --- a/arch/arm/plat-omap/dma.c +++ b/arch/arm/plat-omap/dma.c @@ -121,7 +121,8 @@ void omap_set_dma_priority(int dst_port, int priority) } void omap_set_dma_transfer_params(int lch, int data_type, int elem_count, - int frame_count, int sync_mode) + int frame_count, int sync_mode, + int dma_trigger, int src_or_dst_synch) { u16 w; @@ -177,9 +178,9 @@ void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color) omap_writew(w, OMAP_DMA_LCH_CTRL(lch)); } - void omap_set_dma_src_params(int lch, int src_port, int src_amode, - unsigned long src_start) + unsigned long src_start, + int src_ei, int src_fi) { u16 w; @@ -235,7 +236,8 @@ void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode) } void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode, - unsigned long dest_start) + unsigned long dest_start, + int dst_ei, int dst_fi) { u16 w; diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c index f0172f9e4d9..b0a393da5fc 100644 --- a/arch/arm/plat-omap/mcbsp.c +++ b/arch/arm/plat-omap/mcbsp.c @@ -493,17 +493,20 @@ int omap_mcbsp_xmit_buffer(unsigned int id, dma_addr_t buffer, unsigned int leng omap_set_dma_transfer_params(mcbsp[id].dma_tx_lch, OMAP_DMA_DATA_TYPE_S16, length >> 1, 1, - OMAP_DMA_SYNC_ELEMENT); + OMAP_DMA_SYNC_ELEMENT, + 0, 0); omap_set_dma_dest_params(mcbsp[id].dma_tx_lch, OMAP_DMA_PORT_TIPB, OMAP_DMA_AMODE_CONSTANT, - mcbsp[id].io_base + OMAP_MCBSP_REG_DXR1); + mcbsp[id].io_base + OMAP_MCBSP_REG_DXR1, + 0, 0); omap_set_dma_src_params(mcbsp[id].dma_tx_lch, OMAP_DMA_PORT_EMIFF, OMAP_DMA_AMODE_POST_INC, - buffer); + buffer, + 0, 0); omap_start_dma(mcbsp[id].dma_tx_lch); wait_for_completion(&(mcbsp[id].tx_dma_completion)); @@ -533,17 +536,20 @@ int omap_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer, unsigned int leng omap_set_dma_transfer_params(mcbsp[id].dma_rx_lch, OMAP_DMA_DATA_TYPE_S16, length >> 1, 1, - OMAP_DMA_SYNC_ELEMENT); + OMAP_DMA_SYNC_ELEMENT, + 0, 0); omap_set_dma_src_params(mcbsp[id].dma_rx_lch, OMAP_DMA_PORT_TIPB, OMAP_DMA_AMODE_CONSTANT, - mcbsp[id].io_base + OMAP_MCBSP_REG_DRR1); + mcbsp[id].io_base + OMAP_MCBSP_REG_DRR1, + 0, 0); omap_set_dma_dest_params(mcbsp[id].dma_rx_lch, OMAP_DMA_PORT_EMIFF, OMAP_DMA_AMODE_POST_INC, - buffer); + buffer, + 0, 0); omap_start_dma(mcbsp[id].dma_rx_lch); wait_for_completion(&(mcbsp[id].rx_dma_completion)); diff --git a/drivers/media/video/omap/omap16xxcam.c b/drivers/media/video/omap/omap16xxcam.c index 806c4a886e5..c85851f298d 100644 --- a/drivers/media/video/omap/omap16xxcam.c +++ b/drivers/media/video/omap/omap16xxcam.c @@ -325,18 +325,22 @@ omap16xxcam_start_dma(struct sgdma_state *sgdma, if (machine_is_omap_h3()) omap_set_dma_src_params(dmach, OMAP_DMA_PORT_OCP_T1, - OMAP_DMA_AMODE_CONSTANT, CAM_CAMDATA_REG); + OMAP_DMA_AMODE_CONSTANT, CAM_CAMDATA_REG, + 0, 0); else omap_set_dma_src_params(dmach, OMAP_DMA_PORT_TIPB, - OMAP_DMA_AMODE_CONSTANT, CAM_CAMDATA_REG); + OMAP_DMA_AMODE_CONSTANT, CAM_CAMDATA_REG, + 0, 0); omap_set_dma_dest_params(dmach, OMAP_DMA_PORT_EMIFF, - OMAP_DMA_AMODE_POST_INC, sg_dma_address(sglist)); + OMAP_DMA_AMODE_POST_INC, sg_dma_address(sglist), + 0, 0); omap_set_dma_transfer_params(dmach, OMAP_DMA_DATA_TYPE_S32, FIFO_TRIGGER_LVL, sg_dma_len(sglist)/(4 * FIFO_TRIGGER_LVL), - OMAP_DMA_SYNC_FRAME); + OMAP_DMA_SYNC_FRAME, + 0, 0); omap_writew(omap_readw(OMAP_DMA_CLNK_CTRL(dmach)) & ~(1<<15), diff --git a/drivers/mmc/omap.c b/drivers/mmc/omap.c index 7b39a4574ad..ac33592bb97 100644 --- a/drivers/mmc/omap.c +++ b/drivers/mmc/omap.c @@ -704,20 +704,24 @@ mmc_omap_prepare_dma(struct mmc_omap_host *host, struct mmc_data *data) buf = 0x800f | ((frame - 1) << 8); omap_set_dma_src_params(dma_ch, OMAP_DMA_PORT_TIPB, OMAP_DMA_AMODE_CONSTANT, - data_addr); + data_addr, + 0, 0); omap_set_dma_dest_params(dma_ch, OMAP_DMA_PORT_EMIFF, OMAP_DMA_AMODE_POST_INC, - sg_dma_address(sg)); + sg_dma_address(sg), + 0, 0); omap_set_dma_dest_data_pack(dma_ch, 1); omap_set_dma_dest_burst_mode(dma_ch, OMAP_DMA_DATA_BURST_4); } else { buf = 0x0f80 | ((frame - 1) << 0); omap_set_dma_dest_params(dma_ch, OMAP_DMA_PORT_TIPB, OMAP_DMA_AMODE_CONSTANT, - data_addr); + data_addr, + 0, 0); omap_set_dma_src_params(dma_ch, OMAP_DMA_PORT_EMIFF, OMAP_DMA_AMODE_POST_INC, - sg_dma_address(sg)); + sg_dma_address(sg), + 0, 0); omap_set_dma_src_data_pack(dma_ch, 1); omap_set_dma_src_burst_mode(dma_ch, OMAP_DMA_DATA_BURST_4); } @@ -728,7 +732,8 @@ mmc_omap_prepare_dma(struct mmc_omap_host *host, struct mmc_data *data) OMAP_MMC_WRITE(host->base, BUF, buf); omap_set_dma_transfer_params(dma_ch, OMAP_DMA_DATA_TYPE_S16, - frame, count, OMAP_DMA_SYNC_FRAME); + frame, count, OMAP_DMA_SYNC_FRAME, + 0, 0); } /* a scatterlist segment completed */ diff --git a/drivers/mtd/nand/omap-hw.c b/drivers/mtd/nand/omap-hw.c index abc380948c8..6afab167e8e 100644 --- a/drivers/mtd/nand/omap-hw.c +++ b/drivers/mtd/nand/omap-hw.c @@ -232,25 +232,30 @@ static inline int omap_nand_dma_transfer(struct mtd_info *mtd, void *addr, fifo_reg = NAND_BASE + NND_FIFO; if (is_write) { omap_set_dma_dest_params(dma_ch, OMAP_DMA_PORT_TIPB, - OMAP_DMA_AMODE_CONSTANT, fifo_reg); + OMAP_DMA_AMODE_CONSTANT, fifo_reg, + 0, 0); omap_set_dma_src_params(dma_ch, OMAP_DMA_PORT_EMIFF, OMAP_DMA_AMODE_POST_INC, - virt_to_phys(addr)); + virt_to_phys(addr), + 0, 0); // omap_set_dma_src_burst_mode(dma_ch, OMAP_DMA_DATA_BURST_4); /* Set POSTWRITE bit */ nand_write_reg(NND_CTRL, nand_read_reg(NND_CTRL) | (1 << 16)); } else { omap_set_dma_src_params(dma_ch, OMAP_DMA_PORT_TIPB, - OMAP_DMA_AMODE_CONSTANT, fifo_reg); + OMAP_DMA_AMODE_CONSTANT, fifo_reg, + 0, 0); omap_set_dma_dest_params(dma_ch, OMAP_DMA_PORT_EMIFF, OMAP_DMA_AMODE_POST_INC, - virt_to_phys(addr)); + virt_to_phys(addr), + 0, 0); // omap_set_dma_dest_burst_mode(dma_ch, OMAP_DMA_DATA_BURST_8); /* Set PREFETCH bit */ nand_write_reg(NND_CTRL, nand_read_reg(NND_CTRL) | (1 << 17)); } omap_set_dma_transfer_params(dma_ch, OMAP_DMA_DATA_TYPE_S32, block_size / 4, - block_count, OMAP_DMA_SYNC_FRAME); + block_count, OMAP_DMA_SYNC_FRAME, + 0, 0); init_completion(&comp); len = u32_count << 2; diff --git a/drivers/net/irda/omap1610-ir.c b/drivers/net/irda/omap1610-ir.c index 1ee7229c88b..1bfbb4ed476 100644 --- a/drivers/net/irda/omap1610-ir.c +++ b/drivers/net/irda/omap1610-ir.c @@ -166,14 +166,16 @@ static int omap1610_irda_set_speed(struct net_device *dev, int speed); static void omap1610_irda_start_rx_dma(struct omap1610_irda *si) { /* Configure DMA */ - omap_set_dma_src_params(si->rx_dma_channel, 0x3, 0x0, (unsigned long)UART3_RHR); + omap_set_dma_src_params(si->rx_dma_channel, 0x3, 0x0, (unsigned long)UART3_RHR, + 0, 0); omap_enable_dma_irq(si->rx_dma_channel, 0x01); omap_set_dma_dest_params(si->rx_dma_channel, 0x0, 0x1, - si->rx_buf_dma_phys); + si->rx_buf_dma_phys, + 0, 0); - omap_set_dma_transfer_params(si->rx_dma_channel, 0x0, 4096, 0x1, 0x0); + omap_set_dma_transfer_params(si->rx_dma_channel, 0x0, 4096, 0x1, 0x0, 0, 0); omap_start_dma(si->rx_dma_channel); } @@ -183,14 +185,15 @@ static void omap1610_start_tx_dma(struct omap1610_irda *si, int size) __ECHO_IN; /* Configure DMA */ - omap_set_dma_dest_params(si->tx_dma_channel, 0x03, 0x0, (unsigned long)UART3_THR); - + omap_set_dma_dest_params(si->tx_dma_channel, 0x03, 0x0, (unsigned long)UART3_THR, + 0, 0); omap_enable_dma_irq(si->tx_dma_channel, 0x01); omap_set_dma_src_params(si->tx_dma_channel, 0x0, 0x1, - si->tx_buf_dma_phys); + si->tx_buf_dma_phys, + 0, 0); - omap_set_dma_transfer_params(si->tx_dma_channel, 0x0, size, 0x1, 0x0); + omap_set_dma_transfer_params(si->tx_dma_channel, 0x0, size, 0x1, 0x0, 0, 0); HDBG1(1); diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index d1b797bff9c..e2144979fa0 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c @@ -622,17 +622,19 @@ static void next_in_dma(struct omap_ep *ep, struct omap_req *req) || (cpu_is_omap15xx() && length < ep->maxpacket)) { txdma_ctrl = UDC_TXN_EOT | length; omap_set_dma_transfer_params(ep->lch, OMAP_DMA_DATA_TYPE_S8, - length, 1, sync_mode); + length, 1, sync_mode, 0, 0); } else { length = min(length / ep->maxpacket, (unsigned) UDC_TXN_TSC + 1); txdma_ctrl = length; omap_set_dma_transfer_params(ep->lch, OMAP_DMA_DATA_TYPE_S16, - ep->ep.maxpacket >> 1, length, sync_mode); + ep->ep.maxpacket >> 1, length, sync_mode, + 0, 0); length *= ep->maxpacket; } omap_set_dma_src_params(ep->lch, OMAP_DMA_PORT_EMIFF, - OMAP_DMA_AMODE_POST_INC, req->req.dma + req->req.actual); + OMAP_DMA_AMODE_POST_INC, req->req.dma + req->req.actual, + 0, 0); omap_start_dma(ep->lch); ep->dma_counter = dma_csac(ep->lch); @@ -677,9 +679,11 @@ static void next_out_dma(struct omap_ep *ep, struct omap_req *req) req->dma_bytes = packets * ep->ep.maxpacket; omap_set_dma_transfer_params(ep->lch, OMAP_DMA_DATA_TYPE_S16, ep->ep.maxpacket >> 1, packets, - OMAP_DMA_SYNC_ELEMENT); + OMAP_DMA_SYNC_ELEMENT, + 0, 0); omap_set_dma_dest_params(ep->lch, OMAP_DMA_PORT_EMIFF, - OMAP_DMA_AMODE_POST_INC, req->req.dma + req->req.actual); + OMAP_DMA_AMODE_POST_INC, req->req.dma + req->req.actual, + 0, 0); ep->dma_counter = DMA_DEST_LAST(ep->lch); UDC_RXDMA_REG(ep->dma_channel) = UDC_RXN_STOP | (packets - 1); @@ -822,7 +826,8 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel) omap_set_dma_dest_params(ep->lch, OMAP_DMA_PORT_TIPB, OMAP_DMA_AMODE_CONSTANT, - (unsigned long) io_v2p((u32)&UDC_DATA_DMA_REG)); + (unsigned long) io_v2p((u32)&UDC_DATA_DMA_REG), + 0, 0); } } else { status = omap_request_dma(OMAP_DMA_USB_W2FC_RX0 - 1 + channel, @@ -833,7 +838,8 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel) omap_set_dma_src_params(ep->lch, OMAP_DMA_PORT_TIPB, OMAP_DMA_AMODE_CONSTANT, - (unsigned long) io_v2p((u32)&UDC_DATA_DMA_REG)); + (unsigned long) io_v2p((u32)&UDC_DATA_DMA_REG), + 0, 0); /* EMIFF */ omap_set_dma_dest_burst_mode(ep->lch, OMAP_DMA_DATA_BURST_4); diff --git a/include/asm-arm/arch-omap/dma.h b/include/asm-arm/arch-omap/dma.h index 04ebef5c6e9..32bc554b505 100644 --- a/include/asm-arm/arch-omap/dma.h +++ b/include/asm-arm/arch-omap/dma.h @@ -217,19 +217,22 @@ extern void omap_start_dma(int lch); extern void omap_stop_dma(int lch); extern void omap_set_dma_transfer_params(int lch, int data_type, int elem_count, int frame_count, - int sync_mode); + int sync_mode, + int dma_trigger, int src_or_dst_synch); extern void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color); extern void omap_set_dma_src_params(int lch, int src_port, int src_amode, - unsigned long src_start); + unsigned long src_start, + int src_ei, int src_fi); extern void omap_set_dma_src_index(int lch, int eidx, int fidx); extern void omap_set_dma_src_data_pack(int lch, int enable); extern void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode); extern void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode, - unsigned long dest_start); + unsigned long dest_start, + int dst_ei, int dst_fi); extern void omap_set_dma_dest_index(int lch, int eidx, int fidx); extern void omap_set_dma_dest_data_pack(int lch, int enable); extern void omap_set_dma_dest_burst_mode(int lch, diff --git a/sound/arm/omap-alsa-dma.c b/sound/arm/omap-alsa-dma.c index abb1bc4e865..7028577889d 100644 --- a/sound/arm/omap-alsa-dma.c +++ b/sound/arm/omap-alsa-dma.c @@ -325,9 +325,11 @@ static int audio_set_dma_params_play(int channel, dma_addr_t dma_ptr, int cfn = dma_size / (2 * cen); FN_IN; omap_set_dma_dest_params(channel, 0x05, 0x00, - (OMAP1610_MCBSP1_BASE + 0x806)); - omap_set_dma_src_params(channel, 0x00, 0x01, dma_ptr); - omap_set_dma_transfer_params(channel, dt, cen, cfn, 0x00); + (OMAP1610_MCBSP1_BASE + 0x806), + 0, 0); + omap_set_dma_src_params(channel, 0x00, 0x01, dma_ptr, + 0, 0); + omap_set_dma_transfer_params(channel, dt, cen, cfn, 0x00, 0, 0); FN_OUT(0); return 0; } @@ -341,9 +343,10 @@ static int audio_set_dma_params_capture(int channel, dma_addr_t dma_ptr, int cfn = dma_size / (2 * cen); FN_IN; omap_set_dma_src_params(channel, 0x05, 0x00, - (OMAP1610_MCBSP1_BASE + 0x802)); - omap_set_dma_dest_params(channel, 0x00, 0x01, dma_ptr); - omap_set_dma_transfer_params(channel, dt, cen, cfn, 0x00); + (OMAP1610_MCBSP1_BASE + 0x802), + 0, 0); + omap_set_dma_dest_params(channel, 0x00, 0x01, dma_ptr, 0, 0); + omap_set_dma_transfer_params(channel, dt, cen, cfn, 0x00, 0, 0); FN_OUT(0); return 0; } diff --git a/sound/oss/omap-audio-dma-intfc.c b/sound/oss/omap-audio-dma-intfc.c index bc0df23410c..2bd61073d7a 100644 --- a/sound/oss/omap-audio-dma-intfc.c +++ b/sound/oss/omap-audio-dma-intfc.c @@ -701,9 +701,10 @@ static int audio_set_dma_params_play(int channel, dma_addr_t dma_ptr, int cfn = dma_size / (2 * cen); FN_IN; omap_set_dma_dest_params(channel, 0x05, 0x00, - (OMAP1610_MCBSP1_BASE + 0x806)); - omap_set_dma_src_params(channel, 0x00, 0x01, dma_ptr); - omap_set_dma_transfer_params(channel, dt, cen, cfn, 0x00); + (OMAP1610_MCBSP1_BASE + 0x806), + 0, 0); + omap_set_dma_src_params(channel, 0x00, 0x01, dma_ptr, 0, 0); + omap_set_dma_transfer_params(channel, dt, cen, cfn, 0x00, 0, 0); FN_OUT(0); return 0; } @@ -716,9 +717,10 @@ static int audio_set_dma_params_capture(int channel, dma_addr_t dma_ptr, int cfn = dma_size / (2 * cen); FN_IN; omap_set_dma_src_params(channel, 0x05, 0x00, - (OMAP1610_MCBSP1_BASE + 0x802)); - omap_set_dma_dest_params(channel, 0x00, 0x01, dma_ptr); - omap_set_dma_transfer_params(channel, dt, cen, cfn, 0x00); + (OMAP1610_MCBSP1_BASE + 0x802), + 0, 0); + omap_set_dma_dest_params(channel, 0x00, 0x01, dma_ptr, 0, 0); + omap_set_dma_transfer_params(channel, dt, cen, cfn, 0x00, 0, 0); FN_OUT(0); return 0; }