mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drivers: mmc: sdhci: update max frequency only if undefined
@ 2015-06-18  7:27 Suneel Garapati
  2015-06-18  7:29 ` Dong Aisheng
  0 siblings, 1 reply; 3+ messages in thread
From: Suneel Garapati @ 2015-06-18  7:27 UTC (permalink / raw)
  To: linux-mmc, linux-kernel
  Cc: Ulf Hansson, michals, sorenb, Adrian Hunter, Aisheng Dong,
	Haibo Chen, Tim Kryger, Shawn Guo, Yi Sun, Rafael J. Wysocki,
	stripathi, Suneel Garapati

f_max parameter of mmc structure is updated unconditionally.
If dt property max-frequency is assigned, this update is
overwriting the dt property value which is undesired.

Signed-off-by: Suneel Garapati <suneel.garapati@xilinx.com>
---
 drivers/mmc/host/sdhci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index bc14452..c2917d5 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -3047,7 +3047,10 @@ int sdhci_add_host(struct sdhci_host *host)
	 * Set host parameters.
	 */
	mmc->ops = &sdhci_ops;
-	mmc->f_max = host->max_clk;
+
+	if(!mmc->f_max)
+		mmc->f_max = host->max_clk;
+
	if (host->ops->get_min_clock)
		mmc->f_min = host->ops->get_min_clock(host);
	else if (host->version >= SDHCI_SPEC_300) {
--
2.1.2

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drivers: mmc: sdhci: update max frequency only if undefined
  2015-06-18  7:27 [PATCH] drivers: mmc: sdhci: update max frequency only if undefined Suneel Garapati
@ 2015-06-18  7:29 ` Dong Aisheng
  2015-06-18  7:58   ` Suneel G
  0 siblings, 1 reply; 3+ messages in thread
From: Dong Aisheng @ 2015-06-18  7:29 UTC (permalink / raw)
  To: Suneel Garapati
  Cc: linux-mmc, linux-kernel, Ulf Hansson, michals, sorenb,
	Adrian Hunter, Haibo Chen, Tim Kryger, Shawn Guo, Yi Sun,
	Rafael J. Wysocki, stripathi

On Thu, Jun 18, 2015 at 12:57:07PM +0530, Suneel Garapati wrote:
> f_max parameter of mmc structure is updated unconditionally.
> If dt property max-frequency is assigned, this update is
> overwriting the dt property value which is undesired.
> 
> Signed-off-by: Suneel Garapati <suneel.garapati@xilinx.com>
> ---
>  drivers/mmc/host/sdhci.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index bc14452..c2917d5 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -3047,7 +3047,10 @@ int sdhci_add_host(struct sdhci_host *host)
> 	 * Set host parameters.
> 	 */
> 	mmc->ops = &sdhci_ops;
> -	mmc->f_max = host->max_clk;
> +
> +	if(!mmc->f_max)
> +		mmc->f_max = host->max_clk;
> +

This is probably not going to work properly.
mmc->f_max will be overwritten again if host->clk_mul enabled.
And you did not do sanity check if f_max from device tree is valid.

Please see:
http://www.spinics.net/lists/arm-kernel/msg426167.html
I already sent a proper fix.

Regards
Dong Aisheng

> 	if (host->ops->get_min_clock)
> 		mmc->f_min = host->ops->get_min_clock(host);
> 	else if (host->version >= SDHCI_SPEC_300) {
> --
> 2.1.2

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drivers: mmc: sdhci: update max frequency only if undefined
  2015-06-18  7:29 ` Dong Aisheng
@ 2015-06-18  7:58   ` Suneel G
  0 siblings, 0 replies; 3+ messages in thread
From: Suneel G @ 2015-06-18  7:58 UTC (permalink / raw)
  To: Dong Aisheng
  Cc: Suneel Garapati, linux-mmc, linux-kernel, Ulf Hansson, michals,
	sorenb, Adrian Hunter, Haibo Chen, Tim Kryger, Shawn Guo, Yi Sun,
	Rafael J. Wysocki, Suman Tripathi

Hi,

On Thu, Jun 18, 2015 at 12:59 PM, Dong Aisheng <b29396@freescale.com> wrote:
> On Thu, Jun 18, 2015 at 12:57:07PM +0530, Suneel Garapati wrote:
>> f_max parameter of mmc structure is updated unconditionally.
>> If dt property max-frequency is assigned, this update is
>> overwriting the dt property value which is undesired.
>>
>> Signed-off-by: Suneel Garapati <suneel.garapati@xilinx.com>
>> ---
>>  drivers/mmc/host/sdhci.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
>> index bc14452..c2917d5 100644
>> --- a/drivers/mmc/host/sdhci.c
>> +++ b/drivers/mmc/host/sdhci.c
>> @@ -3047,7 +3047,10 @@ int sdhci_add_host(struct sdhci_host *host)
>>        * Set host parameters.
>>        */
>>       mmc->ops = &sdhci_ops;
>> -     mmc->f_max = host->max_clk;
>> +
>> +     if(!mmc->f_max)
>> +             mmc->f_max = host->max_clk;
>> +
>
> This is probably not going to work properly.
> mmc->f_max will be overwritten again if host->clk_mul enabled.
> And you did not do sanity check if f_max from device tree is valid.
>
> Please see:
> http://www.spinics.net/lists/arm-kernel/msg426167.html
> I already sent a proper fix.

Ok, I missed your series.
My platform doesn't have clk_mul enabled hence couldn't check on that.
Agree on the sanity check.

Regards,
Suneel

>
> Regards
> Dong Aisheng
>
>>       if (host->ops->get_min_clock)
>>               mmc->f_min = host->ops->get_min_clock(host);
>>       else if (host->version >= SDHCI_SPEC_300) {
>> --
>> 2.1.2
> --
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-18  7:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-18  7:27 [PATCH] drivers: mmc: sdhci: update max frequency only if undefined Suneel Garapati
2015-06-18  7:29 ` Dong Aisheng
2015-06-18  7:58   ` Suneel G

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®