All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaehoon Chung <jh80.chung@samsung.com>
To: Shawn Lin <shawn.lin@rock-chips.com>, linux-mmc@vger.kernel.org
Cc: ulf.hansson@linaro.org
Subject: Re: [PATCH 2/2] mmc: dw_mmc: prevent to set the wrong value
Date: Tue, 10 May 2016 10:49:42 +0900	[thread overview]
Message-ID: <57313E36.5080303@samsung.com> (raw)
In-Reply-To: <813b306b-4f32-bf13-dcdd-5bbb82d46661@rock-chips.com>

Hi Shawn,

On 05/04/2016 07:35 PM, Shawn Lin wrote:
> 在 2016/5/4 15:14, Jaehoon Chung 写道:
>> If there is no vqmmc, real voltage should not change.
>> Then it needs to maintain the previous status for UHS_REG register.
>> It means that it doesn't need to set any bit.
>>
>> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
>> ---
>>  drivers/mmc/host/dw_mmc.c | 12 ++++++++++++
>>  1 file changed, 12 insertions(+)
>>
>> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
>> index 28602cc..6bd8018 100644
>> --- a/drivers/mmc/host/dw_mmc.c
>> +++ b/drivers/mmc/host/dw_mmc.c
>> @@ -1418,7 +1418,19 @@ static int dw_mci_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios)
>>                       ret, uhs & v18 ? "1.8" : "3.3");
>>              return -EAGAIN;
>>          }
>> +    } else {
>> +        /*
>> +         * If there isn't vqmmc, it should fail to switch voltage.
>> +         * Then it needs to maintain the previous status.
>> +         * If ios->signal_voltage is 3.3v, it means that previous
>> +         * voltages was 1.8v.
>> +         */
>> +        if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330)
>> +            uhs |= v18;
>> +        else
>> +            uhs &= ~v18;
> 
> I think we can just set uhs after seting vqmmc correctly. So
> how about changing like this?

Yes, it's more readable than mine. Thanks.

Best Regards,
Jaehoon Chung

> 
>         uhs = mci_readl(host, UHS_REG);
> 
>         if (!IS_ERR(mmc->supply.vqmmc)) {
>                 ret = mmc_regulator_set_vqmmc(mmc, ios);
>                 if (ret) {
>                         dev_dbg(&mmc->class_dev,
>                                 "Regulator set error %d - %s V\n",
>                                  ret, uhs & v18 ? "3.3" : "1.8");
>                         return -EAGAIN;
>                 }
>                 if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330)
>                         uhs &= ~v18;
>                 else
>                         uhs |= v18;
>         }
>         mci_writel(host, UHS_REG, uhs);
> 
> 
>>      }
>> +
>>      mci_writel(host, UHS_REG, uhs);
>>
>>      return 0;
>>
> 
> 


  reply	other threads:[~2016-05-10  1:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-04  7:14 [PATCH 1/2] mmc: dw_mmc: retry to switch voltage when failed Jaehoon Chung
2016-05-04  7:14 ` [PATCH 2/2] mmc: dw_mmc: prevent to set the wrong value Jaehoon Chung
2016-05-04 10:35   ` Shawn Lin
2016-05-10  1:49     ` Jaehoon Chung [this message]
2016-05-04 10:41 ` [PATCH 1/2] mmc: dw_mmc: retry to switch voltage when failed Shawn Lin
2016-05-10  1:55   ` Jaehoon Chung
2016-05-10  9:24     ` Shawn Lin
2016-05-11  2:51       ` Jaehoon Chung

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=57313E36.5080303@samsung.com \
    --to=jh80.chung@samsung.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=shawn.lin@rock-chips.com \
    --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.