linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: zhangfei gao <zhangfei.gao@gmail.com>
To: Arindam Nath <arindam.nath@amd.com>
Cc: cjb@laptop.org, prakity@marvell.com, subhashj@codeaurora.org,
	linux-mmc@vger.kernel.org, henry.su@amd.com, aaron.lu@amd.com,
	anath.amd@gmail.com
Subject: Re: [PATCH v4 07/15] mmc: sd: report correct speed and capacity of uhs cards
Date: Fri, 6 May 2011 06:39:24 -0400	[thread overview]
Message-ID: <BANLkTinm0o4ehPNkv58PqW0g8C5QbVwC6Q@mail.gmail.com> (raw)
In-Reply-To: <1304578151-1775-8-git-send-email-arindam.nath@amd.com>

On Thu, May 5, 2011 at 2:49 AM, Arindam Nath <arindam.nath@amd.com> wrote:
> Since only UHS-I cards respond with S18A set in response to ACMD41,
> we set the card as ultra-high-speed after successfull initialization.
> We need to decide whether a card is SDXC based on the C_SIZE field
> of CSDv2.0 register. According to Physical Layer spec v3.01, the
> minimum value of C_SIZE for SDXC card is 00FFFFh.
>
> Signed-off-by: Arindam Nath <arindam.nath@amd.com>
> Reviewed-by: Philip Rakity <prakity@marvell.com>
> Tested-by: Philip Rakity <prakity@marvell.com>

