All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Johan Rudholm <johan.rudholm@axis.com>
Cc: "Johan Rudholm" <johanru@axis.com>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"Chris Ball" <chris@printf.net>,
	"Ulf Hansson" <ulf.hansson@linaro.org>,
	"Guennadi Liakhovetski" <g.liakhovetski@gmx.de>,
	"David Lanzendörfer" <david.lanzendoerfer@o2s.ch>,
	"Jesper Nilsson" <jespern@axis.com>
Subject: Re: [PATCH 2/4] mmc: core: use mmc_power_up in hw_reset
Date: Mon, 03 Nov 2014 12:59:15 +0200	[thread overview]
Message-ID: <54576003.6040100@intel.com> (raw)
In-Reply-To: <CA+20K0BQGP8TQiw_HN5pgM1cV7H8Q0Aw689jDjfpipdKJxEOTA@mail.gmail.com>

On 03/11/14 12:13, Johan Rudholm wrote:
> 2014-11-03 10:21 GMT+01:00 Adrian Hunter <adrian.hunter@intel.com>:
>> On 24/10/14 15:46, Johan Rudholm wrote:
>>> The steps performed in mmc_do_hw_reset for eMMC:s after the hardware
>>> reset are very similar to those performed by mmc_power_up, so do a call
>>
>> They perform different functions.  mmc_power_up() does nothing if the card
>> is powered up.  To share the common code you need to create a function for
>> the common functionality which is setting the initial state e.g.
>>
>> int mmc_set_initial_state(struct mmc_host *host)
>> {
>>         ...
>> }
>>
>> And call that from mmc_do_hw_reset and mmc_power_up.
> 
> Thank you for the comment. What do you think of doing a complete
> mmc_power_cycle after having performed a (successful) reset? In this
> way we can simplify the SD card reset and we don't have to break out
> the common code from mmc_power_up. Naming discussion apart, something
> like this:

I would keep the concept of hw_reset separate from how that is
implemented i.e. whether it has anything to do with power.

> 
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 486cda8..941f631 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -2236,12 +2236,15 @@ static void mmc_hw_reset_for_init(struct mmc_host *host)
>  static int mmc_do_reset(struct mmc_host *host, int check)
>  {
>         int ret;
> +       struct mmc_card *card = host->card;
> 
>         if (!host->bus_ops || !host->bus_ops->power_reset ||
>                         host->bus_ops->power_reset(host, MMC_POWER_RESET_TEST))
>                 return -EOPNOTSUPP;
> 
>         ret = host->bus_ops->power_reset(host, check);
> +       if (!ret && card)
> +               mmc_power_cycle(host, card->ocr);
> 
>         pr_warning("%s: tried to reset card (%d)\n", mmc_hostname(host), ret);
> 
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index ac5192c..900133a 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1794,8 +1794,6 @@ static int mmc_power_reset(struct mmc_host
> *host, int test)
>                 }
>         }
> 
> -       mmc_power_up(host, card->ocr);
> -
>         mmc_host_clk_release(host);
> 
>         return 0;
> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
> index 9ad46b2..d5b8ee7 100644
> --- a/drivers/mmc/core/sd.c
> +++ b/drivers/mmc/core/sd.c
> @@ -1187,8 +1187,6 @@ static int mmc_sd_power_reset(struct mmc_host
> *host, int test)
>         if (test == MMC_POWER_RESET_TEST)
>                 return 0;
> 
> -       mmc_power_cycle(host, card->ocr);
> -
>         return 0;
>  }
> 
> //Johan
> 
> 


  reply	other threads:[~2014-11-03 11:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-24 12:46 [PATCH 0/4] mmc: core: hw_reset changes Johan Rudholm
2014-10-24 12:46 ` [PATCH 1/4] mmc: core: use mmc_send_status to check hw_reset Johan Rudholm
2014-10-24 12:46 ` [PATCH 2/4] mmc: core: use mmc_power_up in hw_reset Johan Rudholm
2014-11-03  9:21   ` Adrian Hunter
2014-11-03 10:13     ` Johan Rudholm
2014-11-03 10:59       ` Adrian Hunter [this message]
2014-10-24 12:46 ` [PATCH 3/4] mmc: core: make hw_reset generic Johan Rudholm
2014-11-03  9:20   ` Adrian Hunter
2014-11-03 10:19     ` Johan Rudholm
2014-11-03 10:56       ` Adrian Hunter
2014-10-24 12:46 ` [PATCH 4/4] mmc: sd: add power_reset callback Johan Rudholm
2014-11-03  8:46 ` [PATCH 0/4] mmc: core: hw_reset changes Johan Rudholm

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=54576003.6040100@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=chris@printf.net \
    --cc=david.lanzendoerfer@o2s.ch \
    --cc=g.liakhovetski@gmx.de \
    --cc=jespern@axis.com \
    --cc=johan.rudholm@axis.com \
    --cc=johanru@axis.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.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 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.