All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Ball <cjb@laptop.org>
To: Philip Rakity <prakity@marvell.com>
Cc: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	Mark Brown <markb@marvell.com>
Subject: Re: [PATCH] mmc: mmc.c check if mmc cards < 2GB do sector addressing
Date: Thu, 24 Feb 2011 19:12:00 +0000	[thread overview]
Message-ID: <20110224191200.GB11663@void.printf.net> (raw)
In-Reply-To: <4CC152D1-81A6-4AA7-B382-E45A22116E24@marvell.com>

Hi Philip,

On Sun, Feb 13, 2011 at 11:13:09PM -0800, Philip Rakity wrote:
> 
> Some TOSHIBA MMC cards only support sector addressing
> even though the size is < 2GB.  According to JEDEC
> Spec JESD84-A441-1 the ocr register (bits 30, 29)
> determine byte/sector mode.  Use them.
> 
> Signed-off-by: Philip Rakity <prakity@marvell.com>
> ---
>  drivers/mmc/core/mmc.c |   10 +++++++++-
>  1 files changed, 9 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 6396c5d..6c5d3d4 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -421,6 +421,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
>  	int err, ddr = 0;
>  	u32 cid[4];
>  	unsigned int max_dtr;
> +	u32 rocr;
>  
>  	BUG_ON(!host);
>  	WARN_ON(!host->claimed);
> @@ -434,7 +435,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
>  	mmc_go_idle(host);
>  
>  	/* The extra bit indicates that we support high capacity */
> -	err = mmc_send_op_cond(host, ocr | (1 << 30), NULL);
> +	err = mmc_send_op_cond(host, ocr | (1 << 30), &rocr);
>  	if (err)
>  		goto err;
>  
> @@ -522,6 +523,13 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
>  		err = mmc_read_ext_csd(card);
>  		if (err)
>  			goto free_card;
> +
> +		/* if doing byte addressing check if required to do sector */
> +		/* addressing.  Handle case of cards < 2GB needing sector */
> +		/* addressing.  See section 8.1 JEDEC Standard JED84-A441 */
> +		/* ocr register has bit 30 set for sector addressing */
> +		if (!(mmc_card_blockaddr(card)) && (rocr & (1<<30)))
> +			mmc_card_set_blockaddr(card);
>  		/* Erase size depends on CSD and Extended CSD */
>  		mmc_set_erase_size(card);
>  	}

Thanks, pushed to mmc-next for .39.

-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

      reply	other threads:[~2011-02-24 19:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-14  7:13 [PATCH] mmc: mmc.c check if mmc cards < 2GB do sector addressing Philip Rakity
2011-02-24 19:12 ` Chris Ball [this message]

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=20110224191200.GB11663@void.printf.net \
    --to=cjb@laptop.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=markb@marvell.com \
    --cc=prakity@marvell.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 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.