All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Ziswiler <marcel@ziswiler.com>
To: Chen-Yu Tsai <wens@csie.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	linux-tegra@vger.kernel.org
Subject: Re: [PATCH 1/3] mmc: fix mmc mode selection for HS-DDR and higher
Date: Wed, 01 Jun 2016 11:19:06 +0200	[thread overview]
Message-ID: <1464772746.3079.4.camel@ziswiler.com> (raw)
In-Reply-To: <1464505484-3661-2-git-send-email-wens@csie.org>

On Sun, 2016-05-29 at 15:04 +0800, Chen-Yu Tsai wrote:
> When IS_ERR_VALUE was removed from the mmc core code, it was replaced
> with a simple not-zero check. This does not work, as the value
> checked
> is the return value for mmc_select_bus_width, which returns the set
> bit width on success. This made eMMC modes higher than HS-DDR
> unusable.
> 
> Fix this by checking for a positive return value instead.
> 
> Fixes: 287980e49ffc ("remove lots of IS_ERR_VALUE abuses")
> Cc: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

This fixes the following eMMC issue as experienced on Apalis T30 as
well:

[    7.194625] mmc1: mmc_select_hs200 failed, error 3
[    7.201549] mmc1: error 3 whilst initialising MMC card

Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

> ---
>  drivers/mmc/core/mmc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index c984321d1881..aafb73d080ca 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1276,7 +1276,7 @@ static int mmc_select_hs200(struct mmc_card
> *card)
>  	 * switch to HS200 mode if bus width is set successfully.
>  	 */
>  	err = mmc_select_bus_width(card);
> -	if (!err) {
> +	if (err > 0) {
>  		val = EXT_CSD_TIMING_HS200 |
>  		      card->drive_strength << EXT_CSD_DRV_STR_SHIFT;
>  		err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
> @@ -1583,7 +1583,7 @@ static int mmc_init_card(struct mmc_host *host,
> u32 ocr,
>  	} else if (mmc_card_hs(card)) {
>  		/* Select the desired bus width optionally */
>  		err = mmc_select_bus_width(card);
> -		if (!err) {
> +		if (err > 0) {
>  			err = mmc_select_hs_ddr(card);
>  			if (err)
>  				goto free_card;

WARNING: multiple messages have this Message-ID (diff)
From: marcel@ziswiler.com (Marcel Ziswiler)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] mmc: fix mmc mode selection for HS-DDR and higher
Date: Wed, 01 Jun 2016 11:19:06 +0200	[thread overview]
Message-ID: <1464772746.3079.4.camel@ziswiler.com> (raw)
In-Reply-To: <1464505484-3661-2-git-send-email-wens@csie.org>

On Sun, 2016-05-29 at 15:04 +0800, Chen-Yu Tsai wrote:
> When IS_ERR_VALUE was removed from the mmc core code, it was replaced
> with a simple not-zero check. This does not work, as the value
> checked
> is the return value for mmc_select_bus_width, which returns the set
> bit width on success. This made eMMC modes higher than HS-DDR
> unusable.
> 
> Fix this by checking for a positive return value instead.
> 
> Fixes: 287980e49ffc ("remove lots of IS_ERR_VALUE abuses")
> Cc: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

This fixes the following eMMC issue as experienced on Apalis T30 as
well:

[????7.194625] mmc1: mmc_select_hs200 failed, error 3
[????7.201549] mmc1: error 3 whilst initialising MMC card

Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

> ---
> ?drivers/mmc/core/mmc.c | 4 ++--
> ?1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index c984321d1881..aafb73d080ca 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1276,7 +1276,7 @@ static int mmc_select_hs200(struct mmc_card
> *card)
> ?	?* switch to HS200 mode if bus width is set successfully.
> ?	?*/
> ?	err = mmc_select_bus_width(card);
> -	if (!err) {
> +	if (err > 0) {
> ?		val = EXT_CSD_TIMING_HS200 |
> ?		??????card->drive_strength << EXT_CSD_DRV_STR_SHIFT;
> ?		err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
> @@ -1583,7 +1583,7 @@ static int mmc_init_card(struct mmc_host *host,
> u32 ocr,
> ?	} else if (mmc_card_hs(card)) {
> ?		/* Select the desired bus width optionally */
> ?		err = mmc_select_bus_width(card);
> -		if (!err) {
> +		if (err > 0) {
> ?			err = mmc_select_hs_ddr(card);
> ?			if (err)
> ?				goto free_card;

  parent reply	other threads:[~2016-06-01  9:19 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-29  7:04 [PATCH 0/3] mmc: sunxi: Fix MMC DDR modes for Allwinner A80 Chen-Yu Tsai
2016-05-29  7:04 ` Chen-Yu Tsai
2016-05-29  7:04 ` [PATCH 1/3] mmc: fix mmc mode selection for HS-DDR and higher Chen-Yu Tsai
2016-05-29  7:04   ` Chen-Yu Tsai
2016-05-31  9:30   ` Krzysztof Kozlowski
2016-05-31  9:30     ` Krzysztof Kozlowski
2016-06-01  1:25   ` Jaehoon Chung
2016-06-01  1:25     ` Jaehoon Chung
2016-06-01  2:36   ` Shawn Lin
2016-06-01  2:36     ` Shawn Lin
2016-06-01  9:19   ` Marcel Ziswiler [this message]
2016-06-01  9:19     ` Marcel Ziswiler
2016-06-01 18:58   ` Bjorn Andersson
2016-06-01 18:58     ` Bjorn Andersson
2016-06-02  8:08     ` Chen-Yu Tsai
2016-06-02  8:08       ` Chen-Yu Tsai
2016-06-02  8:31   ` Ulf Hansson
2016-06-02  8:31     ` Ulf Hansson
2016-06-02  8:31     ` Ulf Hansson
2016-06-02  9:35     ` Krzysztof Kozlowski
2016-06-02  9:35       ` Krzysztof Kozlowski
2016-06-02  9:35       ` Krzysztof Kozlowski
2016-06-02 15:01       ` Ulf Hansson
2016-06-02 15:01         ` Ulf Hansson
2016-06-02 15:01         ` Ulf Hansson
2016-05-29  7:04 ` [PATCH 2/3] mmc: sunxi: Fix DDR MMC timings for A80 Chen-Yu Tsai
2016-05-29  7:04   ` Chen-Yu Tsai
2016-05-30 11:34   ` Hans de Goede
2016-05-30 11:34     ` Hans de Goede
2016-05-30 12:59     ` Chen-Yu Tsai
2016-05-30 12:59       ` Chen-Yu Tsai
2016-05-30 15:38       ` Chen-Yu Tsai
2016-05-30 15:38         ` Chen-Yu Tsai
2016-05-30 18:05       ` Hans de Goede
2016-05-30 18:05         ` Hans de Goede
2016-05-29  7:04 ` [PATCH 3/3] mmc: sunxi: Re-enable eMMC HS-DDR modes on Allwinner A80 Chen-Yu Tsai
2016-05-29  7:04   ` Chen-Yu Tsai

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=1464772746.3079.4.camel@ziswiler.com \
    --to=marcel@ziswiler.com \
    --cc=arnd@arndb.de \
    --cc=hdegoede@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.com \
    --cc=ulf.hansson@linaro.org \
    --cc=wens@csie.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.