diff options
author | Robin Gong <B38343@freescale.com> | 2012-04-12 14:40:42 +0800 |
---|---|---|
committer | Jason Liu <r64343@freescale.com> | 2012-07-20 13:36:04 +0800 |
commit | 43dbd12099a583fa9c6c9a1ca4e70da1ee4a7f58 (patch) | |
tree | d3f83ea38ca092a2680fc2f21fc1703e0320b7ed | |
parent | 4c7dd07f0441c1f9e1e0148381fd6a6c0758bd1b (diff) |
ENGR00179497-1 ECSPI: disable ecspi clock after probe and spi transfer
before, it enable spi clock after probe, never been disable unless driver
removed. To reduce power, disable clock after probe, and enable it before
every spi transfer and disable it after spi transfer
Signed-off-by: Robin Gong <B38343@freescale.com>
-rw-r--r-- | drivers/spi/spi_imx.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c index eba760095956..be58e17dc526 100644 --- a/drivers/spi/spi_imx.c +++ b/drivers/spi/spi_imx.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007, 2011 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc. All Rights Reserved. * Copyright (C) 2008 Juergen Beisert * * This program is free software; you can redistribute it and/or @@ -652,6 +652,7 @@ static int spi_imx_setupxfer(struct spi_device *spi, struct spi_imx_data *spi_imx = spi_master_get_devdata(spi->master); struct spi_imx_config config; + clk_enable(spi_imx->clk); config.bpw = t ? t->bits_per_word : spi->bits_per_word; config.speed_hz = t ? t->speed_hz : spi->max_speed_hz; config.mode = spi->mode; @@ -678,7 +679,7 @@ static int spi_imx_setupxfer(struct spi_device *spi, BUG(); spi_imx->devtype_data.config(spi_imx, &config); - + clk_disable(spi_imx->clk); return 0; } @@ -687,6 +688,7 @@ static int spi_imx_transfer(struct spi_device *spi, { struct spi_imx_data *spi_imx = spi_master_get_devdata(spi->master); + clk_enable(spi_imx->clk); spi_imx->tx_buf = transfer->tx_buf; spi_imx->rx_buf = transfer->rx_buf; spi_imx->count = transfer->len; @@ -699,6 +701,7 @@ static int spi_imx_transfer(struct spi_device *spi, spi_imx->devtype_data.intctrl(spi_imx, MXC_INT_TE); wait_for_completion(&spi_imx->xfer_done); + clk_disable(spi_imx->clk); return transfer->len; } @@ -863,12 +866,12 @@ static int __devinit spi_imx_probe(struct platform_device *pdev) spi_imx->devtype_data.reset(spi_imx); spi_imx->devtype_data.intctrl(spi_imx, 0); - ret = spi_bitbang_start(&spi_imx->bitbang); if (ret) { dev_err(&pdev->dev, "bitbang start failed with %d\n", ret); goto out_clk_put; } + clk_disable(spi_imx->clk); dev_info(&pdev->dev, "probed\n"); @@ -902,7 +905,7 @@ static int __devexit spi_imx_remove(struct platform_device *pdev) int i; spi_bitbang_stop(&spi_imx->bitbang); - + clk_enable(spi_imx->clk); writel(0, spi_imx->base + MXC_CSPICTRL); clk_disable(spi_imx->clk); clk_put(spi_imx->clk); |