aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@stericsson.com>2011-02-08 07:03:32 -0500
committerGrant Likely <grant.likely@secretlab.ca>2011-02-15 17:09:02 -0500
commit808f1037ab3fbf75d25026ad8e175c57927cdb3a (patch)
treef92cc4e1f9b41e75f41df1caa4f43bd874a426c9 /drivers/spi
parentecd442fd9e388a31d382a62fb43e851048c282e1 (diff)
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 <rmk+kernel@arm.linux.org.uk> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/amba-pl022.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c
index 4220aad42840..8fdf530f9f50 100644
--- a/drivers/spi/amba-pl022.c
+++ b/drivers/spi/amba-pl022.c
@@ -508,9 +508,10 @@ static void giveback(struct pl022 *pl022)
508 msg->state = NULL; 508 msg->state = NULL;
509 if (msg->complete) 509 if (msg->complete)
510 msg->complete(msg->context); 510 msg->complete(msg->context);
511 /* This message is completed, so let's turn off the clocks! */ 511 /* This message is completed, so let's turn off the clocks & power */
512 clk_disable(pl022->clk); 512 clk_disable(pl022->clk);
513 amba_pclk_disable(pl022->adev); 513 amba_pclk_disable(pl022->adev);
514 amba_vcore_disable(pl022->adev);
514} 515}
515 516
516/** 517/**
@@ -1475,9 +1476,11 @@ static void pump_messages(struct work_struct *work)
1475 /* Setup the SPI using the per chip configuration */ 1476 /* Setup the SPI using the per chip configuration */
1476 pl022->cur_chip = spi_get_ctldata(pl022->cur_msg->spi); 1477 pl022->cur_chip = spi_get_ctldata(pl022->cur_msg->spi);
1477 /* 1478 /*
1478 * We enable the clocks here, then the clocks will be disabled when 1479 * We enable the core voltage and clocks here, then the clocks
1479 * giveback() is called in each method (poll/interrupt/DMA) 1480 * and core will be disabled when giveback() is called in each method
1481 * (poll/interrupt/DMA)
1480 */ 1482 */
1483 amba_vcore_enable(pl022->adev);
1481 amba_pclk_enable(pl022->adev); 1484 amba_pclk_enable(pl022->adev);
1482 clk_enable(pl022->clk); 1485 clk_enable(pl022->clk);
1483 restore_state(pl022); 1486 restore_state(pl022);
@@ -2123,8 +2126,12 @@ pl022_probe(struct amba_device *adev, struct amba_id *id)
2123 goto err_spi_register; 2126 goto err_spi_register;
2124 } 2127 }
2125 dev_dbg(dev, "probe succeded\n"); 2128 dev_dbg(dev, "probe succeded\n");
2126 /* Disable the silicon block pclk and clock it when needed */ 2129 /*
2130 * Disable the silicon block pclk and any voltage domain and just
2131 * power it up and clock it when it's needed
2132 */
2127 amba_pclk_disable(adev); 2133 amba_pclk_disable(adev);
2134 amba_vcore_disable(adev);
2128 return 0; 2135 return 0;
2129 2136
2130 err_spi_register: 2137 err_spi_register:
@@ -2189,9 +2196,11 @@ static int pl022_suspend(struct amba_device *adev, pm_message_t state)
2189 return status; 2196 return status;
2190 } 2197 }
2191 2198
2199 amba_vcore_enable(adev);
2192 amba_pclk_enable(adev); 2200 amba_pclk_enable(adev);
2193 load_ssp_default_config(pl022); 2201 load_ssp_default_config(pl022);
2194 amba_pclk_disable(adev); 2202 amba_pclk_disable(adev);
2203 amba_vcore_disable(adev);
2195 dev_dbg(&adev->dev, "suspended\n"); 2204 dev_dbg(&adev->dev, "suspended\n");
2196 return 0; 2205 return 0;
2197} 2206}