linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Dong, Chuanxiao" <chuanxiao.dong@intel.com>
To: Kyungmin Park <kmpark@infradead.org>
Cc: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"cjb@laptop.org" <cjb@laptop.org>,
	"arjan@linux.intel.com" <arjan@linux.intel.com>,
	"alan@linux.intel.com" <alan@linux.intel.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Subject: RE: [PATCH v4 1/4]enable HW reset capbility
Date: Thu, 9 Dec 2010 14:10:53 +0800	[thread overview]
Message-ID: <5D8008F58939784290FAB48F549751983263F995EC@shsmsx502.ccr.corp.intel.com> (raw)
In-Reply-To: <AANLkTincey6stwEhyK1ZRwcp5eUzC73GQv6Q_We=+gcX@mail.gmail.com>



> -----Original Message-----
> From: kyungmin78@gmail.com [mailto:kyungmin78@gmail.com] On Behalf Of
> Kyungmin Park
> Sent: Thursday, December 09, 2010 2:05 PM
> To: Dong, Chuanxiao
> Cc: linux-mmc@vger.kernel.org; linux-kernel@vger.kernel.org; cjb@laptop.org;
> arjan@linux.intel.com; alan@linux.intel.com; akpm@linux-foundation.org
> Subject: Re: [PATCH v4 1/4]enable HW reset capbility
> 
> On Thu, Dec 9, 2010 at 2:40 PM, Dong, Chuanxiao
> <chuanxiao.dong@intel.com> wrote:
> >
> >
> >> -----Original Message-----
> >> From: kyungmin78@gmail.com [mailto:kyungmin78@gmail.com] On Behalf Of
> >> Kyungmin Park
> >> Sent: Thursday, December 09, 2010 1:24 PM
> >> To: Dong, Chuanxiao
> >> Cc: linux-mmc@vger.kernel.org; linux-kernel@vger.kernel.org; cjb@laptop.org;
> >> arjan@linux.intel.com; alan@linux.intel.com; akpm@linux-foundation.org
> >> Subject: Re: [PATCH v4 1/4]enable HW reset capbility
> >>
> >> On Wed, Dec 1, 2010 at 9:49 PM, Chuanxiao Dong <chuanxiao.dong@intel.com>
> >> wrote:
> >> > From d3be0b4fe8e8a40294830dfd8d0543d1e957fd29 Mon Sep 17 00:00:00
> 2001
> >> > From: Chuanxiao Dong <chuanxiao.dong@intel.com>
> >> > Date: Wed, 1 Dec 2010 19:14:02 +0800
> >> > Subject: [PATCH 1/4] enable HW reset caps of MMC card if card supports
> >> >
> >> > HW reset capbility enable bit is byte 162 in card EXT_CSD
> >> > register, only version4.4 card or later can support to enable
> >> > this feature.
> >> >
> >> > HW reset feature can be used to reset eMMC card when occures
> >> > timeout errors during read/write/erase.
> >> >
> >> > Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
> >> > ---
> >> >  drivers/mmc/core/mmc.c   |   29 +++++++++++++++++++++++++++++
> >> >  include/linux/mmc/card.h |    1 +
> >> >  include/linux/mmc/mmc.h  |    1 +
> >> >  3 files changed, 31 insertions(+), 0 deletions(-)
> >> >
> >> > diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> >> > index 77f93c3..85cc7f6 100644
> >> > --- a/drivers/mmc/core/mmc.c
> >> > +++ b/drivers/mmc/core/mmc.c
> >> > @@ -310,6 +310,10 @@ static int mmc_read_ext_csd(struct mmc_card
> *card)
> >> >                        ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT];
> >> >                card->ext_csd.trim_timeout = 300 *
> >> >                        ext_csd[EXT_CSD_TRIM_MULT];
> >> > +               /*
> >> > +                * check Hardware reset cap
> >> Check hardware.
> >> > +                */
> >> > +               card->ext_csd.rst = ext_csd[EXT_CSD_RST];
> >> >        }
> >> >
> >> >        if (ext_csd[EXT_CSD_ERASED_MEM_CONT])
> >> > @@ -484,6 +488,31 @@ static int mmc_init_card(struct mmc_host *host,
> u32
> >> ocr,
> >> >        }
> >> >
> >> >        /*
> >> > +        * eMMC4.4 version card has HW reset capbility.
> >> capability.
> >> > +        * Enable this feature here:
> >> > +        * RST_N_FUNCTION register is W/R, one time programmable
> >> Use RST_n_FUNCTION as spec.
> >> > +        * or readable.
> >> > +        * So need to enable this register only once after power on
> >> > +        */
> >> > +       if (card->csd.mmca_vsn >= CSD_SPEC_VER_4 &&
> >> > +                       card->ext_csd.rev >= 4 &&
> >> it should be card->ext_csd.rev >= 5 since 4 is obsolete.
> >>
> >> Thank you,
> >> Kyungmin Park
> >
> > Thanks, Park. I will fix this.
> > And by the way, I noticed mmc_read_ext_csd function also used
> card->ext_csd.rev >=4. Is there some other reason for this kind of using? Or it is
> just because at that time the value 4 has not be obsolete yet....?
> 
> Maybe need to fix it also.
> 
> And remaining patches also need to fix 'capability' typo.
Thanks. Will pay more attention on this. And will resubmit new version for review. Thanks


> >> > +                       card->ext_csd.rst == 0) {
> >> > +               err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
> >> > +                               EXT_CSD_RST, 1);
> >> > +
> >> > +               if (err && err != -EBADMSG)
> >> > +                       goto free_card;
> >> > +
> >> > +               if (err) {
> >> > +                       printk(KERN_WARNING "%s: switch to rst
> enable
> >> "
> >> > +                                  "failed %d\n",
> >> > +                                  mmc_hostname(card->host),
> err);
> >> > +                       err = 0;
> >> > +               } else
> >> > +                       card->ext_csd.rst = 1;
> >> > +       }
> >> > +
> >> > +       /*
> >> >         * Activate high speed (if supported)
> >> >         */
> >> >        if ((card->ext_csd.hs_max_dtr != 0) &&
> >> > diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
> >> > index 8ce0827..ebee676 100644
> >> > --- a/include/linux/mmc/card.h
> >> > +++ b/include/linux/mmc/card.h
> >> > @@ -54,6 +54,7 @@ struct mmc_ext_csd {
> >> >        unsigned int            sec_trim_mult;  /* Secure trim
> >> multiplier  */
> >> >        unsigned int            sec_erase_mult; /* Secure erase
> multiplier
> >> */
> >> >        unsigned int            trim_timeout;           /* In
> >> milliseconds */
> >> > +       unsigned int            rst; /* hardware reset enable bit */
> >> >  };
> >> >
> >> >  struct sd_scr {
> >> > diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
> >> > index 956fbd8..b7ab0da 100644
> >> > --- a/include/linux/mmc/mmc.h
> >> > +++ b/include/linux/mmc/mmc.h
> >> > @@ -251,6 +251,7 @@ struct _mmc_csd {
> >> >  * EXT_CSD fields
> >> >  */
> >> >
> >> > +#define EXT_CSD_RST            162     /* onetime programmable
> R/W
> >> */
> >> >  #define EXT_CSD_ERASE_GROUP_DEF                175     /*
> R/W */
> >> >  #define EXT_CSD_ERASED_MEM_CONT                181     /*
> RO */
> >> >  #define EXT_CSD_BUS_WIDTH              183     /* R/W */
> >> > --
> >> > 1.6.6.1
> >> >
> >> > --
> >> > To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> >> > the body of a message to majordomo@vger.kernel.org
> >> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >

      reply	other threads:[~2010-12-09  6:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-01 12:49 [PATCH v4 1/4]enable HW reset capbility Chuanxiao Dong
2010-12-09  5:24 ` Kyungmin Park
2010-12-09  5:40   ` Dong, Chuanxiao
2010-12-09  6:05     ` Kyungmin Park
2010-12-09  6:10       ` Dong, Chuanxiao [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=5D8008F58939784290FAB48F549751983263F995EC@shsmsx502.ccr.corp.intel.com \
    --to=chuanxiao.dong@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@linux.intel.com \
    --cc=arjan@linux.intel.com \
    --cc=cjb@laptop.org \
    --cc=kmpark@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.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).