diff mbox series

[v2,2/2] spi: coldfire-qspi: Use clk_prepare_enable and clk_disable_unprepare

Message ID 1594790807-32319-2-git-send-email-zhangqing@loongson.cn (mailing list archive)
State Accepted
Commit 499de01c5c0b813cc94dbfc722ec12487044ac4a
Headers show
Series [v2,1/2] spi: omap-uwire: Use clk_prepare_enable and clk_disable_unprepare | expand

Commit Message

Qing Zhang July 15, 2020, 5:26 a.m. UTC
Convert clk_enable() to clk_prepare_enable() and clk_disable() to
clk_disable_unprepare() respectively in the spi-coldfire-qspi.c.

Signed-off-by: Qing Zhang <zhangqing@loongson.cn>
---

v2:
    -Modify the commit message
    -Split into two patches

 drivers/spi/spi-coldfire-qspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Mark Brown July 15, 2020, 9:49 a.m. UTC | #1
On Wed, Jul 15, 2020 at 01:26:47PM +0800, Qing Zhang wrote:
> Convert clk_enable() to clk_prepare_enable() and clk_disable() to
> clk_disable_unprepare() respectively in the spi-coldfire-qspi.c.

Like I said on the previous version are you sure that ColdFire uses the
common clock framework and has the prepare calls?
Qing Zhang July 16, 2020, 10:01 a.m. UTC | #2
On 07/15/2020 05:49 PM, Mark Brown wrote:
> On Wed, Jul 15, 2020 at 01:26:47PM +0800, Qing Zhang wrote:
>> Convert clk_enable() to clk_prepare_enable() and clk_disable() to
>> clk_disable_unprepare() respectively in the spi-coldfire-qspi.c.
> Like I said on the previous version are you sure that ColdFire uses the
> common clock framework and has the prepare calls?
Hi Mark,

Thanks for your reminder again.

I see the following comment and code in arch/m68k/coldfire/clk.c:

For more advanced ColdFire parts that have clocks that can be enabled
we supply enable/disable functions. These must properly define their
clocks in their platform specific code.

int clk_enable(struct clk *clk)
{
     unsigned long flags;
     spin_lock_irqsave(&clk_lock, flags);
     if ((clk->enabled++ == 0) && clk->clk_ops)
         clk->clk_ops->enable(clk);
     spin_unlock_irqrestore(&clk_lock, flags);

     return 0;
}
EXPORT_SYMBOL(clk_enable);

void clk_disable(struct clk *clk)
{
     unsigned long flags;

     if (!clk)
         return;

     spin_lock_irqsave(&clk_lock, flags);
     if ((--clk->enabled == 0) && clk->clk_ops)
         clk->clk_ops->disable(clk);
     spin_unlock_irqrestore(&clk_lock, flags);
}
EXPORT_SYMBOL(clk_disable);

Thanks,
Qing
diff mbox series

Patch

diff --git a/drivers/spi/spi-coldfire-qspi.c b/drivers/spi/spi-coldfire-qspi.c
index f80e06c..8996115 100644
--- a/drivers/spi/spi-coldfire-qspi.c
+++ b/drivers/spi/spi-coldfire-qspi.c
@@ -387,7 +387,7 @@  static int mcfqspi_probe(struct platform_device *pdev)
 		status = PTR_ERR(mcfqspi->clk);
 		goto fail0;
 	}
-	clk_enable(mcfqspi->clk);
+	clk_prepare_enable(mcfqspi->clk);
 
 	master->bus_num = pdata->bus_num;
 	master->num_chipselect = pdata->num_chipselect;
@@ -425,7 +425,7 @@  static int mcfqspi_probe(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 	mcfqspi_cs_teardown(mcfqspi);
 fail1:
-	clk_disable(mcfqspi->clk);
+	clk_disable_unprepare(mcfqspi->clk);
 fail0:
 	spi_master_put(master);