mxs-dma.c (eeca9fad52fc4bfdf42c38bfcf383e932eb3e9d6) | mxs-dma.c (ec5b103ecfde929004b691f29183255aeeadecd5) |
---|---|
1/* 2 * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved. 3 * 4 * Refer to drivers/dma/imx-sdma.c 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 2 as 8 * published by the Free Software Foundation. --- 9 unchanged lines hidden (view full) --- 18#include <linux/semaphore.h> 19#include <linux/device.h> 20#include <linux/dma-mapping.h> 21#include <linux/slab.h> 22#include <linux/platform_device.h> 23#include <linux/dmaengine.h> 24#include <linux/delay.h> 25#include <linux/module.h> | 1/* 2 * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved. 3 * 4 * Refer to drivers/dma/imx-sdma.c 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 2 as 8 * published by the Free Software Foundation. --- 9 unchanged lines hidden (view full) --- 18#include <linux/semaphore.h> 19#include <linux/device.h> 20#include <linux/dma-mapping.h> 21#include <linux/slab.h> 22#include <linux/platform_device.h> 23#include <linux/dmaengine.h> 24#include <linux/delay.h> 25#include <linux/module.h> |
26#include <linux/fsl/mxs-dma.h> | |
27#include <linux/stmp_device.h> 28#include <linux/of.h> 29#include <linux/of_device.h> 30#include <linux/of_dma.h> 31 32#include <asm/irq.h> 33 34#include "dmaengine.h" --- 157 unchanged lines hidden (view full) --- 192}; 193MODULE_DEVICE_TABLE(of, mxs_dma_dt_ids); 194 195static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan) 196{ 197 return container_of(chan, struct mxs_dma_chan, chan); 198} 199 | 26#include <linux/stmp_device.h> 27#include <linux/of.h> 28#include <linux/of_device.h> 29#include <linux/of_dma.h> 30 31#include <asm/irq.h> 32 33#include "dmaengine.h" --- 157 unchanged lines hidden (view full) --- 191}; 192MODULE_DEVICE_TABLE(of, mxs_dma_dt_ids); 193 194static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan) 195{ 196 return container_of(chan, struct mxs_dma_chan, chan); 197} 198 |
200int mxs_dma_is_apbh(struct dma_chan *chan) 201{ 202 struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); 203 struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; 204 205 return dma_is_apbh(mxs_dma); 206} 207EXPORT_SYMBOL_GPL(mxs_dma_is_apbh); 208 209int mxs_dma_is_apbx(struct dma_chan *chan) 210{ 211 struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); 212 struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; 213 214 return !dma_is_apbh(mxs_dma); 215} 216EXPORT_SYMBOL_GPL(mxs_dma_is_apbx); 217 | |
218static void mxs_dma_reset_chan(struct mxs_dma_chan *mxs_chan) 219{ 220 struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; 221 int chan_id = mxs_chan->chan.chan_id; 222 223 if (dma_is_apbh(mxs_dma) && apbh_is_old(mxs_dma)) 224 writel(1 << (chan_id + BP_APBH_CTRL0_RESET_CHANNEL), 225 mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_SET); --- 118 unchanged lines hidden (view full) --- 344 } 345 346 return IRQ_HANDLED; 347} 348 349static int mxs_dma_alloc_chan_resources(struct dma_chan *chan) 350{ 351 struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); | 199static void mxs_dma_reset_chan(struct mxs_dma_chan *mxs_chan) 200{ 201 struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; 202 int chan_id = mxs_chan->chan.chan_id; 203 204 if (dma_is_apbh(mxs_dma) && apbh_is_old(mxs_dma)) 205 writel(1 << (chan_id + BP_APBH_CTRL0_RESET_CHANNEL), 206 mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_SET); --- 118 unchanged lines hidden (view full) --- 325 } 326 327 return IRQ_HANDLED; 328} 329 330static int mxs_dma_alloc_chan_resources(struct dma_chan *chan) 331{ 332 struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); |
352 struct mxs_dma_data *data = chan->private; | |
353 struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; 354 int ret; 355 | 333 struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; 334 int ret; 335 |
356 if (data) 357 mxs_chan->chan_irq = data->chan_irq; 358 | |
359 mxs_chan->ccw = dma_alloc_coherent(mxs_dma->dma_device.dev, 360 CCW_BLOCK_SIZE, &mxs_chan->ccw_phys, 361 GFP_KERNEL); 362 if (!mxs_chan->ccw) { 363 ret = -ENOMEM; 364 goto err_alloc; 365 } 366 --- 250 unchanged lines hidden (view full) --- 617 618 return ret; 619} 620 621static enum dma_status mxs_dma_tx_status(struct dma_chan *chan, 622 dma_cookie_t cookie, struct dma_tx_state *txstate) 623{ 624 struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); | 336 mxs_chan->ccw = dma_alloc_coherent(mxs_dma->dma_device.dev, 337 CCW_BLOCK_SIZE, &mxs_chan->ccw_phys, 338 GFP_KERNEL); 339 if (!mxs_chan->ccw) { 340 ret = -ENOMEM; 341 goto err_alloc; 342 } 343 --- 250 unchanged lines hidden (view full) --- 594 595 return ret; 596} 597 598static enum dma_status mxs_dma_tx_status(struct dma_chan *chan, 599 dma_cookie_t cookie, struct dma_tx_state *txstate) 600{ 601 struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); |
625 dma_cookie_t last_used; | |
626 | 602 |
627 last_used = chan->cookie; 628 dma_set_tx_state(txstate, chan->completed_cookie, last_used, 0); | 603 dma_set_tx_state(txstate, chan->completed_cookie, chan->cookie, 0); |
629 630 return mxs_chan->status; 631} 632 633static void mxs_dma_issue_pending(struct dma_chan *chan) 634{ 635 struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); 636 --- 189 unchanged lines hidden --- | 604 605 return mxs_chan->status; 606} 607 608static void mxs_dma_issue_pending(struct dma_chan *chan) 609{ 610 struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); 611 --- 189 unchanged lines hidden --- |