* [PATCH v2] mmc: atmel-sdhci: fix the clk_enable call in case of no ops
@ 2020-11-09 11:02 ` Eugen Hristev
2020-11-09 12:14 ` Jaehoon Chung
0 siblings, 1 reply; 3+ messages in thread
From: Eugen Hristev @ 2020-11-09 11:02 UTC (permalink / raw)
To: u-boot
If the clock driver does not offer a clk_enable ops, then the system will
return -ENOSYS.
The clk_enable works with CCF (common clock framework).
Some clocks in some cases (like the generic clock for some products: sama5d2)
do not have the clk_enable primitive, and in this case probing of the driver
will fail.
This patch changes the behavior to return an error in case there is really
an error, and not a missing primitive.
If the clock driver does not have an enable primitive, most likely clocks
are always enabled or enabled in the set_rate primitives.
Fixes: 81f16438d4 ("mmc: atmel-sdhci: enable the required generic clock")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
---
Changes in v2:
- fixed issue with ret being 0, it was going to return ret;, when in fact
there was no error. Have to check for both ret != 0 and ret != -ENOSYS.
drivers/mmc/atmel_sdhci.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/atmel_sdhci.c b/drivers/mmc/atmel_sdhci.c
index f56ae63bc2..ca7a98bf1d 100644
--- a/drivers/mmc/atmel_sdhci.c
+++ b/drivers/mmc/atmel_sdhci.c
@@ -86,7 +86,8 @@ static int atmel_sdhci_probe(struct udevice *dev)
return -EINVAL;
ret = clk_enable(&clk);
- if (ret)
+ /* return error only if the clock really has a clock enable func */
+ if (ret && ret != -ENOSYS)
return ret;
ret = mmc_of_parse(dev, &plat->cfg);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2] mmc: atmel-sdhci: fix the clk_enable call in case of no ops
2020-11-09 11:02 ` [PATCH v2] mmc: atmel-sdhci: fix the clk_enable call in case of no ops Eugen Hristev
@ 2020-11-09 12:14 ` Jaehoon Chung
2020-11-26 8:17 ` Eugen.Hristev at microchip.com
0 siblings, 1 reply; 3+ messages in thread
From: Jaehoon Chung @ 2020-11-09 12:14 UTC (permalink / raw)
To: u-boot
On 11/9/20 8:02 PM, Eugen Hristev wrote:
> If the clock driver does not offer a clk_enable ops, then the system will
> return -ENOSYS.
> The clk_enable works with CCF (common clock framework).
> Some clocks in some cases (like the generic clock for some products: sama5d2)
> do not have the clk_enable primitive, and in this case probing of the driver
> will fail.
> This patch changes the behavior to return an error in case there is really
> an error, and not a missing primitive.
> If the clock driver does not have an enable primitive, most likely clocks
> are always enabled or enabled in the set_rate primitives.
>
> Fixes: 81f16438d4 ("mmc: atmel-sdhci: enable the required generic clock")
> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Best Regards,
Jaehoon Chung
> ---
> Changes in v2:
> - fixed issue with ret being 0, it was going to return ret;, when in fact
> there was no error. Have to check for both ret != 0 and ret != -ENOSYS.
>
>
> drivers/mmc/atmel_sdhci.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/atmel_sdhci.c b/drivers/mmc/atmel_sdhci.c
> index f56ae63bc2..ca7a98bf1d 100644
> --- a/drivers/mmc/atmel_sdhci.c
> +++ b/drivers/mmc/atmel_sdhci.c
> @@ -86,7 +86,8 @@ static int atmel_sdhci_probe(struct udevice *dev)
> return -EINVAL;
>
> ret = clk_enable(&clk);
> - if (ret)
> + /* return error only if the clock really has a clock enable func */
> + if (ret && ret != -ENOSYS)
> return ret;
>
> ret = mmc_of_parse(dev, &plat->cfg);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] mmc: atmel-sdhci: fix the clk_enable call in case of no ops
2020-11-09 12:14 ` Jaehoon Chung
@ 2020-11-26 8:17 ` Eugen.Hristev at microchip.com
0 siblings, 0 replies; 3+ messages in thread
From: Eugen.Hristev at microchip.com @ 2020-11-26 8:17 UTC (permalink / raw)
To: u-boot
On 09.11.2020 14:14, Jaehoon Chung wrote:
> On 11/9/20 8:02 PM, Eugen Hristev wrote:
>> If the clock driver does not offer a clk_enable ops, then the system will
>> return -ENOSYS.
>> The clk_enable works with CCF (common clock framework).
>> Some clocks in some cases (like the generic clock for some products: sama5d2)
>> do not have the clk_enable primitive, and in this case probing of the driver
>> will fail.
>> This patch changes the behavior to return an error in case there is really
>> an error, and not a missing primitive.
>> If the clock driver does not have an enable primitive, most likely clocks
>> are always enabled or enabled in the set_rate primitives.
>>
>> Fixes: 81f16438d4 ("mmc: atmel-sdhci: enable the required generic clock")
>> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
>
> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
>
> Best Regards,
> Jaehoon Chung
>
>> ---
Applied to u-boot-atmel/master
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-26 8:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20201109110252epcas1p1400342c8796e9bea600bfe7140c023e1@epcas1p1.samsung.com>
2020-11-09 11:02 ` [PATCH v2] mmc: atmel-sdhci: fix the clk_enable call in case of no ops Eugen Hristev
2020-11-09 12:14 ` Jaehoon Chung
2020-11-26 8:17 ` Eugen.Hristev at microchip.com
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.