From patchwork Fri Mar 4 17:02:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 360 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:41:56 -0000 Delivered-To: patches@linaro.org Received: by 10.224.60.68 with SMTP id o4cs21462qah; Fri, 4 Mar 2011 09:02:41 -0800 (PST) Received: by 10.227.204.195 with SMTP id fn3mr803923wbb.36.1299258160889; Fri, 04 Mar 2011 09:02:40 -0800 (PST) Received: from mail-wy0-f178.google.com (mail-wy0-f178.google.com [74.125.82.178]) by mx.google.com with ESMTPS id f60si3505776wej.119.2011.03.04.09.02.40 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Mar 2011 09:02:40 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-wy0-f178.google.com with SMTP id 28so2726741wyf.37 for ; Fri, 04 Mar 2011 09:02:40 -0800 (PST) Received: by 10.227.150.101 with SMTP id x37mr739944wbv.225.1299258160349; Fri, 04 Mar 2011 09:02:40 -0800 (PST) Received: from [192.168.0.2] (cpc2-aztw21-0-0-cust264.aztw.cable.virginmedia.com [77.100.97.9]) by mx.google.com with ESMTPS id u9sm1935496wbg.0.2011.03.04.09.02.38 (version=SSLv3 cipher=OTHER); Fri, 04 Mar 2011 09:02:39 -0800 (PST) Message-ID: <4D711B2A.3030109@linaro.org> Date: Fri, 04 Mar 2011 17:02:34 +0000 From: Lee Jones User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8 MIME-Version: 1.0 To: patches@linaro.org Subject: [PATCH 2/4] spi/pl022: disable core voltage when idle 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 Signed-off-by: Linus Walleij --- drivers/spi/amba-pl022.c | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) /* 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; } 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)