public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: stefan.xk.nilsson@stericsson•com (Stefan Nilsson XK)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 1/4] mmc: mmci: Bugfix in pio read for small packets
Date: Fri, 14 Oct 2011 09:38:05 +0200	[thread overview]
Message-ID: <4E97E6DD.4030605@stericsson.com> (raw)
In-Reply-To: <20111007191128.GA25689@n2100.arm.linux.org.uk>

On 10/07/2011 09:11 PM, Russell King - ARM Linux wrote:
> But first, you need to fix your code so you're only reading 32-bit
> quantities from the FIFO register.

Hi Russel, what to you think of doing it this way instead:

		/*
		 * SDIO especially may want to send something that is
		 * not divisible by 4 (as opposed to card sectors
		 * etc), and the FIFO only accept full 32-bit reads.
		 */
		if (count < 4) {
			unsigned char buf[4];
			readsl(base + MMCIFIFO, buf, 1);
			memcpy(ptr, buf, count);
		}
		else
			readsl(base + MMCIFIFO, ptr, count >> 2);

This makes sure we only access the FIFO in a 32 bit way, and the only 
overhead for the "standard" case (count >= 4) is the "if" clause. I have 
verified this to work with our WLAN driver.

Best Regards

Stefan Nilsson

  reply	other threads:[~2011-10-14  7:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-27  7:46 [PATCH 1/4] mmc: mmci: Bugfix in pio read for small packets Ulf Hansson
2011-10-01 16:09 ` Russell King - ARM Linux
2011-10-03  7:08   ` Stefan Nilsson XK
2011-10-07 13:38     ` Ulf Hansson
2011-10-07 19:11       ` Russell King - ARM Linux
2011-10-14  7:38         ` Stefan Nilsson XK [this message]
2011-10-07 13:45   ` Ulf Hansson
2011-10-08  9:10     ` Russell King - ARM Linux
2011-10-09  6:59       ` Linus Walleij
2011-10-10  8:23         ` Ulf Hansson
2011-10-13 15:48           ` Russell King - ARM Linux
2011-10-14  8:07             ` Ulf Hansson

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=4E97E6DD.4030605@stericsson.com \
    --to=stefan.xk.nilsson@stericsson$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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