From: maxime.ripard@free-electrons.com (Maxime Ripard)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/8] dma: sun4i: Add support for the DMA engine on sun[457]i SoCs
Date: Thu, 24 Jul 2014 10:53:09 +0200 [thread overview]
Message-ID: <20140724085309.GR20328@lukather> (raw)
In-Reply-To: <53C843DC.8090808@elopez.com.ar>
Hi,
On Thu, Jul 17, 2014 at 06:45:00PM -0300, Emilio L?pez wrote:
> >>+ depends on (MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || (COMPILE_TEST && OF && ARM))
> >
> >This pretty much defeats the purpose of COMPILE_TEST
>
> QCOM_BAM_DMA does it that way; it's better to get some coverage than
> none I guess?
You'll get that kind of coverage with multi_v7 already, so that looks
quite redundant.
> >>+ help
> >>+ Enable support for the DMA controller present in the sun4i,
> >>+ sun5i and sun7i Allwinner ARM SoCs.
> >>+
> (...)
> >>+
> >>+/** Normal DMA register values **/
> >>+
> >>+/* Normal DMA source/destination data request type values */
> >>+#define NDMA_DRQ_TYPE_SDRAM 0x16
> >>+#define NDMA_DRQ_TYPE_LIMIT (0x1F + 1)
> >
> >Hmmm, I'm unsure what this is about... What is it supposed to do, and
> >how is it different from BIT(5) ?
>
> if (val < NDMA_DRQ_TYPE_LIMIT)
> /* valid value */
> else
> /* invalid value */
>
> 0x1F is the last valid value
Ok.
> >>+
> >>+static void set_pchan_interrupt(struct sun4i_dma_dev *priv,
> >>+ struct sun4i_dma_pchan *pchan,
> >>+ int half, int end)
> >>+{
> >>+ u32 reg = readl_relaxed(priv->base + DMA_IRQ_ENABLE_REG);
> >>+ int pchan_number = pchan - priv->pchans;
> >>+
> >>+ if (half)
> >>+ reg |= BIT(pchan_number * 2);
> >>+ else
> >>+ reg &= ~BIT(pchan_number * 2);
> >>+
> >>+ if (end)
> >>+ reg |= BIT(pchan_number * 2 + 1);
> >>+ else
> >>+ reg &= ~BIT(pchan_number * 2 + 1);
> >>+
> >>+ writel_relaxed(reg, priv->base + DMA_IRQ_ENABLE_REG);
> >
> >I don't see any interrupts here.
>
> Hm?
I'm not sure, but I think I meant spinlocks, it doesn't make much
sense otherwise.
> >>+ for_each_sg(sgl, sg, sg_len, i) {
> >>+ /* Figure out addresses */
> >>+ if (dir == DMA_MEM_TO_DEV) {
> >>+ srcaddr = sg_dma_address(sg);
> >>+ dstaddr = sconfig->dst_addr;
> >>+ } else {
> >>+ srcaddr = sconfig->src_addr;
> >>+ dstaddr = sg_dma_address(sg);
> >>+ }
> >>+
> >>+ /* TODO: should this be configurable? */
> >>+ para = DDMA_MAGIC_SPI_PARAMETERS;
> >
> >What is it? Is it supposed to change from one client device to
> >another?
>
> These are the magic DMA engine timings that keep SPI going. I
> haven't seen any interface on DMAEngine to configure timings, and so
> far they seem to work for everything we support, so I've kept them
> here. I don't know if other devices need different timings because,
> as usual, we only have the "para" bitfield meanings, but no comment
> on what the values should be when doing a certain operation :|
If it works for everything you tested so far, I guess you can leave it
that way, only adding what you just replied to the TODO.
> >>+static enum dma_status sun4i_dma_tx_status(struct dma_chan *chan,
> >>+ dma_cookie_t cookie,
> >>+ struct dma_tx_state *state)
> >>+{
> >>+ struct sun4i_dma_vchan *vchan = to_sun4i_dma_vchan(chan);
> >>+ struct sun4i_dma_pchan *pchan = vchan->pchan;
> >>+ struct sun4i_dma_contract *contract;
> >>+ struct sun4i_dma_promise *promise;
> >>+ struct virt_dma_desc *vd;
> >>+ unsigned long flags;
> >>+ enum dma_status ret;
> >>+ size_t bytes = 0;
> >>+
> >>+ ret = dma_cookie_status(chan, cookie, state);
> >>+ if (ret == DMA_COMPLETE)
> >>+ return ret;
> >>+
> >>+ spin_lock_irqsave(&vchan->vc.lock, flags);
> >>+ vd = vchan_find_desc(&vchan->vc, cookie);
> >>+ if (!vd) /* TODO */
> >
> >TODO what?
> >
>
> /* TODO: remove the TODO */
:)
Thanks!
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140724/1d013a68/attachment.sig>
next prev parent reply other threads:[~2014-07-24 8:53 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-06 4:05 [PATCH v2 0/8] DMAEngine support for sun4i, sun5i & sun7i Emilio López
2014-07-06 4:05 ` [PATCH v2 1/8] dma: sun4i: Add support for the DMA engine on sun[457]i SoCs Emilio López
2014-07-07 7:41 ` Chen-Yu Tsai
2014-07-08 19:09 ` jonsmirl at gmail.com
2014-07-17 20:56 ` Maxime Ripard
2014-07-17 21:45 ` Emilio López
2014-07-24 8:53 ` Maxime Ripard [this message]
2014-07-06 4:05 ` [PATCH v2 2/8] spi: sun4i: add DMA support Emilio López
2014-07-06 22:49 ` Emilio López
2014-07-10 12:22 ` Maxime Ripard
2014-07-10 16:20 ` Emilio López
2014-07-06 4:05 ` [PATCH v2 3/8] ARM: sun4i: Add node to represent the DMA controller Emilio López
2014-07-07 7:35 ` Chen-Yu Tsai
2014-07-06 4:05 ` [PATCH v2 4/8] ARM: sun5i: Add nodes to represent the DMA controllers Emilio López
2014-07-07 7:35 ` Chen-Yu Tsai
2014-07-06 4:05 ` [PATCH v2 5/8] ARM: sun7i: Add node to represent the DMA controller Emilio López
2014-07-07 7:34 ` Chen-Yu Tsai
2014-07-06 4:05 ` [PATCH v2 6/8] ARM: sun4i: enable DMA on SPI Emilio López
2014-07-07 7:33 ` Chen-Yu Tsai
2014-07-06 4:05 ` [PATCH v2 7/8] ARM: sun5i: " Emilio López
2014-07-07 7:33 ` Chen-Yu Tsai
2014-07-06 4:05 ` [PATCH v2 8/8] ARM: sun7i: " Emilio López
2014-07-07 7:32 ` Chen-Yu Tsai
2014-07-06 4:05 ` [PATCH v2 9/8] ARM: sun4i: cubieboard: add an SPIdev device for testing Emilio López
2014-07-06 4:05 ` [PATCH v2 10/8] ARM: sun7i: cubietruck: " Emilio López
2014-07-06 15:21 ` Sergei Shtylyov
2014-07-06 17:30 ` Emilio López
2014-07-07 9:39 ` Maxime Ripard
2014-07-06 4:05 ` [PATCH v2 11/8] ARM: sun5i: a10s-olinuxino-micro: " Emilio López
2014-07-08 14:13 ` [PATCH v2 0/8] DMAEngine support for sun4i, sun5i & sun7i jonsmirl at gmail.com
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=20140724085309.GR20328@lukather \
--to=maxime.ripard@free-electrons.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 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.