All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Drake <dan@reactivated.net>
To: Pierre Ossman <drzeus-list@drzeus.cx>
Cc: Matt Reimer <mattjreimer@gmail.com>,
	linux-kernel@vger.kernel.org, rmk+lkml@arm.linux.org.uk
Subject: Re: 2GB MMC/SD cards
Date: Sun, 13 Aug 2006 11:14:57 +0100	[thread overview]
Message-ID: <44DEFBA1.6060500@reactivated.net> (raw)
In-Reply-To: <4488AC57.7050201@drzeus.cx>

Hi Pierre,

Pierre Ossman wrote:
> Suggested patch included.

What's the status on this patch? A Gentoo user at 
http://bugs.gentoo.org/142172 reports that it is required for him to be 
able to access his card, so it definitely works in some form.

> 
> [MMC] Always use a sector size of 512 bytes
> 
> Both MMC and SD specifications specify (although a bit unclearly in the MMC
> case) that a sector size of 512 bytes must always be supported by the card.
> 
> Cards can report larger "native" size than this, and cards >= 2 GB even
> must do so. Most other readers use 512 bytes even for these cards. We should
> do the same to be compatible.
> 
> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
> ---
> 
>  drivers/mmc/mmc_block.c |   49 ++++-------------------------------------------
>  1 files changed, 4 insertions(+), 45 deletions(-)
> 
> diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c
> index 587458b..96049e2 100644
> --- a/drivers/mmc/mmc_block.c
> +++ b/drivers/mmc/mmc_block.c
> @@ -325,52 +325,11 @@ static struct mmc_blk_data *mmc_blk_allo
>  	md->read_only = mmc_blk_readonly(card);
>  
>  	/*
> -	 * Figure out a workable block size.  MMC cards have:
> -	 *  - two block sizes, one for read and one for write.
> -	 *  - may support partial reads and/or writes
> -	 *    (allows block sizes smaller than specified)
> +	 * Both SD and MMC specifications state (although a bit
> +	 * unclearly in the MMC case) that a block size of 512
> +	 * bytes must always be supported by the card.
>  	 */
> -	md->block_bits = card->csd.read_blkbits;
> -	if (card->csd.write_blkbits != card->csd.read_blkbits) {
> -		if (card->csd.write_blkbits < card->csd.read_blkbits &&
> -		    card->csd.read_partial) {
> -			/*
> -			 * write block size is smaller than read block
> -			 * size, but we support partial reads, so choose
> -			 * the smaller write block size.
> -			 */
> -			md->block_bits = card->csd.write_blkbits;
> -		} else if (card->csd.write_blkbits > card->csd.read_blkbits &&
> -			   card->csd.write_partial) {
> -			/*
> -			 * read block size is smaller than write block
> -			 * size, but we support partial writes.  Use read
> -			 * block size.
> -			 */
> -		} else {
> -			/*
> -			 * We don't support this configuration for writes.
> -			 */
> -			printk(KERN_ERR "%s: unable to select block size for "
> -				"writing (rb%u wb%u rp%u wp%u)\n",
> -				mmc_card_id(card),
> -				1 << card->csd.read_blkbits,
> -				1 << card->csd.write_blkbits,
> -				card->csd.read_partial,
> -				card->csd.write_partial);
> -			md->read_only = 1;
> -		}
> -	}
> -
> -	/*
> -	 * Refuse to allow block sizes smaller than 512 bytes.
> -	 */
> -	if (md->block_bits < 9) {
> -		printk(KERN_ERR "%s: unable to support block size %u\n",
> -			mmc_card_id(card), 1 << md->block_bits);
> -		ret = -EINVAL;
> -		goto err_kfree;
> -	}
> +	md->block_bits = 9;
>  
>  	md->disk = alloc_disk(1 << MMC_SHIFT);
>  	if (md->disk == NULL) {


  parent reply	other threads:[~2006-08-13 10:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-29 14:00 2GB MMC/SD cards Pierre Ossman
2006-06-03 14:15 ` Russell King
2006-06-03 15:02   ` Russell King
2006-06-03 18:40   ` Matt Reimer
2006-06-03 21:13     ` Pierre Ossman
2006-06-05 22:29       ` Jordan Crouse
2006-06-06  7:17         ` Richard Purdie
2006-06-05 22:52       ` Pierre Ossman
2006-06-07  9:08         ` Pierre Ossman
2006-06-07 16:58           ` Russell King
2006-06-07 20:36             ` Pierre Ossman
2006-06-08 23:01               ` Pierre Ossman
2006-06-22 15:08                 ` Marcin Juszkiewicz
2006-08-13 10:14                 ` Daniel Drake [this message]
2006-08-22 15:19                   ` Juha Yrjola
2006-08-22 17:00                     ` Jeff Chua
2006-08-23 18:28                     ` Pierre Ossman
2006-08-25  9:07                     ` Russell King
2006-06-03 21:11   ` Pierre Ossman

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=44DEFBA1.6060500@reactivated.net \
    --to=dan@reactivated.net \
    --cc=drzeus-list@drzeus.cx \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mattjreimer@gmail.com \
    --cc=rmk+lkml@arm.linux.org.uk \
    /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.