public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Richard Zhao <richard.zhao@linaro.org>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, patches@linaro.org,
	vinod.koul@intel.com, eric.miao@linaro.org,
	kernel@pengutronix.de, dan.j.williams@intel.com,
	shawn.guo@linaro.org
Subject: Re: [PATCH v4 2/2] dma/imx-sdma: convert _raw_readl/_raw_writel to readl/writel
Date: Mon, 9 Jan 2012 11:51:43 +0000	[thread overview]
Message-ID: <20120109115143.GL21765@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1326033862-25351-3-git-send-email-richard.zhao@linaro.org>

On Sun, Jan 08, 2012 at 10:44:22PM +0800, Richard Zhao wrote:
> readl/writel is more genric. And if CONFIG_ARM_DMA_MEM_BUFFERABLE,
> they includes necessary memory barriers.

In a DMA engine driver, you need to use the barrier accessors when:

1. You finally enable the DMA engine to perform a transfer.
   The included barrier ensures that writes to the descriptors are visible
   to the DMA engine.

2. You read from a status register before examining the descriptors.
   This ensures that the descriptor accesses won't be ordered before the
   status register read.

Provided other accesses are within the same 1K region, the remainder of
them do not have to be the strictly ordered accessors, and you can use
the _relaxed variants (but only in ARM specific drivers.)

So, if your DMA engine has a control register, and a descriptor pointer
register, you can write the descriptor pointer register with a
writel_relaxed().  When you write the control register to enable the
transfer, use writel() to ensure there's a barrier so the descriptors
are visible.

  parent reply	other threads:[~2012-01-09 11:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-08 14:44 [PATCH v4 0/2] mx-sdma: memory barrier fix Richard Zhao
2012-01-08 14:44 ` [PATCH v4 1/2] dma/imx-sdma: let sdma_run_channel call sdma_enable_channel Richard Zhao
2012-01-08 14:44 ` [PATCH v4 2/2] dma/imx-sdma: convert _raw_readl/_raw_writel to readl/writel Richard Zhao
2012-01-09  1:22   ` Shawn Guo
2012-01-09 11:51   ` Russell King - ARM Linux [this message]
2012-01-09 13:25     ` Eric Miao
2012-01-09 14:12       ` Russell King - ARM Linux
2012-01-09 14:21     ` Richard Zhao
2012-01-09 14:46       ` Russell King - ARM Linux
2012-01-09 15:02         ` Richard Zhao
2012-01-09  9:33 ` [PATCH v4 0/2] mx-sdma: memory barrier fix 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=20120109115143.GL21765@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=dan.j.williams@intel.com \
    --cc=eric.miao@linaro.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@linaro.org \
    --cc=richard.zhao@linaro.org \
    --cc=shawn.guo@linaro.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