linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: s.hauer@pengutronix.de (Sascha Hauer)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] mtd mxc_nand: use 32bit copy functions
Date: Tue, 29 May 2012 11:47:40 +0200	[thread overview]
Message-ID: <20120529094740.GR30400@pengutronix.de> (raw)
In-Reply-To: <20120529093948.GG12217@n2100.arm.linux.org.uk>

On Tue, May 29, 2012 at 10:39:48AM +0100, Russell King - ARM Linux wrote:
> On Tue, May 29, 2012 at 11:36:29AM +0200, Sascha Hauer wrote:
> > On Tue, May 29, 2012 at 11:12:54AM +0200, Uwe Kleine-K?nig wrote:
> > > Hello,
> > > 
> > > On Tue, May 29, 2012 at 10:16:09AM +0200, Sascha Hauer wrote:
> > > > The following commit changes the function used to copy from/to
> > > > the hardware buffer to memcpy_[from|to]io. This does not work
> > > > since the hardware cannot handle the byte accesses used by these
> > > > functions. Instead of reverting this patch introduce 32bit
> > > > correspondents of these functions.
> > > Hmm, I didn't run an mtd test suite, but on mx27 it worked for me. IMHO
> > > it's surprising that memcpy used to work, but memcpy_fromio doesn't. I
> > > wouldn't expect a different semantic (apart from normal vs. __iomem
> > > memory). And I wonder what will break when ARM's memcpy_fromio et al.
> > > is optimized.
> > 
> > Have a look at the (ARM) implementation of memcpy_fromio:
> > 
> > void _memcpy_fromio(void *to, const volatile void __iomem *from, size_t count)
> > {
> > 	unsigned char *t = to;
> > 	while (count) {
> > 		count--;
> > 		*t = readb(from);
> > 		t++;
> > 		from++;
> > 	}
> > }
> > 
> > Appearently this uses byte accesses which do not work on NFC SRAM,
> > whereas memcpy uses optimized (so 32bit whenever possible) accesses.
> > If someone would implement an optimized version of memcpy_fromio, it
> > would work for the NFC aswell.
> > 
> > btw on i.MX27 byte accesses also do not work on NFC SRAM, so I doubt
> > this worked for you.
> 
> And then when you ask for an odd alignment or an odd number of bytes...

Then the person will get an oops and hopefully report it, which so far
did not happen. I could try and implement this, but I rather don't do
this as long as we don't know what it's used for and thus we can check
that the result is correct.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  reply	other threads:[~2012-05-29  9:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-29  8:16 [PATCH v2] mtd mxc_nand: use 32bit copy functions Sascha Hauer
2012-05-29  9:12 ` Uwe Kleine-König
2012-05-29  9:36   ` Sascha Hauer
2012-05-29  9:39     ` Russell King - ARM Linux
2012-05-29  9:47       ` Sascha Hauer [this message]
2012-06-29 11:46 ` Artem Bityutskiy
2012-07-12  6:57   ` mxc-nand fix for 3.5 (Was: Re: [PATCH v2] mtd mxc_nand: use 32bit copy functions) Uwe Kleine-König
2012-07-12  7:28     ` Woodhouse, David

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=20120529094740.GR30400@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --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 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).