diff mbox

mmc: sdhci: Restore behavior while creating OCR mask

Message ID 1433498817-16679-1-git-send-email-ulf.hansson@linaro.org
State New
Headers show

Commit Message

Ulf Hansson June 5, 2015, 10:06 a.m. UTC
Commit 3a48edc4bd68 ("mmc: sdhci: Use mmc core regulator infrastucture")
changed the behavior for how to assign the ocr_avail mask for the mmc
host. More precisely it started to mask the bits instead of assigning
them.

Restore the behavior, but also make it clear that an OCR mask created
from an external regulator overrides the other ones.

Fixes: 3a48edc4bd68 ("mmc: sdhci: Use mmc core regulator infrastucture")
Cc: Tim Kryger <tim.kryger@gmail.com>
Reported-by: Yangbo Lu <yangbo.lu@freescale.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/host/sdhci.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Ulf Hansson June 8, 2015, 9:21 a.m. UTC | #1
On 6 June 2015 at 20:52, Tim Kryger <tim.kryger@gmail.com> wrote:
> On Fri, Jun 5, 2015 at 3:06 AM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>> Commit 3a48edc4bd68 ("mmc: sdhci: Use mmc core regulator infrastucture")
>> changed the behavior for how to assign the ocr_avail mask for the mmc
>> host. More precisely it started to mask the bits instead of assigning
>> them.
>>
>> Restore the behavior, but also make it clear that an OCR mask created
>> from an external regulator overrides the other ones.
>>
>> Fixes: 3a48edc4bd68 ("mmc: sdhci: Use mmc core regulator infrastucture")
>> Cc: Tim Kryger <tim.kryger@gmail.com>
>> Reported-by: Yangbo Lu <yangbo.lu@freescale.com>
>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>> ---
>>  drivers/mmc/host/sdhci.c | 9 +++++----
>>  1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
>> index 1b4861d..706bb60 100644
>> --- a/drivers/mmc/host/sdhci.c
>> +++ b/drivers/mmc/host/sdhci.c
>> @@ -3256,13 +3256,14 @@ int sdhci_add_host(struct sdhci_host *host)
>>                                    SDHCI_MAX_CURRENT_MULTIPLIER;
>>         }
>>
>> -       /* If OCR set by external regulators, use it instead */
>> +       /* If OCR set by host, use it instead. */
>> +       if (host->ocr_mask)
>> +               ocr_avail = host->ocr_mask;
>> +
>> +       /* If OCR set by external regulators, give it highest prio. */
>>         if (mmc->ocr_avail)
>>                 ocr_avail = mmc->ocr_avail;
>>
>> -       if (host->ocr_mask)
>> -               ocr_avail &= host->ocr_mask;
>> -
>>         mmc->ocr_avail = ocr_avail;
>>         mmc->ocr_avail_sdio = ocr_avail;
>>         if (host->ocr_avail_sdio)
>> --
>> 1.9.1
>>
>
> The patch looks good.  Perhaps include this in the commit message.
>
> The OCR mask is determined by one of the following with this priority:
>
>   1. Supported ranges of external regulator if one supplies VDD
>   2. Host OCR mask if set by the driver (based on DT properties)
>   3. The capabilities reported by the controller itself
>
> Reviewed-by: Tim Kryger <tim.kryger@gmail.com>

Tim, thanks for you review!

I have applied the patch for my next branch and updated the commit
message according to your proposal.

Kind regards
Uffe
--
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
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 1b4861d..706bb60 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -3256,13 +3256,14 @@  int sdhci_add_host(struct sdhci_host *host)
 				   SDHCI_MAX_CURRENT_MULTIPLIER;
 	}
 
-	/* If OCR set by external regulators, use it instead */
+	/* If OCR set by host, use it instead. */
+	if (host->ocr_mask)
+		ocr_avail = host->ocr_mask;
+
+	/* If OCR set by external regulators, give it highest prio. */
 	if (mmc->ocr_avail)
 		ocr_avail = mmc->ocr_avail;
 
-	if (host->ocr_mask)
-		ocr_avail &= host->ocr_mask;
-
 	mmc->ocr_avail = ocr_avail;
 	mmc->ocr_avail_sdio = ocr_avail;
 	if (host->ocr_avail_sdio)