aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcin Tomczak <marcin.tomczak@intel.com>2012-01-27 14:14:50 -0500
committerJames Bottomley <JBottomley@Parallels.com>2012-02-19 09:09:00 -0500
commite5cc6aa4b6ef34c3f054af8c61a4f73c157589c3 (patch)
tree64efa1d1dbece4ce058e7cd19b205bde9ef5bdc1
parente3d338a536330b5ffc9f28d7c6a4cdf6ba51867a (diff)
[SCSI] isci: enable clock gating
Enabling clock gating for power savings on entry to controller ready state. Disable SCU clock gating for power savings on exit from the controller ready state. The gating is fully automated by silicon after setting the mode. Signed-off-by: Marcin Tomczak <marcin.tomczak@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r--drivers/scsi/isci/host.c9
-rw-r--r--drivers/scsi/isci/registers.h27
2 files changed, 34 insertions, 2 deletions
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c
index 418391b1c361..508aa8ce25b4 100644
--- a/drivers/scsi/isci/host.c
+++ b/drivers/scsi/isci/host.c
@@ -1491,6 +1491,15 @@ sci_controller_set_interrupt_coalescence(struct isci_host *ihost,
1491static void sci_controller_ready_state_enter(struct sci_base_state_machine *sm) 1491static void sci_controller_ready_state_enter(struct sci_base_state_machine *sm)
1492{ 1492{
1493 struct isci_host *ihost = container_of(sm, typeof(*ihost), sm); 1493 struct isci_host *ihost = container_of(sm, typeof(*ihost), sm);
1494 u32 val;
1495
1496 /* enable clock gating for power control of the scu unit */
1497 val = readl(&ihost->smu_registers->clock_gating_control);
1498 val &= ~(SMU_CGUCR_GEN_BIT(REGCLK_ENABLE) |
1499 SMU_CGUCR_GEN_BIT(TXCLK_ENABLE) |
1500 SMU_CGUCR_GEN_BIT(XCLK_ENABLE));
1501 val |= SMU_CGUCR_GEN_BIT(IDLE_ENABLE);
1502 writel(val, &ihost->smu_registers->clock_gating_control);
1494 1503
1495 /* set the default interrupt coalescence number and timeout value. */ 1504 /* set the default interrupt coalescence number and timeout value. */
1496 sci_controller_set_interrupt_coalescence(ihost, 0, 0); 1505 sci_controller_set_interrupt_coalescence(ihost, 0, 0);
diff --git a/drivers/scsi/isci/registers.h b/drivers/scsi/isci/registers.h
index eaa541afc755..7eb0ccd45fe6 100644
--- a/drivers/scsi/isci/registers.h
+++ b/drivers/scsi/isci/registers.h
@@ -370,6 +370,27 @@ struct scu_iit_entry {
370 >> SMU_DEVICE_CONTEXT_CAPACITY_MAX_RNC_SHIFT \ 370 >> SMU_DEVICE_CONTEXT_CAPACITY_MAX_RNC_SHIFT \
371 ) 371 )
372 372
373/* ***************************************************************************** */
374#define SMU_CLOCK_GATING_CONTROL_IDLE_ENABLE_SHIFT (0)
375#define SMU_CLOCK_GATING_CONTROL_IDLE_ENABLE_MASK (0x00000001)
376#define SMU_CLOCK_GATING_CONTROL_XCLK_ENABLE_SHIFT (1)
377#define SMU_CLOCK_GATING_CONTROL_XCLK_ENABLE_MASK (0x00000002)
378#define SMU_CLOCK_GATING_CONTROL_TXCLK_ENABLE_SHIFT (2)
379#define SMU_CLOCK_GATING_CONTROL_TXCLK_ENABLE_MASK (0x00000004)
380#define SMU_CLOCK_GATING_CONTROL_REGCLK_ENABLE_SHIFT (3)
381#define SMU_CLOCK_GATING_CONTROL_REGCLK_ENABLE_MASK (0x00000008)
382#define SMU_CLOCK_GATING_CONTROL_IDLE_TIMEOUT_SHIFT (16)
383#define SMU_CLOCK_GATING_CONTROL_IDLE_TIMEOUT_MASK (0x000F0000)
384#define SMU_CLOCK_GATING_CONTROL_FORCE_IDLE_SHIFT (31)
385#define SMU_CLOCK_GATING_CONTROL_FORCE_IDLE_MASK (0x80000000)
386#define SMU_CLOCK_GATING_CONTROL_RESERVED_MASK (0x7FF0FFF0)
387
388#define SMU_CGUCR_GEN_VAL(name, value) \
389 SCU_GEN_VALUE(SMU_CLOCK_GATING_CONTROL_##name, value)
390
391#define SMU_CGUCR_GEN_BIT(name) \
392 SCU_GEN_BIT(SMU_CLOCK_GATING_CONTROL_##name)
393
373/* -------------------------------------------------------------------------- */ 394/* -------------------------------------------------------------------------- */
374 395
375#define SMU_CONTROL_STATUS_TASK_CONTEXT_RANGE_ENABLE_SHIFT (0) 396#define SMU_CONTROL_STATUS_TASK_CONTEXT_RANGE_ENABLE_SHIFT (0)
@@ -992,8 +1013,10 @@ struct smu_registers {
992 u32 mmr_address_window; 1013 u32 mmr_address_window;
993/* 0x00A4 SMDW */ 1014/* 0x00A4 SMDW */
994 u32 mmr_data_window; 1015 u32 mmr_data_window;
995 u32 reserved_A8; 1016/* 0x00A8 CGUCR */
996 u32 reserved_AC; 1017 u32 clock_gating_control;
1018/* 0x00AC CGUPC */
1019 u32 clock_gating_performance;
997/* A whole bunch of reserved space */ 1020/* A whole bunch of reserved space */
998 u32 reserved_Bx[4]; 1021 u32 reserved_Bx[4];
999 u32 reserved_Cx[4]; 1022 u32 reserved_Cx[4];