linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/4] spi/pl022: disable core voltage when idle
@ 2011-02-08 12:03 Linus Walleij
       [not found] ` <1297166612-5135-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2011-02-08 12:03 UTC (permalink / raw)
  To: Grant Likely, spi-devel-general
  Cc: Russell King, Linus Walleij, Lee Jones, Linus Walleij, linux-arm-kernel

This utilizes the new core voltage switch to power off the PL022
core voltage when it's not in use transmitting packets, if and
only if a core voltage switch is available.

Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/spi/amba-pl022.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c
index 4220aad..8fdf530 100644
--- a/drivers/spi/amba-pl022.c
+++ b/drivers/spi/amba-pl022.c
@@ -508,9 +508,10 @@ static void giveback(struct pl022 *pl022)
 	msg->state = NULL;
 	if (msg->complete)
 		msg->complete(msg->context);
-	/* This message is completed, so let's turn off the clocks! */
+	/* This message is completed, so let's turn off the clocks & power */
 	clk_disable(pl022->clk);
 	amba_pclk_disable(pl022->adev);
+	amba_vcore_disable(pl022->adev);
 }
 
 /**
@@ -1475,9 +1476,11 @@ static void pump_messages(struct work_struct *work)
 	/* Setup the SPI using the per chip configuration */
 	pl022->cur_chip = spi_get_ctldata(pl022->cur_msg->spi);
 	/*
-	 * We enable the clocks here, then the clocks will be disabled when
-	 * giveback() is called in each method (poll/interrupt/DMA)
+	 * We enable the core voltage and clocks here, then the clocks
+	 * and core will be disabled when giveback() is called in each method
+	 * (poll/interrupt/DMA)
 	 */
+	amba_vcore_enable(pl022->adev);
 	amba_pclk_enable(pl022->adev);
 	clk_enable(pl022->clk);
 	restore_state(pl022);
@@ -2123,8 +2126,12 @@ pl022_probe(struct amba_device *adev, struct amba_id *id)
 		goto err_spi_register;
 	}
 	dev_dbg(dev, "probe succeded\n");
-	/* Disable the silicon block pclk and clock it when needed */
+	/*
+	 * Disable the silicon block pclk and any voltage domain and just
+	 * power it up and clock it when it's needed
+	 */
 	amba_pclk_disable(adev);
+	amba_vcore_disable(adev);
 	return 0;
 
  err_spi_register:
@@ -2189,9 +2196,11 @@ static int pl022_suspend(struct amba_device *adev, pm_message_t state)
 		return status;
 	}
 
+	amba_vcore_enable(adev);
 	amba_pclk_enable(adev);
 	load_ssp_default_config(pl022);
 	amba_pclk_disable(adev);
+	amba_vcore_disable(adev);
 	dev_dbg(&adev->dev, "suspended\n");
 	return 0;
 }
-- 
1.7.3.2

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

* Re: [PATCH 2/4] spi/pl022: disable core voltage when idle
       [not found] ` <1297166612-5135-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
@ 2011-02-15 22:09   ` Grant Likely
  0 siblings, 0 replies; 2+ messages in thread
From: Grant Likely @ 2011-02-15 22:09 UTC (permalink / raw)
  To: Linus Walleij
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	Linus Walleij, Lee Jones,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Russell King

On Tue, Feb 08, 2011 at 01:03:32PM +0100, Linus Walleij wrote:
> This utilizes the new core voltage switch to power off the PL022
> core voltage when it's not in use transmitting packets, if and
> only if a core voltage switch is available.
> 
> Cc: Russell King <rmk+kernel-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>
> Signed-off-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

Applied, thanks.

g.

> ---
>  drivers/spi/amba-pl022.c |   17 +++++++++++++----
>  1 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c
> index 4220aad..8fdf530 100644
> --- a/drivers/spi/amba-pl022.c
> +++ b/drivers/spi/amba-pl022.c
> @@ -508,9 +508,10 @@ static void giveback(struct pl022 *pl022)
>  	msg->state = NULL;
>  	if (msg->complete)
>  		msg->complete(msg->context);
> -	/* This message is completed, so let's turn off the clocks! */
> +	/* This message is completed, so let's turn off the clocks & power */
>  	clk_disable(pl022->clk);
>  	amba_pclk_disable(pl022->adev);
> +	amba_vcore_disable(pl022->adev);
>  }
>  
>  /**
> @@ -1475,9 +1476,11 @@ static void pump_messages(struct work_struct *work)
>  	/* Setup the SPI using the per chip configuration */
>  	pl022->cur_chip = spi_get_ctldata(pl022->cur_msg->spi);
>  	/*
> -	 * We enable the clocks here, then the clocks will be disabled when
> -	 * giveback() is called in each method (poll/interrupt/DMA)
> +	 * We enable the core voltage and clocks here, then the clocks
> +	 * and core will be disabled when giveback() is called in each method
> +	 * (poll/interrupt/DMA)
>  	 */
> +	amba_vcore_enable(pl022->adev);
>  	amba_pclk_enable(pl022->adev);
>  	clk_enable(pl022->clk);
>  	restore_state(pl022);
> @@ -2123,8 +2126,12 @@ pl022_probe(struct amba_device *adev, struct amba_id *id)
>  		goto err_spi_register;
>  	}
>  	dev_dbg(dev, "probe succeded\n");
> -	/* Disable the silicon block pclk and clock it when needed */
> +	/*
> +	 * Disable the silicon block pclk and any voltage domain and just
> +	 * power it up and clock it when it's needed
> +	 */
>  	amba_pclk_disable(adev);
> +	amba_vcore_disable(adev);
>  	return 0;
>  
>   err_spi_register:
> @@ -2189,9 +2196,11 @@ static int pl022_suspend(struct amba_device *adev, pm_message_t state)
>  		return status;
>  	}
>  
> +	amba_vcore_enable(adev);
>  	amba_pclk_enable(adev);
>  	load_ssp_default_config(pl022);
>  	amba_pclk_disable(adev);
> +	amba_vcore_disable(adev);
>  	dev_dbg(&adev->dev, "suspended\n");
>  	return 0;
>  }
> -- 
> 1.7.3.2
> 

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb

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

end of thread, other threads:[~2011-02-15 22:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-08 12:03 [PATCH 2/4] spi/pl022: disable core voltage when idle Linus Walleij
     [not found] ` <1297166612-5135-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
2011-02-15 22:09   ` Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).