LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Chris Ball <cjb@laptop.org>
Cc: Matt Fleming <matt@console-pimps.org>,
	linux-mmc@vger.kernel.org, Will Newton <will.newton@gmail.com>,
	linux-arm-kernel@lists.infradead.org,
	Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] dw_mmc: Add Synopsys DesignWare mmc host driver.
Date: Sun, 12 Dec 2010 11:15:45 +0000	[thread overview]
Message-ID: <20101212111545.GE8665@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20101212084135.GC8665@n2100.arm.linux.org.uk>

On Sun, Dec 12, 2010 at 08:41:36AM +0000, Russell King - ARM Linux wrote:
> On Sat, Dec 11, 2010 at 07:23:20PM +0000, Chris Ball wrote:
> > Hi Will,
> > 
> > On Thu, Dec 09, 2010 at 05:24:26PM +0000, Will Newton wrote:
> > > This adds the mmc host driver for the Synopsys DesignWare mmc
> > > host controller, found in a number of embedded SoC designs.
> > > 
> > > Signed-off-by: Will Newton <will.newton@imgtec.com>
> > > Reviewed-by: Matt Fleming <matt@console-pimps.org>
> > 
> > Running a test build on ARM fails:
> > 
> > drivers/mmc/host/dw_mmc.c: In function ‘dw_mci_push_data64’:
> > drivers/mmc/host/dw_mmc.c:985: error: implicit declaration of function ‘__raw_writeq’
> > drivers/mmc/host/dw_mmc.c: In function ‘dw_mci_pull_data64’:
> > drivers/mmc/host/dw_mmc.c:998: error: implicit declaration of function ‘__raw_readq’
> > 
> > because arch/arm doesn't implement raw versions of these 64-bit accesses.
> > I'm surprised that this driver hasn't been compiled on ARM before!  What
> > kind of arch are you testing on?  Do you have any ARM hardware (lpc313x?)
> > to verify the driver on?
> 
> What's the semantics of a 64-bit IO access?  Does the low 32-bit get
> written before the high 32-bit, or is it the other way around?  Does
> it depend on the endian-ness?  What if some hardware needs the low
> 32-bit first and other needs the high 32-bit first?
> 
> I don't think it's reasonable to expect 32-bit hardware to perform 64-bit
> IO accesses.

I should cover something else here, in anticipation of someone trying
to be clever...

Using ldrd/strd, or ldm/stm for IO accesses on ARM is a very bad idea
for generic code.  While nothing prevents you from using these for 64-bit
IO accesses, you have to be aware that the normal access guarantees do
not apply.

ldrd/strd is implemented as two individual 32-bit single-access operations,
each of which is atomic, and therefore the instruction can be interrupted
half-way through.  Upon restart, it can repeat the first load/store.

If you're accessing a FIFO, repeated accesses will be a problem, and
will cause data corrpution.  If you're accessing a control register,
the first write could have a side effect (eg, starting DMA) before the
second write has occurred (eg, setting DMA parameters.)

So, even with ldrd/strd, you still have the problem of whether the
64-bit access can be split into two separate 32-bit accesses safely,
but you also have the problem that the individual 32-bit accesses may
be repeated.

You're safer using standard 32-bit load/stores, which won't suffer
from being repeated - but you still have to decide whether high-word
first or low-word first is the correct transfer order.

  reply	other threads:[~2010-12-12 11:16 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-06 15:53 [RESEND PATCH] " Will Newton
2010-12-08 11:55 ` Matt Fleming
2010-12-08 13:14   ` Will Newton
2010-12-08 14:21     ` [PATCH] " Will Newton
2010-12-08 16:07       ` Matt Fleming
2010-12-09  6:47       ` Chris Ball
2010-12-09 12:11         ` Will Newton
2010-12-09 16:01           ` Chris Ball
2010-12-09 17:24             ` Will Newton
     [not found]               ` <20101211192320.GA24430@void.printf.net>
2010-12-12  8:41                 ` Russell King - ARM Linux
2010-12-12 11:15                   ` Russell King - ARM Linux [this message]
2010-12-12 10:57                 ` Will Newton
2010-12-12 13:52                   ` Chris Ball
2010-12-12 14:03                     ` Will Newton
2010-12-12 14:11                       ` Russell King - ARM Linux
2010-12-12 14:31                         ` Will Newton
2010-12-12 14:47                           ` Russell King - ARM Linux
2010-12-12 15:17                             ` Will Newton
2010-12-16 17:04                 ` [PATCH v4] " Will Newton
2011-01-02  6:20                   ` Chris Ball
2011-01-18  7:54                   ` Jaehoon Chung
2011-01-18 10:21                     ` Will Newton
2011-02-08  6:38                       ` Jaehoon Chung
2011-02-08 10:29                         ` Will Newton
2011-02-08 10:49                           ` Jaehoon Chung
2011-02-08 12:06                             ` Will Newton
2010-12-09 17:35             ` [PATCH] " Chris Ball
2010-12-09 17:46               ` Will Newton
  -- strict thread matches above, loose matches on Subject: below --
2010-11-29 17:35 Will Newton

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=20101212111545.GE8665@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=cjb@laptop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=matt@console-pimps.org \
    --cc=will.newton@gmail.com \
    --subject='Re: [PATCH] dw_mmc: Add Synopsys DesignWare mmc host driver.' \
    /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

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).