linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: dan.j.williams@intel.com (Dan Williams)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] dmaengine: Add Freescale i.MX1/21/27 DMA driver
Date: Tue, 05 Oct 2010 16:16:09 -0700	[thread overview]
Message-ID: <4CABB1B9.4080002@intel.com> (raw)
In-Reply-To: <1285854995-6569-5-git-send-email-s.hauer@pengutronix.de>

On 9/30/2010 6:56 AM, Sascha Hauer wrote:
> This driver is currently implemented as a user to the old i.MX
> DMA API. This allows us to convert each user of the old API to
> the dmaengine API one by one. Once this is done the old DMA
> driver can be merged into the i.MX dmaengine driver.
>
> Signed-off-by: Sascha Hauer<s.hauer@pengutronix.de>
> ---
>   drivers/dma/Kconfig   |    8 +
>   drivers/dma/Makefile  |    1 +
>   drivers/dma/imx-dma.c |  426 +++++++++++++++++++++++++++++++++++++++++++++++++
>   3 files changed, 435 insertions(+), 0 deletions(-)
>   create mode 100644 drivers/dma/imx-dma.c
[..]
> diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
> new file mode 100644
> index 0000000..6ef82ba
> --- /dev/null
> +++ b/drivers/dma/imx-dma.c
> @@ -0,0 +1,426 @@
> +/*
> + * drivers/dma/imx-dma.c
> + *
> + * This file contains a driver for the Freescale i.MX DMA engine
> + * found on i.MX1/21/27
> + *
> + * Copyright 2010 Sascha Hauer, Pengutronix<s.hauer@pengutronix.de>
> + *
> + * The code contained herein is licensed under the GNU General Public
> + * License. You may obtain a copy of the GNU General Public License
> + * Version 2 or later at the following locations:
> + *
> + * http://www.opensource.org/licenses/gpl-license.html
> + * http://www.gnu.org/copyleft/gpl.html
> + */
> +#include<linux/init.h>
> +#include<linux/types.h>
> +#include<linux/mm.h>
> +#include<linux/interrupt.h>
> +#include<linux/spinlock.h>
> +#include<linux/device.h>
> +#include<linux/dma-mapping.h>
> +#include<linux/slab.h>
> +#include<linux/platform_device.h>
> +#include<linux/dmaengine.h>
> +
> +#include<asm/irq.h>
> +#include<mach/dma-v1.h>
> +#include<mach/hardware.h>
> +
> +struct imxdma_channel {
> +       struct imxdma_engine            *imxdma;
> +       unsigned int                    channel;
> +       unsigned int                    imxdma_channel;
> +
> +       enum dma_data_direction         direction;

Why does the channel have a direction isn't that a function of the 
transaction?  It's also unused.

> +       enum dma_slave_buswidth         word_size;
> +       dma_addr_t                      bd_phys;

unused?

> +       unsigned long                   flags;

unused?

> +       dma_addr_t                      per_address;
> +       u32                             watermark_level;
> +       struct dma_chan                 chan;
> +       spinlock_t                      lock;
> +       struct dma_async_tx_descriptor  desc;
> +       dma_cookie_t                    last_completed;
> +       enum dma_status                 status;
> +       int                             dma_request;
> +       struct scatterlist              *sg_list;
> +};
> +
> +#define MAX_DMA_CHANNELS 8
> +
> +struct imxdma_engine {
> +       struct device                   *dev;
> +       struct dma_device               dma_device;
> +       struct imxdma_channel           channel[MAX_DMA_CHANNELS];
> +};
> +
> +static struct imxdma_channel *to_imxdma_chan(struct dma_chan *chan)
> +{
> +       return container_of(chan, struct imxdma_channel, chan);
> +}
> +
> +static void imxdma_handle(struct imxdma_channel *imxdmac)
> +{
> +       if (imxdmac->desc.callback)
> +               imxdmac->desc.callback(imxdmac->desc.callback_param);
> +       imxdmac->last_completed = imxdmac->desc.cookie;
> +}
> +
> +static void imxdma_irq_handler(int channel, void *data)
> +{
> +       struct imxdma_channel *imxdmac = data;
> +printk("%s\n", __func__);

Debug leftover?

> +       imxdmac->status = DMA_SUCCESS;
> +       imxdma_handle(imxdmac);
> +}
> +
> +static void imxdma_err_handler(int channel, void *data, int error)
> +{
> +       struct imxdma_channel *imxdmac = data;
> +printk("%s 0x%08x\n", __func__, error);
> +dump_stack();

If you want to keep this I think it is better as a

WARN(1, "%s 0x%08x\n", __func__, error)

...assuming that errors are rare.

--
Dan

  parent reply	other threads:[~2010-10-05 23:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-30 13:56 dmaengine patches Sascha Hauer
2010-09-30 13:56 ` [PATCH 1/4] dmaengine: add possibility for cyclic transfers Sascha Hauer
2010-09-30 13:56 ` [PATCH 2/4] dmaengine: add wrapper functions for device control functions Sascha Hauer
2010-09-30 13:56 ` [PATCH 3/4] dmaengine: Add Freescale i.MX SDMA support Sascha Hauer
2010-10-08  0:14   ` Dan Williams
2010-09-30 13:56 ` [PATCH 4/4] dmaengine: Add Freescale i.MX1/21/27 DMA driver Sascha Hauer
2010-10-05  7:45   ` javier Martin
2010-10-05 10:06     ` Sascha Hauer
2010-10-05 15:20   ` Linus Walleij
2010-10-05 23:16   ` Dan Williams [this message]
2010-10-06  8:24     ` Sascha Hauer
2010-10-06  8:25   ` [PATCH 4/4 v2] " Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CABB1B9.4080002@intel.com \
    --to=dan.j.williams@intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).