diff mbox series

mmc: atmel-sdhci: fix the clk_enable call in case of no ops

Message ID 20201103123324.79741-1-eugen.hristev@microchip.com
State Superseded
Delegated to: Eugen Hristev
Headers show
Series mmc: atmel-sdhci: fix the clk_enable call in case of no ops | expand

Commit Message

Eugen Hristev Nov. 3, 2020, 12:33 p.m. UTC
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>
---
 drivers/mmc/atmel_sdhci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jaehoon Chung Nov. 3, 2020, 9:46 p.m. UTC | #1
On 11/3/20 9:33 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

> ---
>  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..82dfc345c0 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 != -ENOSYS)
>  		return ret;
>  
>  	ret = mmc_of_parse(dev, &plat->cfg);
>
diff mbox series

Patch

diff --git a/drivers/mmc/atmel_sdhci.c b/drivers/mmc/atmel_sdhci.c
index f56ae63bc2..82dfc345c0 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 != -ENOSYS)
 		return ret;
 
 	ret = mmc_of_parse(dev, &plat->cfg);