From: Huang Shijie <b32955@freescale.com>
To: Vinod Koul <vkoul@infradead.org>
Cc: vinod.koul@intel.com, gregkh@linuxfoundation.org,
linux@arm.linux.org.uk, lauri.hintsala@bluegiga.com,
linux-serial@vger.kernel.org, shawn.guo@linaro.org,
linux-arm-kernel@lists.infradead.org, alan@linux.intel.com
Subject: Re: [PATCH v2 2/3] serial: mxs-auart: add the DMA support for mx28
Date: Thu, 25 Oct 2012 13:50:46 +0800 [thread overview]
Message-ID: <5088D336.7040206@freescale.com> (raw)
In-Reply-To: <1351138689.5263.68.camel@vkoul-udesk3>
于 2012年10月25日 12:18, Vinod Koul 写道:
>
>> +
>> +static int mxs_auart_dma_tx(struct mxs_auart_port *s, int size)
>> +{
>> + struct dma_async_tx_descriptor *desc;
>> + struct scatterlist *sgl =&s->tx_sgl;
>> + struct dma_chan *channel = s->tx_dma_chan;
>> + u32 pio;
>> +
>> + /* [1] : send PIO. Note, the first pio word is CTRL1. */
>> + pio = AUART_CTRL1_XFER_COUNT(size);
>> + desc = dmaengine_prep_slave_sg(channel, (struct scatterlist *)&pio,
>> + 1, DMA_TRANS_NONE, 0);
> this seems like a hack. API expects a scatterlist as argument.
> Same thing about direction, NONE doesnt mean anything for dma transfer.
It's not a hack. this DMA descriptor is used to set the registers.
Please see the code in drivers/dma/mxs-dma.c:mxs_dam_prep_slave_sg().
>> + if (!desc) {
>> + dev_err(s->dev, "step 1 error\n");
>> + return -EINVAL;
>> + }
>> +
>> + /* [2] : set DMA buffer. */
>> + sg_init_one(sgl, s->tx_dma_buf, size);
>> + dma_map_sg(s->dev, sgl, 1, DMA_TO_DEVICE);
>> + desc = dmaengine_prep_slave_sg(channel, sgl,
>> + 1, DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
>> + if (!desc) {
>> + dev_err(s->dev, "step 2 error\n");
>> + return -EINVAL;
>> + }
>> +
>> + /* [3] : submit the DMA */
>> + desc->callback = dma_tx_callback;
>> + desc->callback_param = s;
>> + dmaengine_submit(desc);
>> + dma_async_issue_pending(channel);
>> + return 0;
>> +}
>> +
>>
>> +static bool mxs_auart_dma_filter(struct dma_chan *chan, void *param)
>> +{
>> + struct mxs_auart_port *s = param;
>> +
>> + if (!mxs_dma_is_apbx(chan))
>> + return false;
>> +
>> + if (s->dma_channel == chan->chan_id) {
>> + chan->private =&s->dma_data;
> dont use chan->private. You need to dmaengine_slave_config API
please see the drivers/dma/mxs-dma.c:mxs_dam_alloc_chan_resoures().
The mxs-dma driver uses ->private to store the channel interrupt number.
thanks
Huang Shijie
>> + return true;
>> + }
>> + return false;
>> +}
>> +
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: b32955@freescale.com (Huang Shijie)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/3] serial: mxs-auart: add the DMA support for mx28
Date: Thu, 25 Oct 2012 13:50:46 +0800 [thread overview]
Message-ID: <5088D336.7040206@freescale.com> (raw)
In-Reply-To: <1351138689.5263.68.camel@vkoul-udesk3>
? 2012?10?25? 12:18, Vinod Koul ??:
>
>> +
>> +static int mxs_auart_dma_tx(struct mxs_auart_port *s, int size)
>> +{
>> + struct dma_async_tx_descriptor *desc;
>> + struct scatterlist *sgl =&s->tx_sgl;
>> + struct dma_chan *channel = s->tx_dma_chan;
>> + u32 pio;
>> +
>> + /* [1] : send PIO. Note, the first pio word is CTRL1. */
>> + pio = AUART_CTRL1_XFER_COUNT(size);
>> + desc = dmaengine_prep_slave_sg(channel, (struct scatterlist *)&pio,
>> + 1, DMA_TRANS_NONE, 0);
> this seems like a hack. API expects a scatterlist as argument.
> Same thing about direction, NONE doesnt mean anything for dma transfer.
It's not a hack. this DMA descriptor is used to set the registers.
Please see the code in drivers/dma/mxs-dma.c:mxs_dam_prep_slave_sg().
>> + if (!desc) {
>> + dev_err(s->dev, "step 1 error\n");
>> + return -EINVAL;
>> + }
>> +
>> + /* [2] : set DMA buffer. */
>> + sg_init_one(sgl, s->tx_dma_buf, size);
>> + dma_map_sg(s->dev, sgl, 1, DMA_TO_DEVICE);
>> + desc = dmaengine_prep_slave_sg(channel, sgl,
>> + 1, DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
>> + if (!desc) {
>> + dev_err(s->dev, "step 2 error\n");
>> + return -EINVAL;
>> + }
>> +
>> + /* [3] : submit the DMA */
>> + desc->callback = dma_tx_callback;
>> + desc->callback_param = s;
>> + dmaengine_submit(desc);
>> + dma_async_issue_pending(channel);
>> + return 0;
>> +}
>> +
>>
>> +static bool mxs_auart_dma_filter(struct dma_chan *chan, void *param)
>> +{
>> + struct mxs_auart_port *s = param;
>> +
>> + if (!mxs_dma_is_apbx(chan))
>> + return false;
>> +
>> + if (s->dma_channel == chan->chan_id) {
>> + chan->private =&s->dma_data;
> dont use chan->private. You need to dmaengine_slave_config API
please see the drivers/dma/mxs-dma.c:mxs_dam_alloc_chan_resoures().
The mxs-dma driver uses ->private to store the channel interrupt number.
thanks
Huang Shijie
>> + return true;
>> + }
>> + return false;
>> +}
>> +
next prev parent reply other threads:[~2012-10-25 5:55 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-24 10:27 [PATCH v2 0/3] serial: mxs-auart: add DMA support for auart in mx28 Huang Shijie
2012-10-24 10:27 ` Huang Shijie
2012-10-24 10:27 ` [PATCH v2 1/3] serial: mxs-auart: distinguish the different SOCs Huang Shijie
2012-10-24 10:27 ` Huang Shijie
2012-10-24 10:27 ` [PATCH v2 2/3] serial: mxs-auart: add the DMA support for mx28 Huang Shijie
2012-10-24 10:27 ` Huang Shijie
2012-10-25 4:18 ` Vinod Koul
2012-10-25 4:18 ` Vinod Koul
2012-10-25 5:50 ` Huang Shijie [this message]
2012-10-25 5:50 ` Huang Shijie
2012-10-25 6:07 ` Vinod Koul
2012-10-25 6:07 ` Vinod Koul
2012-10-25 9:15 ` Huang Shijie
2012-10-25 9:15 ` Huang Shijie
2012-10-25 11:08 ` Vinod Koul
2012-10-25 11:08 ` Vinod Koul
2012-11-05 3:16 ` Huang Shijie
2012-11-05 3:16 ` Huang Shijie
2012-11-13 9:42 ` Lauri Hintsala
2012-11-13 9:42 ` Lauri Hintsala
2012-11-15 3:20 ` Huang Shijie
2012-11-15 3:20 ` Huang Shijie
2012-11-15 7:22 ` Lauri Hintsala
2012-11-15 7:22 ` Lauri Hintsala
2012-11-15 9:11 ` Huang Shijie
2012-11-15 9:11 ` Huang Shijie
2012-11-15 11:51 ` Lauri Hintsala
2012-11-15 11:51 ` Lauri Hintsala
2012-10-24 10:27 ` [PATCH v2 3/3] ARM: dts: enable dma support for auart0 in mx28 Huang Shijie
2012-10-24 10:27 ` Huang Shijie
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=5088D336.7040206@freescale.com \
--to=b32955@freescale.com \
--cc=alan@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=lauri.hintsala@bluegiga.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=shawn.guo@linaro.org \
--cc=vinod.koul@intel.com \
--cc=vkoul@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.