From: Andy Gross <agross@codeaurora.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-arm-kernel@lists.infradead.org,
Vinod Koul <vinod.koul@intel.com>,
Dan Williams <dan.j.williams@intel.com>,
dmaengine@vger.kernel.org, linux-arm-msm@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v2 1/2] dmaengine: add Qualcomm BAM dma driver
Date: Mon, 20 Jan 2014 16:52:45 -0600 [thread overview]
Message-ID: <20140120225245.GA3530@qualcomm.com> (raw)
In-Reply-To: <201401172349.28229.arnd@arndb.de>
On Fri, Jan 17, 2014 at 11:49:27PM +0100, Arnd Bergmann wrote:
> On Friday 10 January 2014, Andy Gross wrote:
>
> > +static bool bam_dma_filter(struct dma_chan *chan, void *data)
> > +{
> > + struct bam_filter_args *args = data;
> > + struct bam_chan *bchan = to_bam_chan(chan);
> > +
> > + if (args->dev == chan->device &&
> > + args->id == bchan->id) {
> > +
> > + /* we found the channel, so lets set the EE and dir */
> > + bchan->ee = args->ee;
> > + bchan->slave.direction = args->dir ?
> > + DMA_DEV_TO_MEM : DMA_MEM_TO_DEV;
> > + return true;
> > + }
> > +
> > + return false;
> > +}
>
> A filter function should no longer be needed.
>
Ok, will remove.
> > +static struct dma_chan *bam_dma_xlate(struct of_phandle_args *dma_spec,
> > + struct of_dma *of)
> > +{
> > + struct bam_filter_args args;
> > + dma_cap_mask_t cap;
> > +
> > + if (dma_spec->args_count != 3)
> > + return NULL;
> > +
> > + args.dev = of->of_dma_data;
> > + args.id = dma_spec->args[0];
> > + args.ee = dma_spec->args[1];
> > + args.dir = dma_spec->args[2];
> > +
> > + dma_cap_zero(cap);
> > + dma_cap_set(DMA_SLAVE, cap);
> > +
> > + return dma_request_channel(cap, bam_dma_filter, &args);
> > +}
>
> Instead, call dma_get_slave_channel() with the right channel that you already know
> here.
>
Agreed.
> > + if (pdev->dev.of_node) {
> > + ret = of_dma_controller_register(pdev->dev.of_node,
> > + bam_dma_xlate, &bdev->common);
> > +
> > + if (ret) {
> > + dev_err(bdev->dev, "failed to register of_dma\n");
> > + goto err_unregister_dma;
> > + }
> > + }
>
> No need to check for pdev->dev.of_node when that is the only mode of probing.
>
Good point. I'll remove extraneous check.
> > +
> > +#ifdef CONFIG_OF
> > +static const struct of_device_id bam_of_match[] = {
> > + { .compatible = "qcom,bam-v1.4.0", },
> > + { .compatible = "qcom,bam-v1.4.1", },
> > + {}
> > +};
> > +MODULE_DEVICE_TABLE(of, bam_of_match);
> > +#endif
>
> Also, you can remove the #ifdef here and the of_match_ptr() below.
>
If this is removed, then I'll have to add the OF dependency in the Kconfig,
correct?
> > +
> > +static struct platform_driver bam_dma_driver = {
> > + .probe = bam_dma_probe,
> > + .remove = bam_dma_remove,
> > + .driver = {
> > + .name = "bam-dma-engine",
> > + .owner = THIS_MODULE,
> > + .of_match_table = of_match_ptr(bam_of_match),
> > + },
> > +};
> > +
> > +static int __init bam_dma_init(void)
> > +{
> > + return platform_driver_register(&bam_dma_driver);
> > +}
> > +
> > +static void __exit bam_dma_exit(void)
> > +{
> > + return platform_driver_unregister(&bam_dma_driver);
> > +}
> > +
>
> module_platform_driver()
>
Will fix.
> > diff --git a/drivers/dma/qcom_bam_dma.h b/drivers/dma/qcom_bam_dma.h
> > new file mode 100644
> > index 0000000..2cb3b5f
> > --- /dev/null
> > +++ b/drivers/dma/qcom_bam_dma.h
> > @@ -0,0 +1,268 @@
> > +#ifndef __QCOM_BAM_DMA_H__
> > +#define __QCOM_BAM_DMA_H__
> > +
> > +#include <linux/dmaengine.h>
> > +#include "virt-dma.h"
> > +
> > +enum bam_channel_dir {
> > + BAM_PIPE_CONSUMER = 0, /* channel reads from data-fifo or memory */
> > + BAM_PIPE_PRODUCER, /* channel writes to data-fifo or memory */
> > +};
>
> Since the header does not serve as an interface, just move all the contents
> into the driver directly.
>
OK. SBoyd made the same comment. I'll go ahead and collapse both down to 1
file.
> > +struct bam_desc_hw {
> > + u32 addr; /* Buffer physical address */
> > + u16 size; /* Buffer size in bytes */
> > + u16 flags;
> > +} __packed;
>
> Remove __packed here, it only makes the access less efficient but does not change
> the layout, which is already packed.
Ok. Will fix.
--
sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
next prev parent reply other threads:[~2014-01-20 22:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-10 19:07 [PATCH v2 0/2] Add Qualcomm BAM dmaengine driver Andy Gross
2014-01-10 19:07 ` [PATCH v2 1/2] dmaengine: add Qualcomm BAM dma driver Andy Gross
2014-01-13 10:31 ` Shevchenko, Andriy
2014-01-20 23:31 ` Andy Gross
2014-01-14 19:43 ` Stephen Boyd
2014-01-20 23:20 ` Andy Gross
2014-01-17 22:49 ` Arnd Bergmann
2014-01-20 22:52 ` Andy Gross [this message]
2014-01-21 8:03 ` Arnd Bergmann
2014-01-21 23:01 ` Andy Gross
2014-01-21 23:12 ` Arnd Bergmann
2014-01-23 20:17 ` Kumar Gala
2014-01-23 22:50 ` Andy Gross
2014-01-10 19:07 ` [PATCH v2 2/2] dmaengine: qcom_bam_dma: Add device tree binding Andy Gross
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=20140120225245.GA3530@qualcomm.com \
--to=agross@codeaurora.org \
--cc=arnd@arndb.de \
--cc=dan.j.williams@intel.com \
--cc=devicetree@vger.kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=vinod.koul@intel.com \
/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).