Acked-by: Zhangfei Gao<zhangfei.gao@marvell.com>
Verified with Toshiba uhs card and general hs card,   on mmp2 in SDMA mode.
> ---
>  drivers/mmc/core/bus.c   |   11 ++++++++---
>  drivers/mmc/core/sd.c    |   10 +++++++++-
>  include/linux/mmc/card.h |    7 +++++++
>  3 files changed, 24 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
> index d6d62fd..393d817 100644
> --- a/drivers/mmc/core/bus.c
> +++ b/drivers/mmc/core/bus.c
> @@ -274,8 +274,12 @@ int mmc_add_card(struct mmc_card *card)
>                break;
>        case MMC_TYPE_SD:
>                type = "SD";
> -               if (mmc_card_blockaddr(card))
> -                       type = "SDHC";
> +               if (mmc_card_blockaddr(card)) {
> +                       if (mmc_card_ext_capacity(card))
> +                               type = "SDXC";
> +                       else
> +                               type = "SDHC";
> +               }
>                break;
>        case MMC_TYPE_SDIO:
>                type = "SDIO";
> @@ -299,7 +303,8 @@ int mmc_add_card(struct mmc_card *card)
>        } else {
>                printk(KERN_INFO "%s: new %s%s%s card at address %04x\n",
>                        mmc_hostname(card->host),
> -                       mmc_card_highspeed(card) ? "high speed " : "",
> +                       mmc_sd_card_uhs(card) ? "ultra high speed " :
> +                       (mmc_card_highspeed(card) ? "high speed " : ""),
>                        mmc_card_ddr_mode(card) ? "DDR " : "",
>                        type, card->rca);
>        }
> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
> index 9270d82..ee32dd8 100644
> --- a/drivers/mmc/core/sd.c
> +++ b/drivers/mmc/core/sd.c
> @@ -130,7 +130,7 @@ static int mmc_decode_csd(struct mmc_card *card)
>                break;
>        case 1:
>                /*
> -                * This is a block-addressed SDHC card. Most
> +                * This is a block-addressed SDHC or SDXC card. Most
>                 * interesting fields are unused and have fixed
>                 * values. To avoid getting tripped by buggy cards,
>                 * we assume those fixed values ourselves.
> @@ -144,6 +144,11 @@ static int mmc_decode_csd(struct mmc_card *card)
>                e = UNSTUFF_BITS(resp, 96, 3);
>                csd->max_dtr      = tran_exp[e] * tran_mant[m];
>                csd->cmdclass     = UNSTUFF_BITS(resp, 84, 12);
> +               csd->c_size       = UNSTUFF_BITS(resp, 48, 22);
> +
> +               /* SDXC cards have a minimum C_SIZE of 0x00FFFF */
> +               if (csd->c_size >= 0xFFFF)
> +                       mmc_card_set_ext_capacity(card);
>
>                m = UNSTUFF_BITS(resp, 48, 22);
>                csd->capacity     = (1 + m) << 10;
> @@ -917,6 +922,9 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
>                err = mmc_sd_init_uhs_card(card);
>                if (err)
>                        goto free_card;
> +
> +               /* Card is an ultra-high-speed card */
> +               mmc_sd_card_set_uhs(card);
>        } else {
>                /*
>                 * Attempt to change to high-speed (if supported)
> diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
> index 47b5ad3..d8dffc9 100644
> --- a/include/linux/mmc/card.h
> +++ b/include/linux/mmc/card.h
> @@ -30,6 +30,7 @@ struct mmc_csd {
>        unsigned short          cmdclass;
>        unsigned short          tacc_clks;
>        unsigned int            tacc_ns;
> +       unsigned int            c_size;
>        unsigned int            r2w_factor;
>        unsigned int            max_dtr;
>        unsigned int            erase_size;             /* In sectors */
> @@ -158,6 +159,8 @@ struct mmc_card {
>  #define MMC_STATE_HIGHSPEED    (1<<2)          /* card is in high speed mode */
>  #define MMC_STATE_BLOCKADDR    (1<<3)          /* card uses block-addressing */
>  #define MMC_STATE_HIGHSPEED_DDR (1<<4)         /* card is in high speed mode */
> +#define MMC_STATE_ULTRAHIGHSPEED (1<<5)                /* card is in ultra high speed mode */
> +#define MMC_CARD_SDXC          (1<<6)          /* card is SDXC */
>        unsigned int            quirks;         /* card quirks */
>  #define MMC_QUIRK_LENIENT_FN0  (1<<0)          /* allow SDIO FN0 writes outside of the VS CCCR range */
>  #define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1)   /* use func->cur_blksize */
> @@ -293,12 +296,16 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data)
>  #define mmc_card_highspeed(c)  ((c)->state & MMC_STATE_HIGHSPEED)
>  #define mmc_card_blockaddr(c)  ((c)->state & MMC_STATE_BLOCKADDR)
>  #define mmc_card_ddr_mode(c)   ((c)->state & MMC_STATE_HIGHSPEED_DDR)
> +#define mmc_sd_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED)
> +#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC)
>
>  #define mmc_card_set_present(c)        ((c)->state |= MMC_STATE_PRESENT)
>  #define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
>  #define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED)
>  #define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR)
>  #define mmc_card_set_ddr_mode(c) ((c)->state |= MMC_STATE_HIGHSPEED_DDR)
> +#define mmc_sd_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED)
> +#define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC)
>
>  static inline int mmc_card_lenient_fn0(const struct mmc_card *c)
>  {
> --
> 1.7.1
>
>

  reply	other threads:[~2011-05-06 10:39 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-05  6:48 [PATCH v4 00/15] add support for host controller v3.00 Arindam Nath
2011-05-05  6:48 ` [PATCH v4 01/15] mmc: sd: add support for signal voltage switch procedure Arindam Nath
2011-05-06 10:36   ` zhangfei gao
2011-05-11  3:34   ` Chris Ball
2011-05-05  6:48 ` [PATCH v4 02/15] mmc: sd: query function modes for uhs cards Arindam Nath
2011-05-06 10:37   ` zhangfei gao
2011-05-11  3:34   ` Chris Ball
2011-05-05  6:48 ` [PATCH v4 03/15] mmc: sd: add support for driver type selection Arindam Nath
2011-05-06 10:37   ` zhangfei gao
2011-05-11  3:34   ` Chris Ball
2011-05-05  6:49 ` [PATCH v4 04/15] mmc: sdhci: reset sdclk before setting high speed enable Arindam Nath
2011-05-06 10:38   ` zhangfei gao
2011-05-11  3:36   ` Chris Ball
2011-05-05  6:49 ` [PATCH v4 05/15] mmc: sd: add support for uhs bus speed mode selection Arindam Nath
2011-05-06 10:41   ` zhangfei gao
2011-05-11  3:36   ` Chris Ball
2011-05-05  6:49 ` [PATCH v4 06/15] mmc: sd: set current limit for uhs cards Arindam Nath
2011-05-06 10:38   ` zhangfei gao
2011-05-11  3:37   ` Chris Ball
2011-05-05  6:49 ` [PATCH v4 07/15] mmc: sd: report correct speed and capacity of " Arindam Nath
2011-05-06 10:39   ` zhangfei gao [this message]
2011-05-11  3:37   ` Chris Ball
2011-05-05  6:49 ` [PATCH v4 08/15] mmc: sd: add support for tuning during uhs initialization Arindam Nath
2011-05-06 10:39   ` zhangfei gao
2011-05-11  3:38   ` Chris Ball
2011-05-05  6:49 ` [PATCH v4 09/15] mmc: sdhci: enable preset value after " Arindam Nath
2011-05-06 10:40   ` zhangfei gao
2011-05-11  3:38   ` Chris Ball
2011-05-05  6:49 ` [PATCH v4 10/15] mmc: sdhci: add support for programmable clock mode Arindam Nath
2011-05-06 10:40   ` zhangfei gao
2011-05-11  3:39   ` Chris Ball
2011-05-05  6:49 ` [PATCH v4 11/15] mmc: sdhci: add support for retuning mode 1 Arindam Nath
2011-05-06 10:40   ` zhangfei gao
2011-05-11  3:39   ` Chris Ball
2011-05-05  6:49 ` [PATCH v4 12/15] sdhci pxa add platform specific code for UHS signaling Arindam Nath
2011-05-11  1:54   ` Chris Ball
2011-05-11  8:48   ` zhangfei gao
2011-05-11  8:52     ` Philip Rakity
2011-05-11  9:28       ` zhangfei gao
2011-05-11  9:47         ` Philip Rakity
2011-05-12  1:53           ` Philip Rakity
2011-05-13  8:03           ` zhangfei gao
2011-05-15 21:42             ` Philip Rakity
2011-05-16  5:57               ` zhangfei gao
2011-05-05  6:49 ` [PATCH v4 13/15] mmc eMMC signal voltage does not use CMD11 Arindam Nath
2011-05-11  1:51   ` Chris Ball
2011-05-11  9:19   ` zhangfei gao
2011-05-11 15:01     ` Philip Rakity
2011-05-12  1:53       ` Philip Rakity
2011-05-05  6:49 ` [PATCH v4 14/15] sdhci add hooks for UHS setting by platform specific code Arindam Nath
2011-05-05  6:49 ` [PATCH v4 15/15] mmc add support for eMMC Dual Data Rate Arindam Nath
2011-05-05  8:18 ` [PATCH v4 00/15] add support for host controller v3.00 Nath, Arindam
2011-05-11  3:43 ` Chris Ball
2011-05-11  6:13   ` Nath, Arindam

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=BANLkTinm0o4ehPNkv58PqW0g8C5QbVwC6Q@mail.gmail.com \
    --to=zhangfei.gao@gmail.com \
    --cc=aaron.lu@amd.com \
    --cc=anath.amd@gmail.com \
    --cc=arindam.nath@amd.com \
    --cc=cjb@laptop.org \
    --cc=henry.su@amd.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=prakity@marvell.com \
    --cc=subhashj@codeaurora.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).